@wirecat/attio-cli 0.0.0-stage → 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/CHANGELOG.md +20 -0
- package/LICENSE +204 -0
- package/README.md +248 -2
- package/contracts/wirecat.json +2321 -0
- package/dist/bin/attio.d.ts +3 -0
- package/dist/bin/attio.d.ts.map +1 -0
- package/dist/bin/attio.js +40 -0
- package/dist/bin/attio.js.map +1 -0
- package/dist/bundle/agent-KLBL3FYD.js +37 -0
- package/dist/bundle/all-profiles-C2NMRQPE.js +320 -0
- package/dist/bundle/anthropic-KOU2ILDK.js +91 -0
- package/dist/bundle/app-server-TINV4NNY.js +249 -0
- package/dist/bundle/attio.js +183 -0
- package/dist/bundle/bun-GVNM6IWY.js +169 -0
- package/dist/bundle/bun-sqlite-IF6B3EQI.js +76 -0
- package/dist/bundle/chunk-2343HKEW.js +362 -0
- package/dist/bundle/chunk-2H2MWGBD.js +988 -0
- package/dist/bundle/chunk-2P7ENEQ7.js +288 -0
- package/dist/bundle/chunk-4EYKJLWI.js +771 -0
- package/dist/bundle/chunk-4HQDT5PF.js +338 -0
- package/dist/bundle/chunk-4QE4L7UL.js +142 -0
- package/dist/bundle/chunk-4XHWGJXT.js +6848 -0
- package/dist/bundle/chunk-5DCRHSBI.js +72 -0
- package/dist/bundle/chunk-5ETXE5KF.js +372 -0
- package/dist/bundle/chunk-5WAGTWCS.js +156 -0
- package/dist/bundle/chunk-6B5PSQQ7.js +319 -0
- package/dist/bundle/chunk-6BVPS2YY.js +230 -0
- package/dist/bundle/chunk-6L5EUGLP.js +188 -0
- package/dist/bundle/chunk-7NFEMS4A.js +1028 -0
- package/dist/bundle/chunk-A7YQTQ5U.js +733 -0
- package/dist/bundle/chunk-AEPOHR4Z.js +82 -0
- package/dist/bundle/chunk-ARRQVUJ2.js +334 -0
- package/dist/bundle/chunk-BHNFRL3H.js +95 -0
- package/dist/bundle/chunk-CBPL3GID.js +23 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DVN54VPI.js +16 -0
- package/dist/bundle/chunk-DW3V7GTY.js +388 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-ETSOG6TZ.js +65288 -0
- package/dist/bundle/chunk-FJV3MO57.js +29 -0
- package/dist/bundle/chunk-HLLRNP2G.js +170 -0
- package/dist/bundle/chunk-HQJ2TABD.js +18 -0
- package/dist/bundle/chunk-ICUXAOEM.js +42063 -0
- package/dist/bundle/chunk-IGALQ74S.js +358 -0
- package/dist/bundle/chunk-IPHUAWFG.js +100 -0
- package/dist/bundle/chunk-IYMWUL6E.js +633 -0
- package/dist/bundle/chunk-JKCXDIGC.js +52 -0
- package/dist/bundle/chunk-JTOKDROB.js +95 -0
- package/dist/bundle/chunk-JZMGOVCZ.js +80 -0
- package/dist/bundle/chunk-KB3YJJPN.js +794 -0
- package/dist/bundle/chunk-KD4EUUER.js +37 -0
- package/dist/bundle/chunk-LB6D4QF2.js +2333 -0
- package/dist/bundle/chunk-LWUJZ2E3.js +108 -0
- package/dist/bundle/chunk-MCQOXTAL.js +53 -0
- package/dist/bundle/chunk-MMGCGPKM.js +3571 -0
- package/dist/bundle/chunk-MXDIXBIV.js +24 -0
- package/dist/bundle/chunk-MYVWV5L5.js +407 -0
- package/dist/bundle/chunk-MZNRIH3T.js +1233 -0
- package/dist/bundle/chunk-NEFILPPV.js +353 -0
- package/dist/bundle/chunk-O6CVJGGL.js +131 -0
- package/dist/bundle/chunk-OPXCRQTV.js +161 -0
- package/dist/bundle/chunk-PKNFA5TU.js +38 -0
- package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
- package/dist/bundle/chunk-PO6PLQYL.js +50 -0
- package/dist/bundle/chunk-PWUQC2GI.js +218 -0
- package/dist/bundle/chunk-QCEEPJNN.js +185 -0
- package/dist/bundle/chunk-QG4WCLGB.js +1332 -0
- package/dist/bundle/chunk-QNQ2OF24.js +9578 -0
- package/dist/bundle/chunk-RCKRXBJF.js +1392 -0
- package/dist/bundle/chunk-RK4GN2II.js +2000 -0
- package/dist/bundle/chunk-RRH7UK7L.js +106 -0
- package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
- package/dist/bundle/chunk-S7WJXELM.js +58 -0
- package/dist/bundle/chunk-SBRFKB77.js +1197 -0
- package/dist/bundle/chunk-SP6DPFZ4.js +4072 -0
- package/dist/bundle/chunk-SWJDLFDM.js +557 -0
- package/dist/bundle/chunk-TWCVCW5T.js +66 -0
- package/dist/bundle/chunk-V2R2BJJU.js +63 -0
- package/dist/bundle/chunk-V5K3M7FE.js +78 -0
- package/dist/bundle/chunk-V6ALLFEE.js +1068 -0
- package/dist/bundle/chunk-V6EVJXLO.js +259 -0
- package/dist/bundle/chunk-VJ4CPL6F.js +54 -0
- package/dist/bundle/chunk-VL25A6V2.js +41 -0
- package/dist/bundle/chunk-WBEZZGZE.js +12645 -0
- package/dist/bundle/chunk-WIYAMDPP.js +73 -0
- package/dist/bundle/chunk-WRJGITBX.js +76 -0
- package/dist/bundle/chunk-XHIVZPQ2.js +7 -0
- package/dist/bundle/chunk-XQUUANA2.js +24600 -0
- package/dist/bundle/chunk-XTQIXZVM.js +2788 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YKN4Y35P.js +206 -0
- package/dist/bundle/chunk-ZMJZQGCN.js +46 -0
- package/dist/bundle/chunk-ZPSH27BB.js +274 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-3FR7BK72.js +37 -0
- package/dist/bundle/command-server-entry-4XR4GDS7.js +166 -0
- package/dist/bundle/decode-24EITKP4.js +297 -0
- package/dist/bundle/definitions-HU62PG4L.js +43364 -0
- package/dist/bundle/dispatch-VE6CXCJW.js +411 -0
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/dist-ZSNEZYVF.js +7577 -0
- package/dist/bundle/echarts-LEVLEF7L.js +42501 -0
- package/dist/bundle/embed-G6FGY3VZ.js +38 -0
- package/dist/bundle/embedder-B6LNMXZZ.js +111 -0
- package/dist/bundle/failure-ASVFQXMF.js +25 -0
- package/dist/bundle/first-run-NVXVVALW.js +29 -0
- package/dist/bundle/first-screen-N3IPK5AT.js +37 -0
- package/dist/bundle/instructions-F3KPYMJK.js +11 -0
- package/dist/bundle/mcp-BUCB5ZPE.js +167 -0
- package/dist/bundle/meeting-combined-7FREWXMB.js +24 -0
- package/dist/bundle/meeting-model-GJPAIUQL.js +25 -0
- package/dist/bundle/meeting-semantic-YWY645AH.js +22 -0
- package/dist/bundle/node-KM3CUABH.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-WVUZSDLD.js +176 -0
- package/dist/bundle/node-sqlite-V4NNKABG.js +74 -0
- package/dist/bundle/oauth-7CENTQIN.js +20 -0
- package/dist/bundle/open-OLTONZBG.js +23 -0
- package/dist/bundle/openai-M6ES74YN.js +238 -0
- package/dist/bundle/process-VFIFK5KO.js +91 -0
- package/dist/bundle/program-N72VUDXM.js +33418 -0
- package/dist/bundle/prompt-TNWPBEBB.js +17 -0
- package/dist/bundle/recognize-PV2WOUWS.js +26 -0
- package/dist/bundle/remote-3F6JACS5.js +31 -0
- package/dist/bundle/rerank-33C67PIV.js +52 -0
- package/dist/bundle/schemas-RLDEALIJ.js +21410 -0
- package/dist/bundle/serve-3DEMACSQ.js +199 -0
- package/dist/bundle/server-AAK2HWQM.js +79 -0
- package/dist/bundle/server-LIBRGMUZ.js +212 -0
- package/dist/bundle/sqlite-runtime-SMAREHYG.js +20 -0
- package/dist/bundle/state-WPHAVJIU.js +36 -0
- package/dist/bundle/store-A7V4FEXE.js +177 -0
- package/dist/bundle/store-PMAPJNXT.js +291 -0
- package/dist/bundle/store-maintenance-command-QHRHAEYN.js +66 -0
- package/dist/bundle/surface-MN4RTNYW.js +65 -0
- package/dist/commands/api.d.ts +12 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +27 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -0
- package/dist/commands/comments.js +114 -0
- package/dist/commands/comments.js.map +1 -0
- package/dist/commands/crm.d.ts +4 -0
- package/dist/commands/crm.d.ts.map +1 -0
- package/dist/commands/crm.js +66 -0
- package/dist/commands/crm.js.map +1 -0
- package/dist/commands/session.d.ts +7 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +22 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +14 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +37 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +31 -0
- package/dist/context.js.map +1 -0
- package/dist/generated/definitions.d.ts +3 -0
- package/dist/generated/definitions.d.ts.map +1 -0
- package/dist/generated/definitions.js +43360 -0
- package/dist/generated/definitions.js.map +1 -0
- package/dist/generated/manifest.d.ts +6 -0
- package/dist/generated/manifest.d.ts.map +1 -0
- package/dist/generated/manifest.js +5158 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/schemas.d.ts +383 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +21196 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +10156 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +5 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/generated/wirecat-config.d.ts +15 -0
- package/dist/generated/wirecat-config.d.ts.map +1 -0
- package/dist/generated/wirecat-config.js +328 -0
- package/dist/generated/wirecat-config.js.map +1 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +7 -0
- package/dist/hooks.js.map +1 -0
- package/dist/identity.d.ts +33 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +31 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +54 -0
- package/dist/program.js.map +1 -0
- package/dist/sample/comments.d.ts +61 -0
- package/dist/sample/comments.d.ts.map +1 -0
- package/dist/sample/comments.js +39 -0
- package/dist/sample/comments.js.map +1 -0
- package/dist/sample/records.d.ts +16 -0
- package/dist/sample/records.d.ts.map +1 -0
- package/dist/sample/records.js +22 -0
- package/dist/sample/records.js.map +1 -0
- package/dist/sample/transport.d.ts +42 -0
- package/dist/sample/transport.d.ts.map +1 -0
- package/dist/sample/transport.js +153 -0
- package/dist/sample/transport.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/dist/wcat.d.ts +3 -0
- package/dist/wcat.d.ts.map +1 -0
- package/dist/wcat.js +4 -0
- package/dist/wcat.js.map +1 -0
- package/package.json +87 -4
- package/skills/attio-cli/SKILL.md +58 -0
- package/skills/attio-cli/references/api/api-activities.md +62 -0
- package/skills/attio-cli/references/api/api-activity-records.md +96 -0
- package/skills/attio-cli/references/api/api-attributes.md +148 -0
- package/skills/attio-cli/references/api/api-call-recordings.md +53 -0
- package/skills/attio-cli/references/api/api-comments.md +36 -0
- package/skills/attio-cli/references/api/api-emails.md +23 -0
- package/skills/attio-cli/references/api/api-entries.md +127 -0
- package/skills/attio-cli/references/api/api-files.md +63 -0
- package/skills/attio-cli/references/api/api-lists.md +44 -0
- package/skills/attio-cli/references/api/api-meetings.md +82 -0
- package/skills/attio-cli/references/api/api-meta.md +8 -0
- package/skills/attio-cli/references/api/api-notes.md +64 -0
- package/skills/attio-cli/references/api/api-objects.md +55 -0
- package/skills/attio-cli/references/api/api-records.md +168 -0
- package/skills/attio-cli/references/api/api-sequences.md +15 -0
- package/skills/attio-cli/references/api/api-sql.md +15 -0
- package/skills/attio-cli/references/api/api-tasks.md +67 -0
- package/skills/attio-cli/references/api/api-threads.md +35 -0
- package/skills/attio-cli/references/api/api-transcripts.md +17 -0
- package/skills/attio-cli/references/api/api-views.md +133 -0
- package/skills/attio-cli/references/api/api-webhooks.md +62 -0
- package/skills/attio-cli/references/api/api-workspace-blocklist.md +39 -0
- package/skills/attio-cli/references/api/api-workspace-members.md +19 -0
- package/skills/attio-cli/references/api.md +35 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
PRAGMAS
|
|
5
|
+
} from "./chunk-PKNFA5TU.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError
|
|
8
|
+
} from "./chunk-5DCRHSBI.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/store/sqlite-warning.js
|
|
14
|
+
var SQLITE_WARNING = "SQLite is an experimental feature";
|
|
15
|
+
var quieted = /* @__PURE__ */ new WeakSet();
|
|
16
|
+
var quietSqliteWarning = /* @__PURE__ */ __name((host = process) => {
|
|
17
|
+
if (quieted.has(host))
|
|
18
|
+
return;
|
|
19
|
+
quieted.add(host);
|
|
20
|
+
const emit = host.emitWarning;
|
|
21
|
+
host.emitWarning = function(warning, ...rest) {
|
|
22
|
+
if (isSqliteWarning(warning, rest[0]))
|
|
23
|
+
return;
|
|
24
|
+
return Reflect.apply(emit, this, [warning, ...rest]);
|
|
25
|
+
};
|
|
26
|
+
}, "quietSqliteWarning");
|
|
27
|
+
var isSqliteWarning = /* @__PURE__ */ __name((warning, options) => {
|
|
28
|
+
const type = typeof options === "string" ? options : options?.type;
|
|
29
|
+
const name = typeof warning === "string" ? type : warning.name;
|
|
30
|
+
const message = typeof warning === "string" ? warning : warning.message;
|
|
31
|
+
return name === "ExperimentalWarning" && message.startsWith(SQLITE_WARNING);
|
|
32
|
+
}, "isSqliteWarning");
|
|
33
|
+
|
|
34
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/store/open.js
|
|
35
|
+
var openCache = /* @__PURE__ */ __name(async (path) => {
|
|
36
|
+
const database = await openFile(path);
|
|
37
|
+
try {
|
|
38
|
+
database.exec(PRAGMAS);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
database.close();
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
return database;
|
|
44
|
+
}, "openCache");
|
|
45
|
+
var openFile = /* @__PURE__ */ __name((path) => "Bun" in globalThis ? openUnderBun(path) : openUnderNode(path), "openFile");
|
|
46
|
+
var openUnderBun = /* @__PURE__ */ __name(async (path) => {
|
|
47
|
+
const { openWithBunSqlite } = await import("./bun-sqlite-IF6B3EQI.js");
|
|
48
|
+
return await openWithBunSqlite(path);
|
|
49
|
+
}, "openUnderBun");
|
|
50
|
+
var openUnderNode = /* @__PURE__ */ __name(async (path) => {
|
|
51
|
+
quietSqliteWarning();
|
|
52
|
+
const { openWithNodeSqlite } = await import("./node-sqlite-V4NNKABG.js");
|
|
53
|
+
return openWithNodeSqlite(path);
|
|
54
|
+
}, "openUnderNode");
|
|
55
|
+
var runtime = /* @__PURE__ */ __name(() => {
|
|
56
|
+
const bun = globalThis.Bun;
|
|
57
|
+
return bun ? `Bun ${bun.version}` : `Node ${process.versions.node}`;
|
|
58
|
+
}, "runtime");
|
|
59
|
+
var CAPABILITY_STATEMENTS = [
|
|
60
|
+
`CREATE VIRTUAL TABLE temp.capability_words USING fts5(a, content = '', contentless_delete = 1,
|
|
61
|
+
tokenize = 'unicode61 remove_diacritics 2')`,
|
|
62
|
+
"CREATE VIRTUAL TABLE temp.capability_text USING fts5(a, tokenize = 'trigram')",
|
|
63
|
+
"DROP TABLE temp.capability_words",
|
|
64
|
+
"DROP TABLE temp.capability_text"
|
|
65
|
+
];
|
|
66
|
+
var assertStoreCapable = /* @__PURE__ */ __name((database, on = runtime()) => {
|
|
67
|
+
try {
|
|
68
|
+
for (const statement of CAPABILITY_STATEMENTS)
|
|
69
|
+
database.exec(statement);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
const version = String(database.prepare("SELECT sqlite_version() AS version").get()?.version);
|
|
72
|
+
const remedy = on.startsWith("Bun") ? "Run it under Node 22.16 or newer instead" : "Update Node to 22.16 or newer, or run it under Bun";
|
|
73
|
+
throw new CliError("configuration_error", `the message store needs full-text search that this SQLite (${version}, ${on}) does not have. ${remedy}.`, { sqlite: version, runtime: on, cause: error instanceof Error ? error.message : String(error) });
|
|
74
|
+
}
|
|
75
|
+
}, "assertStoreCapable");
|
|
76
|
+
var capable;
|
|
77
|
+
var storeCapable = /* @__PURE__ */ __name(() => {
|
|
78
|
+
capable ??= openCache(":memory:").then((database) => {
|
|
79
|
+
try {
|
|
80
|
+
assertStoreCapable(database);
|
|
81
|
+
} finally {
|
|
82
|
+
database.close();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return capable;
|
|
86
|
+
}, "storeCapable");
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
quietSqliteWarning,
|
|
90
|
+
openCache,
|
|
91
|
+
openFile,
|
|
92
|
+
CAPABILITY_STATEMENTS,
|
|
93
|
+
assertStoreCapable,
|
|
94
|
+
storeCapable
|
|
95
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
timezoneOf,
|
|
5
|
+
zonedMoment
|
|
6
|
+
} from "./chunk-SP6DPFZ4.js";
|
|
7
|
+
import {
|
|
8
|
+
CliError
|
|
9
|
+
} from "./chunk-5DCRHSBI.js";
|
|
10
|
+
import {
|
|
11
|
+
__name
|
|
12
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
13
|
+
|
|
14
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/domain/moment.js
|
|
15
|
+
var calendarMoment = /* @__PURE__ */ __name((wanted, flag, { zone, end = false } = {}) => {
|
|
16
|
+
try {
|
|
17
|
+
return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (!(error instanceof CliError))
|
|
20
|
+
throw error;
|
|
21
|
+
const alternative = error.details?.alternative;
|
|
22
|
+
throw new CliError("validation_error", `${flag}: "${wanted}" is not a time${alternative ? ` \u2014 ${alternative}` : ""}`);
|
|
23
|
+
}
|
|
24
|
+
}, "calendarMoment");
|
|
25
|
+
var dayIn = /* @__PURE__ */ __name((at, zone) => new Intl.DateTimeFormat("en-CA", { timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit" }).format(at), "dayIn");
|
|
26
|
+
var MINUTE = 6e4;
|
|
27
|
+
var YEAR = 365 * 24 * 60 * MINUTE;
|
|
28
|
+
var RELATIVE = /^(\d+)(m|h|d)$/;
|
|
29
|
+
var RELATIVE_MS = { m: MINUTE, h: 60 * MINUTE, d: 24 * 60 * MINUTE };
|
|
30
|
+
var DATE_ALONE = /^\d{4}-\d{2}-\d{2}$/;
|
|
31
|
+
var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/i;
|
|
32
|
+
var dayWord = /* @__PURE__ */ __name((word, zone, now) => {
|
|
33
|
+
const today = new Intl.DateTimeFormat("en-CA", { timeZone: zone }).format(now);
|
|
34
|
+
if (word === "today")
|
|
35
|
+
return today;
|
|
36
|
+
const date = /* @__PURE__ */ new Date(`${today}T00:00:00Z`);
|
|
37
|
+
date.setUTCDate(date.getUTCDate() - 1);
|
|
38
|
+
return date.toISOString().slice(0, 10);
|
|
39
|
+
}, "dayWord");
|
|
40
|
+
var readMoment = /* @__PURE__ */ __name((typed, flag, { zone, end = false, now = Date.now(), direction = -1 } = {}) => {
|
|
41
|
+
const wanted = typed.trim();
|
|
42
|
+
const [, amount, unit] = RELATIVE.exec(wanted) ?? [];
|
|
43
|
+
if (amount && unit)
|
|
44
|
+
return { time: now + direction * Number(amount) * (RELATIVE_MS[unit] ?? 0), local: false, dateAlone: false };
|
|
45
|
+
const word = wanted.toLowerCase();
|
|
46
|
+
const date = word === "today" || word === "yesterday" ? dayWord(word, timezoneOf(zone), now) : wanted;
|
|
47
|
+
if (!/^\d{4}-\d{2}-\d{2}/.test(date))
|
|
48
|
+
return void 0;
|
|
49
|
+
const iso = date.replace(/^(\d{4}-\d{2}-\d{2}) +(?=\d)/, "$1T");
|
|
50
|
+
return {
|
|
51
|
+
time: calendarMoment(iso, flag, { ...zone === void 0 ? {} : { zone }, end }),
|
|
52
|
+
local: !ZONED.test(iso),
|
|
53
|
+
dateAlone: DATE_ALONE.test(iso)
|
|
54
|
+
};
|
|
55
|
+
}, "readMoment");
|
|
56
|
+
var lead = /* @__PURE__ */ __name((ms) => ms === MINUTE ? "a minute" : ms === YEAR ? "a year" : `${Math.ceil(ms / MINUTE)} minutes`, "lead");
|
|
57
|
+
var aheadOf = /* @__PURE__ */ __name((reference, flag, now = Date.now(), options = {}) => {
|
|
58
|
+
const { refuseDate = false, soonest, latest, ...at } = options;
|
|
59
|
+
const read = readMoment(reference, flag, { ...at, now, direction: 1 });
|
|
60
|
+
if (read === void 0)
|
|
61
|
+
throw new CliError("validation_error", `${flag} takes an ISO 8601 time, today, or 30m, 2h, 3d from now \u2014 not "${reference.trim()}"`);
|
|
62
|
+
if (refuseDate && read.dateAlone)
|
|
63
|
+
throw new CliError("validation_error", DATE_ALONE.test(reference.trim()) ? `${flag} needs a time of day as well: ${reference.trim()}T09:00` : `${flag} needs a time of day as well, like 2026-11-20T09:00`);
|
|
64
|
+
if (soonest === 0 && read.time <= now)
|
|
65
|
+
throw new CliError("validation_error", `${flag} is in the past`);
|
|
66
|
+
if (soonest !== void 0 && soonest > 0 && read.time < now + soonest)
|
|
67
|
+
throw new CliError("validation_error", `${flag} has to be at least ${lead(soonest)} from now`);
|
|
68
|
+
if (latest !== void 0 && read.time > now + latest)
|
|
69
|
+
throw new CliError("validation_error", `${flag} can be at most ${lead(latest)} from now`);
|
|
70
|
+
return read.time;
|
|
71
|
+
}, "aheadOf");
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
calendarMoment,
|
|
75
|
+
dayIn,
|
|
76
|
+
MINUTE,
|
|
77
|
+
YEAR,
|
|
78
|
+
readMoment,
|
|
79
|
+
aheadOf
|
|
80
|
+
};
|