@mulmoclaude/core 1.0.1 → 1.2.1
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/collection-skills.md +28 -0
- package/dist/artifacts/paths.cjs +68 -0
- package/dist/artifacts/paths.cjs.map +1 -0
- package/dist/artifacts/paths.d.ts +45 -0
- package/dist/artifacts/paths.js +62 -0
- package/dist/artifacts/paths.js.map +1 -0
- package/dist/atomic-C_7YpMiM.cjs +102 -0
- package/dist/atomic-C_7YpMiM.cjs.map +1 -0
- package/dist/atomic-DPpdrJzO.js +89 -0
- package/dist/atomic-DPpdrJzO.js.map +1 -0
- package/dist/collection/core/chatSeed.d.ts +4 -0
- package/dist/collection/core/completion.d.ts +53 -0
- package/dist/collection/core/ids.d.ts +10 -0
- package/dist/collection/core/linkTargets.d.ts +14 -0
- package/dist/collection/core/ownProp.d.ts +9 -0
- package/dist/collection/core/recordKeys.d.ts +21 -0
- package/dist/collection/core/schemaRules.d.ts +167 -0
- package/dist/collection/core/schemaZ.d.ts +489 -9
- package/dist/collection/core/sortValueOf.d.ts +21 -0
- package/dist/collection/core/textSearch.d.ts +12 -0
- package/dist/collection/index.cjs +132 -29
- package/dist/collection/index.cjs.map +1 -1
- package/dist/collection/index.d.ts +5 -0
- package/dist/collection/index.js +115 -29
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/registry/server/index.cjs +14 -42
- package/dist/collection/registry/server/index.cjs.map +1 -1
- package/dist/collection/registry/server/index.js +6 -34
- package/dist/collection/registry/server/index.js.map +1 -1
- package/dist/collection/server/discovery.d.ts +7 -0
- package/dist/collection/server/host.d.ts +3 -8
- package/dist/collection/server/index.cjs +10 -9
- package/dist/collection/server/index.d.ts +1 -0
- package/dist/collection/server/index.js +4 -4
- package/dist/collection/server/io.d.ts +0 -88
- package/dist/collection/server/skillAssets.d.ts +90 -0
- package/dist/collection-watchers/config.d.ts +2 -4
- package/dist/collection-watchers/index.cjs +5 -5
- package/dist/collection-watchers/index.cjs.map +1 -1
- package/dist/collection-watchers/index.js +5 -5
- package/dist/collection-watchers/index.js.map +1 -1
- package/dist/{discovery-Dpz6SWwe.cjs → discovery--kRUWed0.cjs} +444 -434
- package/dist/discovery--kRUWed0.cjs.map +1 -0
- package/dist/{discovery-BYIsLqag.js → discovery-CKR4TOX3.js} +426 -392
- package/dist/discovery-CKR4TOX3.js.map +1 -0
- package/dist/dist-Cwk0e12G.js +50 -0
- package/dist/dist-Cwk0e12G.js.map +1 -0
- package/dist/dist-pWpC-b04.cjs +61 -0
- package/dist/dist-pWpC-b04.cjs.map +1 -0
- package/dist/feeds/index.cjs +2 -2
- package/dist/feeds/index.js +2 -2
- package/dist/feeds/server/host.d.ts +5 -8
- package/dist/feeds/server/index.cjs +143 -61
- package/dist/feeds/server/index.cjs.map +1 -1
- package/dist/feeds/server/index.js +141 -59
- package/dist/feeds/server/index.js.map +1 -1
- package/dist/files/atomic.d.ts +34 -0
- package/dist/files/index.cjs +47 -0
- package/dist/files/index.cjs.map +1 -0
- package/dist/files/index.d.ts +3 -0
- package/dist/files/index.js +40 -0
- package/dist/files/index.js.map +1 -0
- package/dist/files/json.d.ts +4 -0
- package/dist/files/safe.d.ts +9 -0
- package/dist/google/auth.d.ts +1 -1
- package/dist/google/collectionDateTime.d.ts +5 -0
- package/dist/google/collectionSync.d.ts +2 -2
- package/dist/google/fsJson.d.ts +3 -2
- package/dist/google/host.d.ts +3 -6
- package/dist/google/index.cjs +64 -91
- package/dist/google/index.cjs.map +1 -1
- package/dist/google/index.d.ts +1 -0
- package/dist/google/index.js +57 -85
- package/dist/google/index.js.map +1 -1
- package/dist/{graph-o5FZZbXf.js → graph-BcwqiSpR.js} +2 -14
- package/dist/graph-BcwqiSpR.js.map +1 -0
- package/dist/{graph-2R4HbQAg.cjs → graph-DjE1Az1C.cjs} +2 -14
- package/dist/graph-DjE1Az1C.cjs.map +1 -0
- package/dist/host/hostSlot.d.ts +27 -0
- package/dist/{ids-DWmHjm17.cjs → ids-BnTh3Hl0.cjs} +29 -1
- package/dist/{ids-DWmHjm17.cjs.map → ids-BnTh3Hl0.cjs.map} +1 -1
- package/dist/{ids-D1M1T6KJ.js → ids-s4GfmE93.js} +18 -2
- package/dist/{ids-D1M1T6KJ.js.map → ids-s4GfmE93.js.map} +1 -1
- package/dist/{ingestTypes-Ci4eOgv-.js → ingestTypes-L59cIGgX.js} +2 -2
- package/dist/{ingestTypes-Ci4eOgv-.js.map → ingestTypes-L59cIGgX.js.map} +1 -1
- package/dist/{ingestTypes-DbuQNuK6.cjs → ingestTypes-xX8VpQqh.cjs} +2 -2
- package/dist/{ingestTypes-DbuQNuK6.cjs.map → ingestTypes-xX8VpQqh.cjs.map} +1 -1
- package/dist/notifier/engine.d.ts +2 -4
- package/dist/notifier/index.cjs +1 -1
- package/dist/notifier/index.js +1 -1
- package/dist/{notifier-ChpY0XrY.js → notifier-BdA5qzhe.js} +14 -16
- package/dist/notifier-BdA5qzhe.js.map +1 -0
- package/dist/{notifier-bS8IEeLA.cjs → notifier-tMsAXyXp.cjs} +14 -16
- package/dist/notifier-tMsAXyXp.cjs.map +1 -0
- package/dist/plugin-vue/fileWatch.d.ts +5 -0
- package/dist/plugin-vue/i18n.cjs +45 -0
- package/dist/plugin-vue/i18n.cjs.map +1 -0
- package/dist/plugin-vue/i18n.js +44 -0
- package/dist/plugin-vue/i18n.js.map +1 -0
- package/dist/plugin-vue/index.cjs +98 -0
- package/dist/plugin-vue/index.cjs.map +1 -0
- package/dist/plugin-vue/index.d.ts +5 -0
- package/dist/plugin-vue/index.js +91 -0
- package/dist/plugin-vue/index.js.map +1 -0
- package/dist/plugin-vue/markdownDoc.d.ts +10 -0
- package/dist/plugin-vue/pluginI18n.d.ts +22 -0
- package/dist/plugin-vue/useClipboardCopy.d.ts +6 -0
- package/dist/plugin-vue/useFileWatch.d.ts +8 -0
- package/dist/plugin-vue/useMarkdownDoc.d.ts +3 -0
- package/dist/{promptSafety-Bugq2kqL.js → promptSafety-CQ5Un4wi.js} +104 -7
- package/dist/promptSafety-CQ5Un4wi.js.map +1 -0
- package/dist/{promptSafety-DbE6eZmP.cjs → promptSafety-DfZYNtjK.cjs} +151 -6
- package/dist/promptSafety-DfZYNtjK.cjs.map +1 -0
- package/dist/remote-host/server/hostRunner.d.ts +5 -1
- package/dist/remote-host/server/index.cjs +75 -21
- package/dist/remote-host/server/index.cjs.map +1 -1
- package/dist/remote-host/server/index.js +72 -18
- package/dist/remote-host/server/index.js.map +1 -1
- package/dist/scheduler/index.cjs +3 -3
- package/dist/scheduler/index.cjs.map +1 -1
- package/dist/scheduler/index.js +2 -2
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/task-manager.d.ts +2 -5
- package/dist/{server-CtCBLYgZ.js → server-BZJCw2HU.js} +209 -41
- package/dist/server-BZJCw2HU.js.map +1 -0
- package/dist/{server-BjWrcc5T.cjs → server-w5ZZRLju.cjs} +250 -46
- package/dist/server-w5ZZRLju.cjs.map +1 -0
- package/dist/skill-bridge/index.cjs +1 -1
- package/dist/skill-bridge/index.js +1 -1
- package/dist/translation/client.cjs +16 -0
- package/dist/translation/client.cjs.map +1 -1
- package/dist/translation/client.d.ts +6 -0
- package/dist/translation/client.js +16 -1
- package/dist/translation/client.js.map +1 -1
- package/dist/utils/errors.d.ts +2 -1
- package/dist/utils/fetch.cjs +36 -0
- package/dist/utils/fetch.cjs.map +1 -0
- package/dist/{collection/registry/server → utils}/fetch.d.ts +5 -3
- package/dist/utils/fetch.js +34 -0
- package/dist/utils/fetch.js.map +1 -0
- package/dist/utils/index.cjs +11 -3
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.js +9 -1
- package/dist/utils/index.js.map +1 -0
- package/dist/whisper/index.cjs +9 -9
- package/dist/whisper/index.cjs.map +1 -1
- package/dist/whisper/index.js +3 -3
- package/dist/wiki/index.cjs +23 -28
- package/dist/wiki/index.cjs.map +1 -1
- package/dist/wiki/index.js +21 -26
- package/dist/wiki/index.js.map +1 -1
- package/dist/wiki/link.d.ts +7 -1
- package/dist/wiki/render.d.ts +5 -7
- package/dist/wiki/server/frontmatter.d.ts +2 -6
- package/dist/wiki/server/index.cjs +5 -41
- package/dist/wiki/server/index.cjs.map +1 -1
- package/dist/wiki/server/index.js +3 -39
- package/dist/wiki/server/index.js.map +1 -1
- package/dist/workspace-setup/index.js +22 -6
- package/dist/workspace-setup/index.js.map +1 -1
- package/package.json +54 -11
- package/dist/collection/server/atomic.d.ts +0 -1
- package/dist/discovery-BYIsLqag.js.map +0 -1
- package/dist/discovery-Dpz6SWwe.cjs.map +0 -1
- package/dist/errors-7P5eMOSX.cjs +0 -30
- package/dist/errors-7P5eMOSX.cjs.map +0 -1
- package/dist/errors-eid6Mes3.js +0 -19
- package/dist/errors-eid6Mes3.js.map +0 -1
- package/dist/google/fetch.d.ts +0 -8
- package/dist/graph-2R4HbQAg.cjs.map +0 -1
- package/dist/graph-o5FZZbXf.js.map +0 -1
- package/dist/notifier-ChpY0XrY.js.map +0 -1
- package/dist/notifier-bS8IEeLA.cjs.map +0 -1
- package/dist/promptSafety-Bugq2kqL.js.map +0 -1
- package/dist/promptSafety-DbE6eZmP.cjs.map +0 -1
- package/dist/server-BjWrcc5T.cjs.map +0 -1
- package/dist/server-CtCBLYgZ.js.map +0 -1
package/dist/google/index.js
CHANGED
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
import { t as errorMessage } from "../
|
|
1
|
+
import { t as errorMessage } from "../dist-Cwk0e12G.js";
|
|
2
2
|
import { t as truncate } from "../text-CjDbP2O1.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { t as writeFileAtomic } from "../atomic-DPpdrJzO.js";
|
|
4
|
+
import { fetchWithTimeout } from "../utils/fetch.js";
|
|
5
|
+
import { J as getWorkspaceRoot, d as storeFor, et as createForwardingLogger, n as discoverCollections, tt as createHostSlot } from "../discovery-CKR4TOX3.js";
|
|
5
6
|
import { promises } from "node:fs";
|
|
6
|
-
import
|
|
7
|
+
import path, { join } from "node:path";
|
|
7
8
|
import { randomBytes } from "node:crypto";
|
|
9
|
+
import { constants, copyFile, mkdir, readFile, readdir, rm, stat } from "node:fs/promises";
|
|
8
10
|
import { homedir } from "node:os";
|
|
9
11
|
import { MISSED_RUN_POLICIES, SCHEDULE_TYPES } from "@receptron/task-scheduler";
|
|
10
12
|
import http from "node:http";
|
|
11
13
|
import { CodeChallengeMethod, OAuth2Client } from "google-auth-library";
|
|
12
14
|
//#region src/google/host.ts
|
|
13
|
-
var
|
|
14
|
-
error: () => void 0,
|
|
15
|
-
warn: () => void 0,
|
|
16
|
-
info: () => void 0,
|
|
17
|
-
debug: () => void 0
|
|
18
|
-
};
|
|
15
|
+
var hostSlot = createHostSlot("@mulmoclaude/core/google: configureGoogleHost()");
|
|
19
16
|
function configureGoogleHost(binding) {
|
|
20
|
-
|
|
17
|
+
hostSlot.set(binding.log);
|
|
21
18
|
}
|
|
22
|
-
var log =
|
|
23
|
-
error: (prefix, message, data) => hostLog.error(prefix, message, data),
|
|
24
|
-
warn: (prefix, message, data) => hostLog.warn(prefix, message, data),
|
|
25
|
-
info: (prefix, message, data) => hostLog.info(prefix, message, data),
|
|
26
|
-
debug: (prefix, message, data) => hostLog.debug(prefix, message, data)
|
|
27
|
-
};
|
|
19
|
+
var log = createForwardingLogger(() => hostSlot.peek());
|
|
28
20
|
//#endregion
|
|
29
21
|
//#region src/google/datetime.ts
|
|
30
22
|
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
|
-
var FRACTIONAL_SECONDS_RE = /\.\d+(?=Z|[+-])/;
|
|
23
|
+
var FRACTIONAL_SECONDS_RE$1 = /\.\d+(?=Z|[+-])/;
|
|
32
24
|
var MAX_HOUR = 23;
|
|
33
25
|
var MAX_MINUTE = 59;
|
|
34
26
|
var MAX_SECOND = 59;
|
|
@@ -37,7 +29,7 @@ var isRealCalendarDate = (year, month, day) => {
|
|
|
37
29
|
return roundTrip.getUTCFullYear() === year && roundTrip.getUTCMonth() === month - 1 && roundTrip.getUTCDate() === day;
|
|
38
30
|
};
|
|
39
31
|
var isIsoDateTimeWithOffset = (value) => {
|
|
40
|
-
const match = ISO_DATE_TIME_WITH_OFFSET_RE.exec(value.replace(FRACTIONAL_SECONDS_RE, ""));
|
|
32
|
+
const match = ISO_DATE_TIME_WITH_OFFSET_RE.exec(value.replace(FRACTIONAL_SECONDS_RE$1, ""));
|
|
41
33
|
if (!match) return false;
|
|
42
34
|
const [year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0] = match.slice(1, 7).map(Number);
|
|
43
35
|
const timeInRange = hour <= MAX_HOUR && minute <= MAX_MINUTE && second <= MAX_SECOND;
|
|
@@ -114,6 +106,7 @@ async function loadClientSecret(home) {
|
|
|
114
106
|
}
|
|
115
107
|
//#endregion
|
|
116
108
|
//#region src/google/fsJson.ts
|
|
109
|
+
var JSON_INDENT = 2;
|
|
117
110
|
async function readJsonOrNull(filePath) {
|
|
118
111
|
try {
|
|
119
112
|
const raw = await promises.readFile(filePath, "utf-8");
|
|
@@ -122,39 +115,14 @@ async function readJsonOrNull(filePath) {
|
|
|
122
115
|
return null;
|
|
123
116
|
}
|
|
124
117
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
100,
|
|
129
|
-
300
|
|
130
|
-
];
|
|
131
|
-
var hasErrnoCode = (err) => typeof err === "object" && err !== null && "code" in err && typeof err.code === "string";
|
|
132
|
-
var isTransientRenameError = (err) => IS_WINDOWS && hasErrnoCode(err) && (err.code === "EPERM" || err.code === "EBUSY" || err.code === "EACCES");
|
|
133
|
-
async function renameWithWindowsRetry(fromPath, toPath) {
|
|
134
|
-
for (const delayMs of RENAME_RETRY_DELAYS_MS) try {
|
|
135
|
-
await promises.rename(fromPath, toPath);
|
|
136
|
-
return;
|
|
137
|
-
} catch (err) {
|
|
138
|
-
if (!isTransientRenameError(err)) throw err;
|
|
139
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
140
|
-
}
|
|
141
|
-
await promises.rename(fromPath, toPath);
|
|
142
|
-
}
|
|
143
|
-
/** tmp-write + rename so readers never see a half-written file; `mode`
|
|
144
|
-
* applies to the tmp file and survives the rename. */
|
|
118
|
+
/** tmp-write + rename so readers never see a half-written file; `mode` applies
|
|
119
|
+
* to the tmp file and survives the rename. A single-writer token file, so the
|
|
120
|
+
* staging name is stable (`uniqueTmp: false`). */
|
|
145
121
|
async function writeJsonAtomicWithMode(filePath, data, mode) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
encoding: "utf-8",
|
|
151
|
-
mode
|
|
152
|
-
});
|
|
153
|
-
await renameWithWindowsRetry(tmp, filePath);
|
|
154
|
-
} catch (err) {
|
|
155
|
-
await promises.unlink(tmp).catch(() => void 0);
|
|
156
|
-
throw err;
|
|
157
|
-
}
|
|
122
|
+
await writeFileAtomic(filePath, JSON.stringify(data, null, JSON_INDENT), {
|
|
123
|
+
mode,
|
|
124
|
+
uniqueTmp: false
|
|
125
|
+
});
|
|
158
126
|
}
|
|
159
127
|
//#endregion
|
|
160
128
|
//#region src/google/tokenStore.ts
|
|
@@ -196,36 +164,6 @@ async function deleteGoogleTokens(home) {
|
|
|
196
164
|
await rm(googleTokenPath(home), { force: true });
|
|
197
165
|
}
|
|
198
166
|
//#endregion
|
|
199
|
-
//#region src/google/fetch.ts
|
|
200
|
-
var DEFAULT_FETCH_TIMEOUT_MS = 10 * ONE_SECOND_MS;
|
|
201
|
-
/** `fetch` with a finite timeout. Rejects with a `TimeoutError` once
|
|
202
|
-
* `timeoutMs` elapses. Composes with a caller-supplied `signal` so external
|
|
203
|
-
* cancellation still works. */
|
|
204
|
-
async function fetchWithTimeout(url, init = {}) {
|
|
205
|
-
const { timeoutMs = DEFAULT_FETCH_TIMEOUT_MS, signal: callerSignal, ...rest } = init;
|
|
206
|
-
if (callerSignal?.aborted) throw callerSignal.reason ?? new DOMException("Aborted", "AbortError");
|
|
207
|
-
const controller = new AbortController();
|
|
208
|
-
const timer = setTimeout(() => {
|
|
209
|
-
controller.abort(new DOMException(`fetch timed out after ${timeoutMs}ms`, "TimeoutError"));
|
|
210
|
-
}, timeoutMs);
|
|
211
|
-
const unsubscribeCaller = bridgeExternalSignal(callerSignal, controller);
|
|
212
|
-
try {
|
|
213
|
-
return await fetch(url, {
|
|
214
|
-
...rest,
|
|
215
|
-
signal: controller.signal
|
|
216
|
-
});
|
|
217
|
-
} finally {
|
|
218
|
-
clearTimeout(timer);
|
|
219
|
-
unsubscribeCaller?.();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
function bridgeExternalSignal(external, controller) {
|
|
223
|
-
if (!external) return null;
|
|
224
|
-
const onAbort = () => controller.abort(external.reason);
|
|
225
|
-
external.addEventListener("abort", onAbort, { once: true });
|
|
226
|
-
return () => external.removeEventListener("abort", onAbort);
|
|
227
|
-
}
|
|
228
|
-
//#endregion
|
|
229
167
|
//#region src/google/broker.ts
|
|
230
168
|
var DEFAULT_BROKER_BASE_URL = "https://asia-northeast1-mulmoserver.cloudfunctions.net";
|
|
231
169
|
var BROKER_TIMEOUT_MS = 20 * ONE_SECOND_MS;
|
|
@@ -844,15 +782,49 @@ async function clearCalendarSyncToken(calendarId, workspaceRoot) {
|
|
|
844
782
|
await updateState((tokens) => Object.fromEntries(Object.entries(tokens).filter(([key]) => key !== dropped)), workspaceRoot);
|
|
845
783
|
}
|
|
846
784
|
//#endregion
|
|
785
|
+
//#region src/google/collectionDateTime.ts
|
|
786
|
+
/** All-day events carry no clock; midnight is where the day view places them. */
|
|
787
|
+
var ALL_DAY_CLOCK = "00:00";
|
|
788
|
+
var DATE_ONLY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
789
|
+
/** RFC3339 zone designator: `Z`, `+09:00`, `-0500`. */
|
|
790
|
+
var ZONE_SUFFIX_RE = /(?:Z|[+-]\d{2}:?\d{2})$/;
|
|
791
|
+
/** Fractional seconds have no place in the collection datetime shape. */
|
|
792
|
+
var FRACTIONAL_SECONDS_RE = /\.\d+$/;
|
|
793
|
+
/** Normalise one Google Calendar time value for storage in a `datetime` field.
|
|
794
|
+
* Anything that isn't a recognisable Google shape (empty string, non-string,
|
|
795
|
+
* free text) is returned untouched — the record lint should report it rather
|
|
796
|
+
* than have this function invent a value. */
|
|
797
|
+
function toCollectionDateTime(value) {
|
|
798
|
+
if (typeof value !== "string") return value;
|
|
799
|
+
const trimmed = value.trim();
|
|
800
|
+
if (DATE_ONLY_RE.test(trimmed)) return `${trimmed}T${ALL_DAY_CLOCK}`;
|
|
801
|
+
if (!trimmed.includes("T")) return value;
|
|
802
|
+
return trimmed.replace(ZONE_SUFFIX_RE, "").replace(FRACTIONAL_SECONDS_RE, "");
|
|
803
|
+
}
|
|
804
|
+
//#endregion
|
|
847
805
|
//#region src/google/collectionSync.ts
|
|
848
806
|
var GOOGLE_CALENDAR_SYNC_TASK_ID = "system:google-calendar-sync";
|
|
849
807
|
var DEFAULT_SYNC_INTERVAL_MS = 3600 * 1e3;
|
|
850
808
|
var CANCELLED_STATUS = "cancelled";
|
|
809
|
+
var DATETIME_FIELD_TYPE = "datetime";
|
|
810
|
+
/** Own-property lookup, mirroring what the record lint reads: a spec reachable
|
|
811
|
+
* only through the prototype chain is not a DECLARED field, so it must not
|
|
812
|
+
* decide how a value is stored. */
|
|
813
|
+
function declaredSpec(fields, field) {
|
|
814
|
+
return Object.hasOwn(fields, field) ? fields[field] : void 0;
|
|
815
|
+
}
|
|
816
|
+
/** Google's raw value is normalised only into a field the schema declares as
|
|
817
|
+
* `datetime` — that is the type whose stored shape the record lint, the
|
|
818
|
+
* calendar grid and the day view all parse (#2310). A user who maps `start`
|
|
819
|
+
* onto a `string` field asked for Google's value verbatim and keeps it. */
|
|
820
|
+
function projectValue(fields, field, value) {
|
|
821
|
+
return declaredSpec(fields, field)?.type === DATETIME_FIELD_TYPE ? toCollectionDateTime(value) : value;
|
|
822
|
+
}
|
|
851
823
|
/** Project one Google event onto the collection's own field names. The
|
|
852
824
|
* primary field always takes the event id — upsert-by-id is what keeps the
|
|
853
825
|
* sync idempotent, so it is deliberately not remappable. */
|
|
854
|
-
function toCollectionRecord(event, map, primaryKey) {
|
|
855
|
-
const mapped = Object.entries(map).map(([field, source]) => [field, event[source]]);
|
|
826
|
+
function toCollectionRecord(event, map, primaryKey, fields) {
|
|
827
|
+
const mapped = Object.entries(map).map(([field, source]) => [field, projectValue(fields, field, event[source])]);
|
|
856
828
|
return {
|
|
857
829
|
...Object.fromEntries(mapped),
|
|
858
830
|
[primaryKey]: event.id
|
|
@@ -893,7 +865,7 @@ async function applyEvent(collection, event, workspaceRoot) {
|
|
|
893
865
|
const deleted = await store.delete(event.id);
|
|
894
866
|
return classifyDelete(event.id, deleted.kind);
|
|
895
867
|
}
|
|
896
|
-
const record = toCollectionRecord(event, schema.googleCalendar?.map ?? {}, schema.primaryKey);
|
|
868
|
+
const record = toCollectionRecord(event, schema.googleCalendar?.map ?? {}, schema.primaryKey, schema.fields);
|
|
897
869
|
const written = await store.write(event.id, record);
|
|
898
870
|
return classifyWrite(event.id, written.kind);
|
|
899
871
|
} catch (error) {
|
|
@@ -1161,6 +1133,6 @@ async function deleteDriveFile(accessToken, input) {
|
|
|
1161
1133
|
await googleRequest(DRIVE_API_LABEL, accessToken, `${DRIVE_FILES_URL}/${encodeURIComponent(input.fileId)}`, { method: "DELETE" });
|
|
1162
1134
|
}
|
|
1163
1135
|
//#endregion
|
|
1164
|
-
export { DEFAULT_LIST_MAX_RESULTS, GOOGLE_AUTH_CANCELLED, GOOGLE_CALENDARLIST_SCOPE, GOOGLE_CALENDAR_SCOPE, GOOGLE_CALENDAR_SYNC_TASK_ID, GOOGLE_DRIVE_FILE_SCOPE, GOOGLE_SCOPES, GOOGLE_TASKS_SCOPE, GoogleApiError, MAX_LIST_RESULTS, assertSafeMimeType, authorizeGoogle, brokerBaseUrl, brokerExchange, brokerRefresh, brokerStart, buildMultipartBody, calendarApiError, calendarSyncStatePath, canonicalCalendarId, classifyDelete, classifyWrite, clearCalendarSyncToken, clientSecretPresence, collectCalendarPages, commitLinkedTokens, completeTask, configureGoogleHost, createCalendarEvent, createDriveFile, createGoogleAuthFlow, createTask, deleteDriveFile, deleteGoogleTokens, deleteTask, findClientSecretPath, getCalendarColors, getGoogleAccessToken, googleApiError, googleAuthFlow, googleCalendarSyncTaskDef, googleConfigDir, googleSecretsDir, googleTokenPath, groupByCalendar, isGoogleApiError, isIsoDateTimeWithOffset, isTextMimeType, legacyGoogleTokenPath, listCalendarEvents, listCalendars, listDriveFiles, listTaskLists, listTasks, loadCalendarSyncToken, loadClientSecret, loadGoogleTokens, mergeGoogleTokens, pickBoundary, readDriveFile, saveCalendarSyncToken, saveGoogleTokens, syncCalendarEvents, syncCalendarGroup, syncDueCalendarCollections, toCalendarSummary, toCollectionRecord, toDriveFileSummary, toEventSummary, toTaskListSummary, toTaskSummary, unlinkGoogle, waitForAuthCode };
|
|
1136
|
+
export { DEFAULT_LIST_MAX_RESULTS, GOOGLE_AUTH_CANCELLED, GOOGLE_CALENDARLIST_SCOPE, GOOGLE_CALENDAR_SCOPE, GOOGLE_CALENDAR_SYNC_TASK_ID, GOOGLE_DRIVE_FILE_SCOPE, GOOGLE_SCOPES, GOOGLE_TASKS_SCOPE, GoogleApiError, MAX_LIST_RESULTS, assertSafeMimeType, authorizeGoogle, brokerBaseUrl, brokerExchange, brokerRefresh, brokerStart, buildMultipartBody, calendarApiError, calendarSyncStatePath, canonicalCalendarId, classifyDelete, classifyWrite, clearCalendarSyncToken, clientSecretPresence, collectCalendarPages, commitLinkedTokens, completeTask, configureGoogleHost, createCalendarEvent, createDriveFile, createGoogleAuthFlow, createTask, deleteDriveFile, deleteGoogleTokens, deleteTask, findClientSecretPath, getCalendarColors, getGoogleAccessToken, googleApiError, googleAuthFlow, googleCalendarSyncTaskDef, googleConfigDir, googleSecretsDir, googleTokenPath, groupByCalendar, isGoogleApiError, isIsoDateTimeWithOffset, isTextMimeType, legacyGoogleTokenPath, listCalendarEvents, listCalendars, listDriveFiles, listTaskLists, listTasks, loadCalendarSyncToken, loadClientSecret, loadGoogleTokens, mergeGoogleTokens, pickBoundary, readDriveFile, saveCalendarSyncToken, saveGoogleTokens, syncCalendarEvents, syncCalendarGroup, syncDueCalendarCollections, toCalendarSummary, toCollectionDateTime, toCollectionRecord, toDriveFileSummary, toEventSummary, toTaskListSummary, toTaskSummary, unlinkGoogle, waitForAuthCode };
|
|
1165
1137
|
|
|
1166
1138
|
//# sourceMappingURL=index.js.map
|