@wirecat/hubspot-cli 0.1.0 → 0.2.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 +24 -0
- package/README.md +40 -16
- package/contracts/wirecat.json +1441 -136
- package/dist/bin/hubspot.js +2 -2
- package/dist/bundle/{app-server-422MCA7S.js → app-server-GXV2OFML.js} +5 -5
- package/dist/bundle/chunk-2UOJ7DLZ.js +46 -0
- package/dist/bundle/{chunk-BKXDHU3G.js → chunk-3WLYWRGG.js} +1 -1
- package/dist/bundle/{chunk-SAKK2YRU.js → chunk-GPYCBYX5.js} +1 -1
- package/dist/bundle/chunk-IJADZW42.js +195 -0
- package/dist/bundle/{chunk-2TWQIWWG.js → chunk-LXZ66MCH.js} +2 -2
- package/dist/bundle/{chunk-WQBX7XYP.js → chunk-MFNMKHML.js} +807 -519
- package/dist/bundle/{chunk-HTAN663T.js → chunk-Q2OLOMHL.js} +1 -1
- package/dist/bundle/{chunk-LNV33FDC.js → chunk-TLKEPUAV.js} +4 -4
- package/dist/bundle/{chunk-JRCPCVPI.js → chunk-URX6YDUL.js} +2 -2
- package/dist/bundle/{chunk-ZBDSHFG4.js → chunk-VOH7S5M4.js} +1301 -1271
- package/dist/bundle/{chunk-X7XUX7A4.js → chunk-YMCY7VRE.js} +4 -4
- package/dist/bundle/{chunk-VIEYMDBR.js → chunk-Z73OL5HV.js} +1 -1
- package/dist/bundle/{dist-MYZZKZJ7.js → dist-7TGU56B2.js} +1 -1
- package/dist/bundle/{first-run-RPIJZEDT.js → first-run-UWAFSINQ.js} +1 -1
- package/dist/bundle/hubspot.js +2 -2
- package/dist/bundle/{program-POG5GHUQ.js → program-XA4C44Z4.js} +173 -40
- package/dist/bundle/{server-XJSNF3K5.js → server-ATG5KY7K.js} +2 -2
- package/dist/bundle/{server-C3ZHA7AZ.js → server-VNWVVH7A.js} +5 -5
- package/dist/bundle/{source-A3SBLHC4.js → source-54HR4IWG.js} +68 -341
- package/dist/bundle/{store-CCDNUB6A.js → store-DXWYNVVB.js} +2 -2
- package/dist/bundle/{store-maintenance-command-BRCG6MNA.js → store-maintenance-command-J57HCJYY.js} +3 -3
- package/dist/bundle/writer-NLLI5YRM.js +79 -0
- package/dist/commands/api.d.ts +4 -4
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/api.js +12 -7
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/crm-shared.d.ts +2 -2
- package/dist/commands/crm-shared.d.ts.map +1 -1
- package/dist/commands/crm-shared.js +20 -4
- package/dist/commands/crm-shared.js.map +1 -1
- package/dist/config.d.ts +46 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +137 -12
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +2 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/context.js.map +1 -1
- package/dist/crm/source.d.ts +7 -2
- package/dist/crm/source.d.ts.map +1 -1
- package/dist/crm/source.js +26 -29
- package/dist/crm/source.js.map +1 -1
- package/dist/crm/writer.d.ts +15 -0
- package/dist/crm/writer.d.ts.map +1 -0
- package/dist/crm/writer.js +199 -0
- package/dist/crm/writer.js.map +1 -0
- package/dist/generated/manifest.d.ts.map +1 -1
- package/dist/generated/manifest.js +6 -1
- package/dist/generated/manifest.js.map +1 -1
- package/dist/hubspot/transport.d.ts +6 -1
- package/dist/hubspot/transport.d.ts.map +1 -1
- package/dist/hubspot/transport.js +13 -5
- package/dist/hubspot/transport.js.map +1 -1
- package/dist/identity.js +3 -3
- package/dist/identity.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +2 -1
- package/dist/program.js.map +1 -1
- package/dist/setup/texts.en.json +3 -3
- package/dist/setup/texts.es.json +3 -3
- package/dist/setup/texts.ru.json +3 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/skills/hubspot-cli/SKILL.md +13 -8
- package/skills/hubspot-cli/references/api/api-advanced.md +51 -0
- package/skills/hubspot-cli/references/api/api-basic.md +602 -0
- package/skills/hubspot-cli/references/api/api-batch.md +575 -0
- package/skills/hubspot-cli/references/api.md +3 -2
- package/dist/commands/comments.d.ts +0 -3
- package/dist/commands/comments.d.ts.map +0 -1
- package/dist/commands/comments.js +0 -114
- package/dist/commands/comments.js.map +0 -1
- package/dist/sample/comments.d.ts +0 -61
- package/dist/sample/comments.d.ts.map +0 -1
- package/dist/sample/comments.js +0 -39
- package/dist/sample/comments.js.map +0 -1
- package/dist/sample/records.d.ts +0 -16
- package/dist/sample/records.d.ts.map +0 -1
- package/dist/sample/records.js +0 -22
- package/dist/sample/records.js.map +0 -1
- package/dist/sample/transport.d.ts +0 -42
- package/dist/sample/transport.d.ts.map +0 -1
- package/dist/sample/transport.js +0 -153
- package/dist/sample/transport.js.map +0 -1
|
@@ -17874,127 +17874,53 @@ var guardFor = /* @__PURE__ */ __name((app, settings, warn, env = process.env, a
|
|
|
17874
17874
|
}), "guardFor");
|
|
17875
17875
|
var journalFailure = /* @__PURE__ */ __name((error) => error?.code ?? (error instanceof Error ? error.name : "error"), "journalFailure");
|
|
17876
17876
|
|
|
17877
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/
|
|
17878
|
-
var
|
|
17879
|
-
|
|
17880
|
-
|
|
17881
|
-
|
|
17882
|
-
|
|
17883
|
-
|
|
17884
|
-
|
|
17885
|
-
|
|
17886
|
-
|
|
17887
|
-
|
|
17888
|
-
|
|
17889
|
-
|
|
17890
|
-
|
|
17891
|
-
|
|
17892
|
-
|
|
17893
|
-
|
|
17894
|
-
|
|
17895
|
-
|
|
17896
|
-
|
|
17897
|
-
|
|
17898
|
-
|
|
17899
|
-
|
|
17900
|
-
|
|
17901
|
-
|
|
17902
|
-
|
|
17903
|
-
|
|
17904
|
-
|
|
17905
|
-
|
|
17906
|
-
|
|
17907
|
-
|
|
17908
|
-
|
|
17909
|
-
|
|
17910
|
-
|
|
17911
|
-
|
|
17912
|
-
|
|
17913
|
-
|
|
17914
|
-
|
|
17915
|
-
|
|
17916
|
-
|
|
17917
|
-
|
|
17918
|
-
}, "
|
|
17919
|
-
|
|
17920
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/values.js
|
|
17921
|
-
var isRaw = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRaw");
|
|
17922
|
-
var fieldOf = /* @__PURE__ */ __name((value, key) => isRaw(value) ? value[key] : void 0, "fieldOf");
|
|
17923
|
-
var rawsOf = /* @__PURE__ */ __name((value) => Array.isArray(value) ? value.filter(isRaw) : [], "rawsOf");
|
|
17924
|
-
var text = /* @__PURE__ */ __name((value) => {
|
|
17925
|
-
if (typeof value !== "string" && typeof value !== "number")
|
|
17926
|
-
return null;
|
|
17927
|
-
const trimmed = String(value).trim();
|
|
17928
|
-
return trimmed === "" ? null : trimmed;
|
|
17929
|
-
}, "text");
|
|
17930
|
-
var id = /* @__PURE__ */ __name((value) => {
|
|
17931
|
-
const found = text(value);
|
|
17932
|
-
return found === null || found === "0" ? null : found;
|
|
17933
|
-
}, "id");
|
|
17934
|
-
var ids = /* @__PURE__ */ __name((value) => Array.isArray(value) ? value.map(id).filter((one) => one !== null) : [], "ids");
|
|
17935
|
-
var number2 = /* @__PURE__ */ __name((value) => {
|
|
17936
|
-
if (value === null || value === void 0 || value === "")
|
|
17937
|
-
return null;
|
|
17938
|
-
const found = Number(value);
|
|
17939
|
-
return Number.isFinite(found) ? found : null;
|
|
17940
|
-
}, "number");
|
|
17941
|
-
var time = /* @__PURE__ */ __name((value) => {
|
|
17942
|
-
if (typeof value === "number") {
|
|
17943
|
-
if (!Number.isFinite(value) || value <= 0)
|
|
17944
|
-
return null;
|
|
17945
|
-
return new Date(value > 1e11 ? value : value * 1e3).toISOString();
|
|
17946
|
-
}
|
|
17947
|
-
const found = text(value);
|
|
17948
|
-
if (found === null)
|
|
17949
|
-
return null;
|
|
17950
|
-
const parsed = new Date(found);
|
|
17951
|
-
return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString();
|
|
17952
|
-
}, "time");
|
|
17953
|
-
var epoch = /* @__PURE__ */ __name((value) => {
|
|
17954
|
-
const found = time(value);
|
|
17955
|
-
return found === null ? null : Date.parse(found);
|
|
17956
|
-
}, "epoch");
|
|
17957
|
-
var amountOf = /* @__PURE__ */ __name((value, currency) => {
|
|
17958
|
-
const found = number2(value);
|
|
17959
|
-
const code = text(currency)?.toUpperCase() ?? null;
|
|
17960
|
-
if (found === null || found <= 0 || code === null)
|
|
17961
|
-
return { amount: null, currency: null };
|
|
17962
|
-
return { amount: typeof value === "string" ? value.trim() : String(found), currency: code };
|
|
17963
|
-
}, "amountOf");
|
|
17964
|
-
var fullName = /* @__PURE__ */ __name((...parts) => parts.map(text).filter((part) => part !== null).join(" ") || null, "fullName");
|
|
17965
|
-
var optionLabel = /* @__PURE__ */ __name((field, option) => field.options?.find(({ id: id3 }) => id3 === String(option))?.label ?? String(option), "optionLabel");
|
|
17966
|
-
var crmValuesOf = /* @__PURE__ */ __name((values, fields) => {
|
|
17967
|
-
const byCode = new Map(fields.map((field) => [field.code, field]));
|
|
17968
|
-
return Object.fromEntries(Object.entries(values).map(([code, value]) => {
|
|
17969
|
-
const field = byCode.get(code);
|
|
17970
|
-
const label = field?.label ?? null;
|
|
17971
|
-
if (!field?.options)
|
|
17972
|
-
return [code, { label, value: withoutFileLinks(value) }];
|
|
17973
|
-
if (Array.isArray(value))
|
|
17974
|
-
return [code, { label, value: value.map((one) => optionLabel(field, one)), option_id: value.map(String) }];
|
|
17975
|
-
return [code, { label, value: optionLabel(field, value), option_id: String(value) }];
|
|
17976
|
-
}));
|
|
17977
|
-
}, "crmValuesOf");
|
|
17877
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/sends/keyed-guard.js
|
|
17878
|
+
var keyedGuard = /* @__PURE__ */ __name((build, ask2, levelOf, extra) => {
|
|
17879
|
+
let question;
|
|
17880
|
+
let answered = false;
|
|
17881
|
+
const guard = build(async (key, request) => {
|
|
17882
|
+
if (answered)
|
|
17883
|
+
return;
|
|
17884
|
+
await ask2(question || key, request);
|
|
17885
|
+
answered = true;
|
|
17886
|
+
});
|
|
17887
|
+
const probes = /* @__PURE__ */ new WeakMap();
|
|
17888
|
+
const all = /* @__PURE__ */ __name((request) => {
|
|
17889
|
+
let found = probes.get(request);
|
|
17890
|
+
if (!found) {
|
|
17891
|
+
found = extra.map((key) => ({ chatId: null, kind: "read", key }));
|
|
17892
|
+
probes.set(request, found);
|
|
17893
|
+
}
|
|
17894
|
+
return [request, ...found];
|
|
17895
|
+
}, "all");
|
|
17896
|
+
const levelOfRequest = /* @__PURE__ */ __name(({ key }) => levelOf(key ?? ""), "levelOfRequest");
|
|
17897
|
+
const refuse = /* @__PURE__ */ __name((request) => {
|
|
17898
|
+
const refused = all(request).find((one) => stops(levelOfRequest(one), one.key ?? ""));
|
|
17899
|
+
if (refused)
|
|
17900
|
+
guard.check(refused, { reserve: false });
|
|
17901
|
+
}, "refuse");
|
|
17902
|
+
return {
|
|
17903
|
+
refuse,
|
|
17904
|
+
ask: /* @__PURE__ */ __name(async (request) => {
|
|
17905
|
+
refuse(request);
|
|
17906
|
+
question = all(request).filter((one) => levelOfRequest(one) === "ask").map(({ key }) => key).join(" and ");
|
|
17907
|
+
for (const one of all(request))
|
|
17908
|
+
await guard.ask?.(one);
|
|
17909
|
+
}, "ask"),
|
|
17910
|
+
check: /* @__PURE__ */ __name((request, options2) => {
|
|
17911
|
+
for (const one of all(request).slice(1))
|
|
17912
|
+
guard.check(one, { reserve: false });
|
|
17913
|
+
guard.check(request, options2);
|
|
17914
|
+
}, "check"),
|
|
17915
|
+
...guard.reserve ? { reserve: guard.reserve } : {},
|
|
17916
|
+
record: /* @__PURE__ */ __name((entry) => guard.record(entry), "record")
|
|
17917
|
+
};
|
|
17918
|
+
}, "keyedGuard");
|
|
17978
17919
|
|
|
17979
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/
|
|
17980
|
-
|
|
17981
|
-
|
|
17982
|
-
|
|
17983
|
-
}, "crmWindowOf");
|
|
17984
|
-
var walk = /* @__PURE__ */ __name(async (window3, largest, fetchPage) => {
|
|
17985
|
-
const want = window3.limit + 1;
|
|
17986
|
-
const rows = [];
|
|
17987
|
-
let at = window3.offset;
|
|
17988
|
-
while (rows.length < want) {
|
|
17989
|
-
const page = await fetchPage(at, Math.min(largest, want - rows.length));
|
|
17990
|
-
for (const row of page.rows)
|
|
17991
|
-
rows.push(row);
|
|
17992
|
-
at += page.rows.length;
|
|
17993
|
-
if (!page.more || page.rows.length === 0)
|
|
17994
|
-
break;
|
|
17995
|
-
}
|
|
17996
|
-
return { items: rows.slice(0, window3.limit), hasMore: rows.length > window3.limit };
|
|
17997
|
-
}, "walk");
|
|
17920
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/sends/send-id.js
|
|
17921
|
+
import { randomBytes } from "node:crypto";
|
|
17922
|
+
var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
|
|
17923
|
+
var newOperationId = newSendId;
|
|
17998
17924
|
|
|
17999
17925
|
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/foreign-contacts.js
|
|
18000
17926
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
@@ -18071,498 +17997,1100 @@ var foreignContacts = /* @__PURE__ */ __name((source, file, options2 = {}) => {
|
|
|
18071
17997
|
};
|
|
18072
17998
|
}, "foreignContacts");
|
|
18073
17999
|
|
|
18074
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
var
|
|
18078
|
-
|
|
18079
|
-
|
|
18080
|
-
|
|
18081
|
-
|
|
18082
|
-
}
|
|
18083
|
-
path;
|
|
18084
|
-
rate;
|
|
18085
|
-
now;
|
|
18086
|
-
constructor(path, rate, now = Date.now) {
|
|
18087
|
-
this.path = path;
|
|
18088
|
-
this.rate = rate;
|
|
18089
|
-
this.now = now;
|
|
18090
|
-
}
|
|
18091
|
-
get interval() {
|
|
18092
|
-
return this.rate.perMinute > 0 ? 6e4 / this.rate.perMinute : 0;
|
|
18093
|
-
}
|
|
18094
|
-
/** When this call may go; reserved at once, so the next caller in any process lines up behind it. */
|
|
18095
|
-
async reserve() {
|
|
18096
|
-
if (this.interval === 0)
|
|
18097
|
-
return this.now();
|
|
18098
|
-
return withFileLockAsync(this.path, "the request pace", () => {
|
|
18099
|
-
const now = this.now();
|
|
18100
|
-
const tat = Math.max(this.read(now), now);
|
|
18101
|
-
this.write(tat + this.interval, now);
|
|
18102
|
-
return Math.max(now, tat - this.rate.burst * this.interval);
|
|
18103
|
-
});
|
|
18104
|
-
}
|
|
18105
|
-
/** The messenger asked every caller to wait: nothing goes before `now + waitMs`, in any process. */
|
|
18106
|
-
async holdFor(waitMs) {
|
|
18107
|
-
if (this.interval === 0)
|
|
18108
|
-
return;
|
|
18109
|
-
await withFileLockAsync(this.path, "the request pace", () => {
|
|
18110
|
-
const now = this.now();
|
|
18111
|
-
const hold = now + waitMs + this.rate.burst * this.interval;
|
|
18112
|
-
this.write(Math.max(this.read(now), hold), now);
|
|
18113
|
-
});
|
|
18114
|
-
}
|
|
18115
|
-
/** The owner's `flood clear`: every process may go again at once. */
|
|
18116
|
-
async reset() {
|
|
18117
|
-
await withFileLockAsync(this.path, "the request pace", () => this.write(0, this.now()));
|
|
18118
|
-
}
|
|
18119
|
-
read(now) {
|
|
18120
|
-
try {
|
|
18121
|
-
const file = JSON.parse(readFileSync5(this.path, "utf8"));
|
|
18122
|
-
const tat = Number(file.tat);
|
|
18123
|
-
if (!Number.isFinite(tat))
|
|
18124
|
-
return 0;
|
|
18125
|
-
const at = Number(file.at);
|
|
18126
|
-
return Number.isFinite(at) && at > now ? now + Math.max(0, tat - at) : tat;
|
|
18127
|
-
} catch {
|
|
18128
|
-
return 0;
|
|
18129
|
-
}
|
|
18130
|
-
}
|
|
18131
|
-
write(tat, at) {
|
|
18132
|
-
const temporary = `${this.path}.${process.pid}.tmp`;
|
|
18133
|
-
writeFileSync2(temporary, JSON.stringify({ tat, at }), { mode: 384 });
|
|
18134
|
-
renameSync2(temporary, this.path);
|
|
18135
|
-
}
|
|
18000
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/writer.js
|
|
18001
|
+
var CRM_ASSIGN_OTHERS_KEY = "crm.assign-others";
|
|
18002
|
+
var CRM_WRITE_KEYS = [CRM_ASSIGN_OTHERS_KEY];
|
|
18003
|
+
var PLURALS = {
|
|
18004
|
+
deals: "deal",
|
|
18005
|
+
leads: "lead",
|
|
18006
|
+
people: "person",
|
|
18007
|
+
organizations: "organization"
|
|
18136
18008
|
};
|
|
18137
|
-
var
|
|
18138
|
-
|
|
18139
|
-
|
|
18140
|
-
|
|
18141
|
-
|
|
18142
|
-
|
|
18009
|
+
var VERB_OF = {
|
|
18010
|
+
create: "create",
|
|
18011
|
+
update: "update",
|
|
18012
|
+
move: "move",
|
|
18013
|
+
close: "close",
|
|
18014
|
+
delete: "remove"
|
|
18015
|
+
};
|
|
18016
|
+
var crmAlsoChecks = /* @__PURE__ */ __name((also) => (path) => {
|
|
18017
|
+
const [noun, command] = path;
|
|
18018
|
+
const kind = noun === void 0 ? void 0 : PLURALS[noun];
|
|
18019
|
+
const verb = command === void 0 ? void 0 : VERB_OF[command];
|
|
18020
|
+
if (path.length !== 2 || kind === void 0 || verb === void 0)
|
|
18021
|
+
return [];
|
|
18022
|
+
const close = { key: `${noun}.close`, when: "a won or lost stage" };
|
|
18023
|
+
const assign = { key: CRM_ASSIGN_OTHERS_KEY, when: "--owner other than the sign-in's user" };
|
|
18024
|
+
const implied = kind === "person" || kind === "organization" ? verb === "create" || verb === "update" ? [assign] : [] : verb === "create" || verb === "update" ? [{ key: `${noun}.move`, when: "--stage" }, close, assign] : verb === "move" ? [close] : [];
|
|
18025
|
+
return [...implied, ...also?.(kind, verb) ?? []];
|
|
18026
|
+
}, "crmAlsoChecks");
|
|
18027
|
+
var CRM_WRITE_DEFAULTS = {
|
|
18028
|
+
"deals.delete": "ask",
|
|
18029
|
+
"leads.delete": "ask",
|
|
18030
|
+
[CRM_ASSIGN_OTHERS_KEY]: "deny"
|
|
18031
|
+
};
|
|
18032
|
+
|
|
18033
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/writes.js
|
|
18034
|
+
var moneyChecked = /* @__PURE__ */ __name((check2, param) => {
|
|
18143
18035
|
try {
|
|
18144
|
-
|
|
18036
|
+
check2();
|
|
18145
18037
|
} catch (error) {
|
|
18146
|
-
|
|
18147
|
-
|
|
18148
|
-
|
|
18149
|
-
|
|
18038
|
+
if (isCliError(error))
|
|
18039
|
+
throw new CliError(error.code, error.message, { ...error.details, param });
|
|
18040
|
+
throw error;
|
|
18041
|
+
}
|
|
18042
|
+
}, "moneyChecked");
|
|
18043
|
+
var PLURAL = {
|
|
18044
|
+
deal: "deals",
|
|
18045
|
+
lead: "leads",
|
|
18046
|
+
person: "people",
|
|
18047
|
+
organization: "organizations"
|
|
18048
|
+
};
|
|
18049
|
+
var COMMAND = {
|
|
18050
|
+
create: "create",
|
|
18051
|
+
update: "update",
|
|
18052
|
+
move: "move",
|
|
18053
|
+
close: "close",
|
|
18054
|
+
remove: "delete"
|
|
18055
|
+
};
|
|
18056
|
+
var keyOf2 = /* @__PURE__ */ __name((kind, verb) => `${PLURAL[kind]}.${COMMAND[verb]}`, "keyOf");
|
|
18057
|
+
var OPERATION_ID = /^[\x21-\x7e]{1,255}$/u;
|
|
18058
|
+
var DECIMAL = /^\d{1,16}(\.\d{1,6})?$/u;
|
|
18059
|
+
var CURRENCY = /^[A-Z]{3}$/u;
|
|
18060
|
+
var DAY = /^\d{4}-\d{2}-\d{2}$/u;
|
|
18061
|
+
var FIELD_CODE = /^[A-Za-z][\w.-]{0,99}$/u;
|
|
18062
|
+
var invalid = /* @__PURE__ */ __name((message, param) => new CliError("validation_error", message, { reason: "deal.field", ...param ? { param } : {} }), "invalid");
|
|
18063
|
+
var supported = /* @__PURE__ */ __name((writer, kind, verb) => {
|
|
18064
|
+
const { kinds, verbs } = writer.capabilities;
|
|
18065
|
+
if (!kinds.includes(kind) || !verbs.includes(verb))
|
|
18066
|
+
throw new CliError("validation_error", `this CRM does not take a ${COMMAND[verb]} of ${PLURAL[kind]}`, {
|
|
18067
|
+
reason: "crm.write-unsupported",
|
|
18068
|
+
sent: false
|
|
18069
|
+
});
|
|
18070
|
+
}, "supported");
|
|
18071
|
+
var operationOf = /* @__PURE__ */ __name((context2, given) => {
|
|
18072
|
+
if (given === void 0)
|
|
18073
|
+
return newOperationId();
|
|
18074
|
+
const name = context2.names?.id ?? "--operation-id";
|
|
18075
|
+
if (!context2.writes.writer.capabilities.idempotent)
|
|
18076
|
+
throw new CliError("validation_error", `this CRM does not recognise a repeated write, so ${name} would do it a second time; sync and look before writing again`, { reason: "crm.write-unsupported", param: name, sent: false });
|
|
18077
|
+
if (!OPERATION_ID.test(given))
|
|
18078
|
+
throw new CliError("validation_error", `${name} takes 1 to 255 printable characters with no spaces`, {
|
|
18079
|
+
param: name
|
|
18080
|
+
});
|
|
18081
|
+
return given;
|
|
18082
|
+
}, "operationOf");
|
|
18083
|
+
var copyOf = /* @__PURE__ */ __name(async (context2, kind, reference) => {
|
|
18084
|
+
if (!reference.startsWith(`${kind}:`))
|
|
18085
|
+
throw new CliError("validation_error", `name the ${kind} as ${kind}:<id>, as a list shows it`, {
|
|
18086
|
+
reason: "ref.malformed"
|
|
18150
18087
|
});
|
|
18088
|
+
const found = await context2.store.deals.get(reference);
|
|
18089
|
+
const { provider, account } = context2.account;
|
|
18090
|
+
if (found.account?.provider !== provider || found.account.account !== account || found.externalId === null)
|
|
18091
|
+
throw new CliError("not_found", `${reference} is not a copy from this profile's CRM account`);
|
|
18092
|
+
return found;
|
|
18093
|
+
}, "copyOf");
|
|
18094
|
+
var pipelineOf = /* @__PURE__ */ __name(async (context2, kind, reference, param = "--pipeline", window3 = {}) => {
|
|
18095
|
+
const scope = { ...window3, ...kind ? { kind } : {}, account: context2.account };
|
|
18096
|
+
if (reference !== void 0) {
|
|
18097
|
+
const found = await context2.store.deals.pipeline(reference, scope);
|
|
18098
|
+
if (found.externalId === null)
|
|
18099
|
+
throw new CliError("not_found", `${reference} is not a pipeline of this CRM account`);
|
|
18100
|
+
return found;
|
|
18151
18101
|
}
|
|
18152
|
-
const
|
|
18153
|
-
if (
|
|
18154
|
-
return;
|
|
18155
|
-
|
|
18156
|
-
|
|
18157
|
-
|
|
18158
|
-
|
|
18159
|
-
|
|
18160
|
-
|
|
18161
|
-
|
|
18162
|
-
|
|
18163
|
-
|
|
18102
|
+
const all = await context2.store.deals.pipelines(scope);
|
|
18103
|
+
if (all.length === 1)
|
|
18104
|
+
return context2.store.deals.pipeline(all[0].ref, scope);
|
|
18105
|
+
const what = kind ? `${kind} pipeline` : "pipeline";
|
|
18106
|
+
throw new CliError("validation_error", all.length === 0 ? `no ${what} of this CRM is stored; run sync first` : `this CRM has ${all.length} ${what}s; name one${param.startsWith("--") ? ` with ${param}` : ""}: ` + all.map(({ name, ref }) => `${name} (${ref})`).join(", "), { reason: "crm.pipeline-required", param, allowed: all.map(({ ref }) => ref) });
|
|
18107
|
+
}, "pipelineOf");
|
|
18108
|
+
var stageOf = /* @__PURE__ */ __name((pipeline2, given) => {
|
|
18109
|
+
const byId2 = pipeline2.stages.find((stage) => stage.externalId === given);
|
|
18110
|
+
if (byId2)
|
|
18111
|
+
return byId2;
|
|
18112
|
+
const folded = given.trim().toLocaleLowerCase();
|
|
18113
|
+
const named3 = pipeline2.stages.filter((stage) => stage.name.toLocaleLowerCase() === folded);
|
|
18114
|
+
if (named3.length === 1)
|
|
18115
|
+
return named3[0];
|
|
18116
|
+
throw new CliError("validation_error", `${pipeline2.name} has ${named3.length ? "more than one" : "no"} stage ${given}: ` + pipeline2.stages.map(({ name }) => name).join(", "), { reason: "deal.stage", param: "--stage" });
|
|
18117
|
+
}, "stageOf");
|
|
18118
|
+
var validDay = /* @__PURE__ */ __name((text3) => {
|
|
18119
|
+
const date = /* @__PURE__ */ new Date(`${text3}T00:00:00Z`);
|
|
18120
|
+
return DAY.test(text3) && !Number.isNaN(date.getTime()) && date.toISOString().startsWith(text3);
|
|
18121
|
+
}, "validDay");
|
|
18122
|
+
var fieldsOf = /* @__PURE__ */ __name((input, pipeline2, currency) => {
|
|
18123
|
+
const fields = {};
|
|
18124
|
+
if (input.title !== void 0) {
|
|
18125
|
+
if (!input.title.trim())
|
|
18126
|
+
throw invalid("a title is never empty", "--title");
|
|
18127
|
+
fields.title = input.title.trim();
|
|
18128
|
+
}
|
|
18129
|
+
if (pipeline2 && input.pipeline !== void 0)
|
|
18130
|
+
fields.pipeline = pipeline2.externalId;
|
|
18131
|
+
const stage = pipeline2 && input.stage !== void 0 ? stageOf(pipeline2, input.stage) : void 0;
|
|
18132
|
+
if (stage)
|
|
18133
|
+
fields.stage = stage.externalId;
|
|
18134
|
+
if (input.amount !== void 0 || input.currency !== void 0) {
|
|
18135
|
+
const code = (input.currency ?? currency ?? "").toUpperCase();
|
|
18136
|
+
if (input.amount === void 0)
|
|
18137
|
+
throw invalid("--currency goes with --amount", "--amount");
|
|
18138
|
+
if (!DECIMAL.test(input.amount))
|
|
18139
|
+
throw invalid("--amount is a decimal such as 1500.50", "--amount");
|
|
18140
|
+
if (!CURRENCY.test(code))
|
|
18141
|
+
throw invalid("--amount needs --currency, an ISO 4217 code such as EUR", "--currency");
|
|
18142
|
+
moneyChecked(() => currencyOf(code), "--currency");
|
|
18143
|
+
moneyChecked(() => minorUnits(input.amount, code, "--amount"), "--amount");
|
|
18144
|
+
fields.amount = input.amount;
|
|
18145
|
+
fields.currency = code;
|
|
18146
|
+
}
|
|
18147
|
+
if (input.closeDate !== void 0) {
|
|
18148
|
+
if (!validDay(input.closeDate))
|
|
18149
|
+
throw invalid("--close-date is a day, YYYY-MM-DD", "--close-date");
|
|
18150
|
+
fields.closeDate = input.closeDate;
|
|
18151
|
+
}
|
|
18152
|
+
if (input.owner !== void 0) {
|
|
18153
|
+
if (!input.owner.trim())
|
|
18154
|
+
throw invalid("--owner is the CRM user's id", "--owner");
|
|
18155
|
+
fields.owner = input.owner.trim();
|
|
18156
|
+
}
|
|
18157
|
+
return { fields, stage };
|
|
18158
|
+
}, "fieldsOf");
|
|
18159
|
+
var foldFieldName = /* @__PURE__ */ __name((name) => foldName(name.trim()).replace(/[\s_]+/gu, " "), "foldFieldName");
|
|
18160
|
+
var named = /* @__PURE__ */ __name(({ code, label }) => ({ code, label }), "named");
|
|
18161
|
+
var unknownField = /* @__PURE__ */ __name((fields, name, param = "--field") => {
|
|
18162
|
+
const want = foldFieldName(name);
|
|
18163
|
+
const close = fields.filter((field) => [field.code, field.label ?? ""].some((one) => {
|
|
18164
|
+
const other = foldFieldName(one);
|
|
18165
|
+
return other !== "" && (other.includes(want) || want.includes(other));
|
|
18166
|
+
}));
|
|
18167
|
+
return new CliError("validation_error", `no custom field is named ${name}${close.length ? "; close ones are in candidates" : ""} \u2014 \`fields list\` lists them`, { reason: "field.unknown", param, candidates: close.map(named) });
|
|
18168
|
+
}, "unknownField");
|
|
18169
|
+
var fieldNamed = /* @__PURE__ */ __name((fields, name, param = "--field") => {
|
|
18170
|
+
const want = foldFieldName(name);
|
|
18171
|
+
const byCode = fields.find((field) => foldFieldName(field.code) === want);
|
|
18172
|
+
if (byCode)
|
|
18173
|
+
return byCode;
|
|
18174
|
+
const labelled = fields.filter((field) => field.label !== null && foldFieldName(field.label) === want);
|
|
18175
|
+
if (labelled.length === 1)
|
|
18176
|
+
return labelled[0];
|
|
18177
|
+
if (labelled.length > 1)
|
|
18178
|
+
throw new CliError("validation_error", `${labelled.length} custom fields are labelled ${name}; name one by its code`, {
|
|
18179
|
+
reason: "field.ambiguous",
|
|
18180
|
+
param,
|
|
18181
|
+
candidates: labelled.map(named)
|
|
18182
|
+
});
|
|
18183
|
+
throw unknownField(fields, name, param);
|
|
18184
|
+
}, "fieldNamed");
|
|
18185
|
+
var optionOf = /* @__PURE__ */ __name((field, value, param = "--field") => {
|
|
18186
|
+
if (!field.options)
|
|
18187
|
+
return value;
|
|
18188
|
+
const want = foldFieldName(value);
|
|
18189
|
+
const byId2 = field.options.find((option) => option.id === value.trim());
|
|
18190
|
+
const named3 = byId2 ? [] : field.options.filter((option) => foldFieldName(option.label) === want);
|
|
18191
|
+
if (named3.length > 1)
|
|
18192
|
+
throw new CliError("validation_error", `${field.label ?? field.code} has ${named3.length} options named ${value}; name one by its id`, {
|
|
18193
|
+
reason: "field.ambiguous-option",
|
|
18194
|
+
param,
|
|
18195
|
+
field: field.code,
|
|
18196
|
+
candidates: named3
|
|
18197
|
+
});
|
|
18198
|
+
const found = byId2 ?? named3[0];
|
|
18199
|
+
if (!found)
|
|
18200
|
+
throw new CliError("validation_error", `${field.label ?? field.code} has no option ${value}`, {
|
|
18201
|
+
reason: "field.unknown-option",
|
|
18202
|
+
param,
|
|
18203
|
+
field: field.code,
|
|
18204
|
+
allowed: field.options
|
|
18164
18205
|
});
|
|
18206
|
+
return found.id;
|
|
18207
|
+
}, "optionOf");
|
|
18208
|
+
var fieldPairsOf = /* @__PURE__ */ __name((typed) => typed.map((one) => {
|
|
18209
|
+
const at = one.indexOf("=");
|
|
18210
|
+
if (at <= 0 || one.slice(0, at).trim() === "")
|
|
18211
|
+
throw new CliError("validation_error", `--field takes <key>=<value>; got ${one}`, { param: "--field" });
|
|
18212
|
+
return [one.slice(0, at), one.slice(at + 1)];
|
|
18213
|
+
}), "fieldPairsOf");
|
|
18214
|
+
var crmCustomValues = /* @__PURE__ */ __name((fields, pairs) => {
|
|
18215
|
+
const values = /* @__PURE__ */ new Map();
|
|
18216
|
+
for (const [name, value] of pairs) {
|
|
18217
|
+
const field = fields.length ? fieldNamed(fields, name) : null;
|
|
18218
|
+
const code = field?.code ?? name.trim();
|
|
18219
|
+
if (!field && !FIELD_CODE.test(code))
|
|
18220
|
+
throw invalid(`${name} is not a field code`, "--field");
|
|
18221
|
+
const held = values.get(code) ?? { field, all: [] };
|
|
18222
|
+
held.all.push(value === "" ? null : field ? optionOf(field, value) : value);
|
|
18223
|
+
values.set(code, held);
|
|
18165
18224
|
}
|
|
18166
|
-
|
|
18167
|
-
|
|
18168
|
-
|
|
18169
|
-
|
|
18170
|
-
|
|
18171
|
-
|
|
18172
|
-
|
|
18173
|
-
|
|
18174
|
-
|
|
18175
|
-
|
|
18176
|
-
|
|
18177
|
-
|
|
18178
|
-
|
|
18179
|
-
|
|
18180
|
-
|
|
18181
|
-
|
|
18182
|
-
|
|
18183
|
-
|
|
18184
|
-
|
|
18185
|
-
|
|
18186
|
-
|
|
18225
|
+
return Object.fromEntries([...values].map(([code, { field, all }]) => {
|
|
18226
|
+
const given = all.filter((one) => one !== null);
|
|
18227
|
+
if (field?.multiple)
|
|
18228
|
+
return [code, given.length ? given : null];
|
|
18229
|
+
if (all.length > 1)
|
|
18230
|
+
throw new CliError("validation_error", `${field?.label ?? code} holds one value; give --field once`, {
|
|
18231
|
+
reason: "deal.field",
|
|
18232
|
+
param: "--field",
|
|
18233
|
+
field: code
|
|
18234
|
+
});
|
|
18235
|
+
return [code, all[0] ?? null];
|
|
18236
|
+
}));
|
|
18237
|
+
}, "crmCustomValues");
|
|
18238
|
+
var customOf = /* @__PURE__ */ __name(async (context2, kind, pairs) => pairs?.length ? crmCustomValues(await context2.store.crm.fields(context2.account, kind), pairs) : void 0, "customOf");
|
|
18239
|
+
var keysOf = /* @__PURE__ */ __name((context2, kind, verb, { stage, owner }) => {
|
|
18240
|
+
const extra = [];
|
|
18241
|
+
if (stage && verb !== "move")
|
|
18242
|
+
extra.push(keyOf2(kind, "move"));
|
|
18243
|
+
if (stage && stage.outcome !== "open")
|
|
18244
|
+
extra.push(keyOf2(kind, "close"));
|
|
18245
|
+
if (owner != null && owner !== context2.writes.self)
|
|
18246
|
+
extra.push(CRM_ASSIGN_OTHERS_KEY);
|
|
18247
|
+
return { key: keyOf2(kind, verb), extra: [...extra, ...context2.writes.alsoChecks?.(kind, verb) ?? []] };
|
|
18248
|
+
}, "keysOf");
|
|
18249
|
+
var guardOf = /* @__PURE__ */ __name((context2, extra) => {
|
|
18250
|
+
const settings = context2.writes.settings();
|
|
18251
|
+
const defaults = { ...DEFAULT_PERMISSIONS, ...CRM_WRITE_DEFAULTS, ...settings.permissionDefaults };
|
|
18252
|
+
return keyedGuard((ask2) => guardFor(context2.writes.app, { ...settings, sendsPerHour: Number.MAX_SAFE_INTEGER, permissionDefaults: defaults }, context2.writes.warn ?? (() => {
|
|
18253
|
+
}), context2.writes.env, ask2), context2.ask, (key) => levelFor(settings.permissions, key, defaults).level, extra);
|
|
18254
|
+
}, "guardOf");
|
|
18255
|
+
var written = /* @__PURE__ */ __name(async (context2, { key, extra }, operationId, act2) => {
|
|
18256
|
+
try {
|
|
18257
|
+
const done2 = await guardedWrite(guardOf(context2, extra), { chatId: null, kind: "edit", key, operationId }, async () => {
|
|
18258
|
+
try {
|
|
18259
|
+
return { item: await act2(), unread: null };
|
|
18260
|
+
} catch (error) {
|
|
18261
|
+
if (isCliError(error) && error.details.sent === true)
|
|
18262
|
+
return { item: null, unread: error };
|
|
18187
18263
|
throw error;
|
|
18188
18264
|
}
|
|
18189
|
-
|
|
18190
|
-
|
|
18191
|
-
|
|
18192
|
-
|
|
18193
|
-
|
|
18194
|
-
|
|
18195
|
-
|
|
18196
|
-
|
|
18197
|
-
|
|
18198
|
-
|
|
18199
|
-
|
|
18200
|
-
|
|
18265
|
+
});
|
|
18266
|
+
if (done2.unread)
|
|
18267
|
+
throw new CliError(done2.unread.code, `${done2.unread.message} \u2014 the CRM made the change; sync to store it, do not write it again`, { ...done2.unread.details, operation_id: operationId });
|
|
18268
|
+
return done2.item;
|
|
18269
|
+
} catch (error) {
|
|
18270
|
+
if (!isCliError(error) || error.code !== "outcome_unknown")
|
|
18271
|
+
throw error;
|
|
18272
|
+
const name = context2.names?.id ?? "--operation-id";
|
|
18273
|
+
throw new CliError("outcome_unknown", context2.writes.writer.capabilities.idempotent ? `${error.message} \u2014 repeat it with ${name} ${operationId}: the CRM answers a repeat from its record instead of doing it again` : `${error.message} \u2014 sync and look at the CRM before writing again: this CRM would do it a second time`, { ...error.details, operation_id: operationId });
|
|
18274
|
+
}
|
|
18275
|
+
}, "written");
|
|
18276
|
+
var kept = /* @__PURE__ */ __name(async (context2, kind, item2, operationId) => {
|
|
18277
|
+
const fail2 = /* @__PURE__ */ __name((why, details = {}) => new CliError("invalid_response", `the CRM wrote ${kind} ${item2.externalId}, but the local store did not keep it (${why}); sync to store it \u2014 do not write it again`, { ...details, operation_id: operationId, external_id: item2.externalId, sent: true }), "fail");
|
|
18278
|
+
try {
|
|
18279
|
+
let saved = await context2.store.crm.saveItems(context2.account, kind, [item2]);
|
|
18280
|
+
if (saved.skipped[0]?.reason === "crm.stage-unknown" && context2.source) {
|
|
18281
|
+
await context2.store.crm.savePipelines(context2.account, kind, await context2.source().pipelines(kind));
|
|
18282
|
+
saved = await context2.store.crm.saveItems(context2.account, kind, [item2]);
|
|
18201
18283
|
}
|
|
18284
|
+
const [skipped] = saved.skipped;
|
|
18285
|
+
if (skipped)
|
|
18286
|
+
throw fail2(skipped.message, { reason: skipped.reason });
|
|
18287
|
+
const reference = await context2.store.crm.refOf(context2.account, kind, item2.externalId);
|
|
18288
|
+
if (reference === null)
|
|
18289
|
+
throw fail2("it is not found after the save");
|
|
18290
|
+
return await context2.store.deals.get(reference);
|
|
18291
|
+
} catch (error) {
|
|
18292
|
+
if (isCliError(error) && error.code === "invalid_response" && error.details.sent === true)
|
|
18293
|
+
throw error;
|
|
18294
|
+
throw fail2(error instanceof Error ? error.message : String(error), isCliError(error) ? error.details : {});
|
|
18202
18295
|
}
|
|
18203
|
-
}, "
|
|
18204
|
-
|
|
18205
|
-
|
|
18206
|
-
|
|
18207
|
-
|
|
18208
|
-
|
|
18209
|
-
|
|
18210
|
-
|
|
18211
|
-
|
|
18212
|
-
|
|
18213
|
-
|
|
18214
|
-
const
|
|
18215
|
-
const
|
|
18216
|
-
|
|
18217
|
-
|
|
18218
|
-
|
|
18219
|
-
const
|
|
18220
|
-
|
|
18221
|
-
|
|
18222
|
-
|
|
18223
|
-
|
|
18296
|
+
}, "kept");
|
|
18297
|
+
var createCrmItem = /* @__PURE__ */ __name(async (context2, kind, input, options2 = {}) => {
|
|
18298
|
+
const { writer } = context2.writes;
|
|
18299
|
+
supported(writer, kind, "create");
|
|
18300
|
+
if (input.title === void 0)
|
|
18301
|
+
throw invalid(`a new ${kind} needs --title`, "--title");
|
|
18302
|
+
const pipeline2 = await pipelineOf(context2, kind, input.pipeline);
|
|
18303
|
+
const { fields, stage } = fieldsOf({ ...input, pipeline: pipeline2.ref }, pipeline2, null);
|
|
18304
|
+
const custom = await customOf(context2, kind, input.custom);
|
|
18305
|
+
if (custom)
|
|
18306
|
+
fields.custom = custom;
|
|
18307
|
+
const operationId = operationOf(context2, options2.operationId);
|
|
18308
|
+
const item2 = await written(context2, keysOf(context2, kind, "create", { stage, owner: fields.owner }), operationId, () => writer.create(kind, fields, { operationId }));
|
|
18309
|
+
return { operationId, item: await kept(context2, kind, item2, operationId) };
|
|
18310
|
+
}, "createCrmItem");
|
|
18311
|
+
var updateCrmItem = /* @__PURE__ */ __name(async (context2, kind, reference, input, options2 = {}) => {
|
|
18312
|
+
const { writer } = context2.writes;
|
|
18313
|
+
supported(writer, kind, "update");
|
|
18314
|
+
const copy = await copyOf(context2, kind, reference);
|
|
18315
|
+
if (input.pipeline !== void 0 && input.stage === void 0)
|
|
18316
|
+
throw invalid("a new --pipeline needs the --stage it goes to there", "--stage");
|
|
18317
|
+
const pipeline2 = input.stage === void 0 ? void 0 : await pipelineOf(context2, kind, input.pipeline === void 0 ? copy.pipeline : input.pipeline);
|
|
18318
|
+
const { fields, stage } = fieldsOf(input, pipeline2, copy.currency);
|
|
18319
|
+
const custom = await customOf(context2, kind, input.custom);
|
|
18320
|
+
if (custom)
|
|
18321
|
+
fields.custom = custom;
|
|
18322
|
+
if (Object.keys(fields).length === 0)
|
|
18323
|
+
throw invalid("nothing to change: name a field");
|
|
18324
|
+
const operationId = operationOf(context2, options2.operationId);
|
|
18325
|
+
const item2 = await written(context2, keysOf(context2, kind, "update", { stage, owner: fields.owner }), operationId, () => writer.update(kind, copy.externalId, fields, { operationId }));
|
|
18326
|
+
return { operationId, item: await kept(context2, kind, item2, operationId) };
|
|
18327
|
+
}, "updateCrmItem");
|
|
18328
|
+
var moveCrmItem = /* @__PURE__ */ __name(async (context2, kind, reference, stageName, options2 = {}) => {
|
|
18329
|
+
const { writer } = context2.writes;
|
|
18330
|
+
supported(writer, kind, "move");
|
|
18331
|
+
const copy = await copyOf(context2, kind, reference);
|
|
18332
|
+
const stage = stageOf(await pipelineOf(context2, kind, copy.pipeline), stageName);
|
|
18333
|
+
const operationId = operationOf(context2, options2.operationId);
|
|
18334
|
+
const item2 = await written(context2, keysOf(context2, kind, "move", { stage }), operationId, () => writer.move(kind, copy.externalId, stage.externalId, { operationId }));
|
|
18335
|
+
return { operationId, item: await kept(context2, kind, item2, operationId) };
|
|
18336
|
+
}, "moveCrmItem");
|
|
18337
|
+
var closeCrmItem = /* @__PURE__ */ __name(async (context2, kind, reference, outcome2, options2 = {}) => {
|
|
18338
|
+
const { writer } = context2.writes;
|
|
18339
|
+
supported(writer, kind, "close");
|
|
18340
|
+
if (outcome2 !== "won" && outcome2 !== "lost")
|
|
18341
|
+
throw invalid("a close is won or lost");
|
|
18342
|
+
const copy = await copyOf(context2, kind, reference);
|
|
18343
|
+
const reason = options2.reason?.trim();
|
|
18344
|
+
if (reason !== void 0 && (reason === "" || reason.length > 2e3))
|
|
18345
|
+
throw invalid("--reason is 1 to 2000 characters", "--reason");
|
|
18346
|
+
const operationId = operationOf(context2, options2.operationId);
|
|
18347
|
+
const item2 = await written(context2, keysOf(context2, kind, "close", {}), operationId, () => writer.close(kind, copy.externalId, outcome2, { operationId, ...reason ? { reason } : {} }));
|
|
18348
|
+
return { operationId, item: await kept(context2, kind, item2, operationId) };
|
|
18349
|
+
}, "closeCrmItem");
|
|
18350
|
+
var removeCrmItem = /* @__PURE__ */ __name(async (context2, kind, reference, options2 = {}) => {
|
|
18351
|
+
const { writer } = context2.writes;
|
|
18352
|
+
supported(writer, kind, "remove");
|
|
18353
|
+
const copy = await copyOf(context2, kind, reference);
|
|
18354
|
+
const operationId = operationOf(context2, options2.operationId);
|
|
18355
|
+
await written(context2, keysOf(context2, kind, "remove", {}), operationId, () => writer.remove(kind, copy.externalId, { operationId }));
|
|
18356
|
+
const removed = await context2.store.crm.remove(context2.account, kind, [copy.externalId]);
|
|
18357
|
+
return { operationId, ref: copy.ref, removed };
|
|
18358
|
+
}, "removeCrmItem");
|
|
18359
|
+
var EMAIL = /^[^\s@]{1,64}@[^\s@]{1,255}$/u;
|
|
18360
|
+
var RECORD_ID = /^[\w.:-]{1,100}$/u;
|
|
18361
|
+
var PERSON_ONLY = ["firstName", "lastName", "position"];
|
|
18362
|
+
var recordInvalid = /* @__PURE__ */ __name((message, param) => new CliError("validation_error", message, { reason: "crm.record-field", ...param ? { param } : {} }), "recordInvalid");
|
|
18363
|
+
var cleared = /* @__PURE__ */ __name((value) => value === void 0 ? void 0 : value.trim() || null, "cleared");
|
|
18364
|
+
var listed2 = /* @__PURE__ */ __name((values, param, valid) => {
|
|
18365
|
+
if (values === void 0)
|
|
18366
|
+
return void 0;
|
|
18367
|
+
const all = values.map((one) => one.trim());
|
|
18368
|
+
if (all.length === 1 && all[0] === "")
|
|
18369
|
+
return [];
|
|
18370
|
+
for (const one of all)
|
|
18371
|
+
if (one === "" || one.length > 320 || valid && !valid.test(one))
|
|
18372
|
+
throw recordInvalid(`${param} got ${one}`, param);
|
|
18373
|
+
return all;
|
|
18374
|
+
}, "listed");
|
|
18375
|
+
var recordFieldsOf = /* @__PURE__ */ __name((kind, input) => {
|
|
18376
|
+
if (kind === "organization") {
|
|
18377
|
+
const given = PERSON_ONLY.find((one) => input[one] !== void 0);
|
|
18378
|
+
if (given)
|
|
18379
|
+
throw recordInvalid(`a company has no ${given}`);
|
|
18380
|
+
}
|
|
18381
|
+
const fields = {};
|
|
18382
|
+
if (input.name !== void 0) {
|
|
18383
|
+
if (!input.name.trim())
|
|
18384
|
+
throw recordInvalid("--name is never empty", "--name");
|
|
18385
|
+
fields.name = input.name.trim();
|
|
18386
|
+
}
|
|
18387
|
+
const parts = { firstName: cleared(input.firstName), lastName: cleared(input.lastName) };
|
|
18388
|
+
const position = cleared(input.position);
|
|
18389
|
+
if (parts.firstName !== void 0)
|
|
18390
|
+
fields.firstName = parts.firstName;
|
|
18391
|
+
if (parts.lastName !== void 0)
|
|
18392
|
+
fields.lastName = parts.lastName;
|
|
18393
|
+
if (position !== void 0)
|
|
18394
|
+
fields.position = position;
|
|
18395
|
+
const emails = listed2(input.emails, "--email", EMAIL);
|
|
18396
|
+
const phones = listed2(input.phones, "--phone")?.map((phone) => {
|
|
18397
|
+
const international = e164Of(phone, void 0);
|
|
18398
|
+
if (typeof international !== "string")
|
|
18399
|
+
throw recordInvalid(`--phone takes a number in international form, starting with +: not ${phone}`, "--phone");
|
|
18400
|
+
return international;
|
|
18401
|
+
});
|
|
18402
|
+
if (emails)
|
|
18403
|
+
fields.emails = emails;
|
|
18404
|
+
if (phones)
|
|
18405
|
+
fields.phones = phones;
|
|
18406
|
+
if (input.owner !== void 0) {
|
|
18407
|
+
if (!input.owner.trim())
|
|
18408
|
+
throw recordInvalid("--owner is the CRM user's id", "--owner");
|
|
18409
|
+
fields.owner = input.owner.trim();
|
|
18410
|
+
}
|
|
18411
|
+
return fields;
|
|
18412
|
+
}, "recordFieldsOf");
|
|
18413
|
+
var keptRecord = /* @__PURE__ */ __name(async (context2, kind, record2) => {
|
|
18414
|
+
try {
|
|
18415
|
+
const saved = kind === "person" ? await context2.store.crm.savePeople(context2.account, [record2]) : await context2.store.crm.saveOrganizations(context2.account, [record2]);
|
|
18416
|
+
const [skipped] = saved.skipped;
|
|
18417
|
+
if (skipped)
|
|
18418
|
+
throw new Error(skipped.message);
|
|
18419
|
+
} catch (error) {
|
|
18420
|
+
throw new CliError("invalid_response", `the CRM wrote ${kind} ${record2.externalId}, but the local store did not keep it (${error instanceof Error ? error.message : String(error)}); sync to store it \u2014 do not write it again`, { external_id: record2.externalId, sent: true });
|
|
18421
|
+
}
|
|
18422
|
+
}, "keptRecord");
|
|
18423
|
+
var forgotten = /* @__PURE__ */ __name(async (context2, kind, record2) => (kind === "organization" ? await context2.store.crm.remove(context2.account, kind, [record2.externalId]) : (await context2.store.crm.removeContact(context2.account, record2.externalId)).contacts) > 0, "forgotten");
|
|
18424
|
+
var writeRecord = /* @__PURE__ */ __name(async (context2, kind, verb, fields, operationId, act2) => {
|
|
18425
|
+
if (!context2.source)
|
|
18426
|
+
throw new CliError("configuration_error", "a contact or company write needs the CRM source to tell your clients");
|
|
18427
|
+
const rule = foreignContacts(context2.source(), void 0);
|
|
18428
|
+
const record2 = await written(context2, keysOf(context2, kind, verb, { owner: fields.owner }), operationId, act2);
|
|
18429
|
+
const stored = await rule.own(kind, record2);
|
|
18430
|
+
let removed;
|
|
18431
|
+
try {
|
|
18432
|
+
if (stored)
|
|
18433
|
+
await keptRecord(context2, kind, record2);
|
|
18434
|
+
else if (verb === "update")
|
|
18435
|
+
removed = await forgotten(context2, kind, record2);
|
|
18436
|
+
} catch (error) {
|
|
18437
|
+
if (isCliError(error))
|
|
18438
|
+
throw new CliError(error.code, error.message, { ...error.details, operation_id: operationId });
|
|
18439
|
+
throw error;
|
|
18440
|
+
}
|
|
18441
|
+
const [shown] = stored ? [record2] : await rule.strip(kind, [record2]);
|
|
18224
18442
|
return {
|
|
18225
|
-
|
|
18226
|
-
|
|
18227
|
-
|
|
18228
|
-
|
|
18229
|
-
...since === void 0 && until === void 0 ? {} : { window: window3 }
|
|
18230
|
-
}
|
|
18443
|
+
operationId,
|
|
18444
|
+
record: shown,
|
|
18445
|
+
stored,
|
|
18446
|
+
...removed === void 0 ? {} : { removed }
|
|
18231
18447
|
};
|
|
18232
|
-
}, "
|
|
18448
|
+
}, "writeRecord");
|
|
18449
|
+
var createCrmRecord = /* @__PURE__ */ __name(async (context2, kind, input, options2 = {}) => {
|
|
18450
|
+
const { writer } = context2.writes;
|
|
18451
|
+
supported(writer, kind, "create");
|
|
18452
|
+
const fields = recordFieldsOf(kind, input);
|
|
18453
|
+
if (kind === "organization" && fields.name === void 0)
|
|
18454
|
+
throw recordInvalid("a new company needs --name", "--name");
|
|
18455
|
+
if (kind === "person" && !fields.name && !fields.firstName && !fields.lastName)
|
|
18456
|
+
throw recordInvalid("a new contact needs --name, --first-name or --last-name", "--name");
|
|
18457
|
+
const custom = await customOf(context2, kind, input.custom);
|
|
18458
|
+
if (custom)
|
|
18459
|
+
fields.custom = custom;
|
|
18460
|
+
const operationId = operationOf(context2, options2.operationId);
|
|
18461
|
+
return writeRecord(context2, kind, "create", fields, operationId, () => writer.create(kind, fields, { operationId }));
|
|
18462
|
+
}, "createCrmRecord");
|
|
18463
|
+
var updateCrmRecord = /* @__PURE__ */ __name(async (context2, kind, externalId, input, options2 = {}) => {
|
|
18464
|
+
const { writer } = context2.writes;
|
|
18465
|
+
supported(writer, kind, "update");
|
|
18466
|
+
if (!RECORD_ID.test(externalId))
|
|
18467
|
+
throw new CliError("validation_error", `name the ${kind} by the CRM's id, as a list prints it`, {
|
|
18468
|
+
reason: "ref.malformed"
|
|
18469
|
+
});
|
|
18470
|
+
const fields = recordFieldsOf(kind, input);
|
|
18471
|
+
const custom = await customOf(context2, kind, input.custom);
|
|
18472
|
+
if (custom)
|
|
18473
|
+
fields.custom = custom;
|
|
18474
|
+
if (Object.keys(fields).length === 0)
|
|
18475
|
+
throw recordInvalid("nothing to change: name a field");
|
|
18476
|
+
const operationId = operationOf(context2, options2.operationId);
|
|
18477
|
+
return writeRecord(context2, kind, "update", fields, operationId, () => writer.update(kind, externalId, fields, { operationId }));
|
|
18478
|
+
}, "updateCrmRecord");
|
|
18233
18479
|
|
|
18234
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/
|
|
18235
|
-
var
|
|
18236
|
-
|
|
18237
|
-
|
|
18238
|
-
|
|
18239
|
-
|
|
18240
|
-
|
|
18241
|
-
|
|
18242
|
-
|
|
18243
|
-
|
|
18244
|
-
|
|
18245
|
-
|
|
18246
|
-
|
|
18247
|
-
|
|
18248
|
-
|
|
18249
|
-
|
|
18250
|
-
var changeOptions = /* @__PURE__ */ __name((command, declared, create) => {
|
|
18251
|
-
const settings = declared.settings.length ? declared.settings.map((one) => `${one.name}=${valuesOf(one)}`).join(", ") : "this service has none";
|
|
18252
|
-
const takes = declared.fields.map(meetingFieldFlag).join(", ") || "none of the options above";
|
|
18253
|
-
const schedules = declared.fields.includes("startTime");
|
|
18254
|
-
const start = !create ? "" : !schedules ? "; this service takes none, its meetings start now" : declared.fields.includes("kind") ? "; for a meeting that starts now, give --kind instant instead" : "";
|
|
18255
|
-
return command.option("--title <title>", "the meeting's title").addOption(new Option("--kind <kind>", "an instant or a scheduled meeting").choices(["instant", "scheduled"])).option("--start-time <time>", `when it starts: an ISO time with its offset, 2026-11-20T10:00:00+01:00${start}`).option("--duration-minutes <minutes>", "how long it lasts, 1\u20131440", minutes).option("--timezone <zone>", "its IANA time zone, Europe/Madrid").option("--agenda <text>", "its agenda").option("--setting <name=value>", `a setting of this service; repeat it for more: ${settings}`, setting).addHelpText("after", [
|
|
18256
|
-
"",
|
|
18257
|
-
`This service takes ${takes}.`,
|
|
18258
|
-
...declared.settings.length ? ["Its settings:", ...declared.settings.map((one) => ` ${one.name}=${valuesOf(one)} ${one.description}`)] : []
|
|
18259
|
-
].join("\n"));
|
|
18260
|
-
}, "changeOptions");
|
|
18261
|
-
var changeOf = /* @__PURE__ */ __name((flags) => {
|
|
18262
|
-
const change = Object.fromEntries(MEETING_FIELDS.flatMap((key) => flags[key] === void 0 ? [] : [[key, flags[key]]]));
|
|
18263
|
-
if (!flags.setting)
|
|
18264
|
-
return change;
|
|
18265
|
-
const settings = /* @__PURE__ */ new Map();
|
|
18266
|
-
for (const [name, value] of flags.setting) {
|
|
18267
|
-
if (settings.has(name))
|
|
18268
|
-
throw new CliError("validation_error", `--setting ${name} is given twice`);
|
|
18269
|
-
settings.set(name, value);
|
|
18270
|
-
}
|
|
18271
|
-
return { ...change, settings: Object.fromEntries(settings) };
|
|
18272
|
-
}, "changeOf");
|
|
18273
|
-
var meetingOf = /* @__PURE__ */ __name((one) => ({
|
|
18274
|
-
id: one.id,
|
|
18275
|
-
title: one.title,
|
|
18276
|
-
kind: one.kind,
|
|
18277
|
-
start_time: one.startTime,
|
|
18278
|
-
duration_minutes: one.durationMinutes,
|
|
18279
|
-
timezone: one.timezone,
|
|
18280
|
-
agenda: one.agenda,
|
|
18281
|
-
join_url: one.joinUrl
|
|
18282
|
-
}), "meetingOf");
|
|
18283
|
-
var receiptItem = /* @__PURE__ */ __name((receipt) => {
|
|
18284
|
-
const { change } = receipt;
|
|
18285
|
-
return {
|
|
18286
|
-
action: receipt.action,
|
|
18287
|
-
provider: receipt.scope.provider,
|
|
18288
|
-
account: receipt.scope.account,
|
|
18289
|
-
...receipt.id === void 0 ? {} : { id: receipt.id },
|
|
18290
|
-
...receipt.occurrenceId === void 0 ? {} : { occurrence_id: receipt.occurrenceId },
|
|
18291
|
-
...change ? {
|
|
18292
|
-
change: {
|
|
18293
|
-
...Object.fromEntries(MEETING_FIELDS.flatMap((key) => change[key] === void 0 ? [] : [[MEETING_FIELD_KEYS[key], change[key]]])),
|
|
18294
|
-
...change.settings === void 0 ? {} : { settings: { ...change.settings } }
|
|
18295
|
-
}
|
|
18296
|
-
} : {},
|
|
18297
|
-
applied: receipt.applied,
|
|
18298
|
-
...receipt.meeting ? { meeting: meetingOf(receipt.meeting), untrusted: ["meeting.title", "meeting.agenda", "meeting.join_url"] } : {}
|
|
18299
|
-
};
|
|
18300
|
-
}, "receiptItem");
|
|
18301
|
-
var addMeetingManagementCommands = /* @__PURE__ */ __name((group, deps) => {
|
|
18302
|
-
const { management, print, output, inRun, askFirst } = deps;
|
|
18303
|
-
const signalled = /* @__PURE__ */ __name(() => {
|
|
18304
|
-
const signal = deps.signal?.();
|
|
18305
|
-
return signal ? { signal } : {};
|
|
18306
|
-
}, "signalled");
|
|
18307
|
-
const has = /* @__PURE__ */ __name((name) => management.capabilities.includes(name), "has");
|
|
18308
|
-
const mutation = /* @__PURE__ */ __name((command) => ({
|
|
18309
|
-
apply: true,
|
|
18310
|
-
dryRun: command.optsWithGlobals().dryRun === true,
|
|
18311
|
-
...signalled(),
|
|
18312
|
-
confirm: /* @__PURE__ */ __name(async () => {
|
|
18313
|
-
if (!askFirst)
|
|
18314
|
-
throw new CliError("configuration_error", "this tool cannot ask before it changes a meeting on the service");
|
|
18315
|
-
await askFirst(command);
|
|
18316
|
-
}, "confirm")
|
|
18317
|
-
}), "mutation");
|
|
18318
|
-
const write = /* @__PURE__ */ __name((name) => annotate(group.command(name), { effects: REMOTE_WRITE, offline: false, output: { entity: "meeting_change" } }), "write");
|
|
18319
|
-
const target2 = /* @__PURE__ */ __name((command) => command.argument("<meeting>", "the service's id of the meeting"), "target");
|
|
18320
|
-
if (has("create"))
|
|
18321
|
-
output(changeOptions(write("create").description("create a meeting on the service"), management.fields.create, true)).action(async (flags, command) => inRun(command, async () => print({ item: receiptItem(await management.create(changeOf(flags), mutation(command))) }, command)));
|
|
18322
|
-
if (has("update"))
|
|
18323
|
-
output(changeOptions(target2(write("update").description("change a meeting on the service")), management.fields.update, false)).action(async (id3, flags, command) => inRun(command, async () => print({ item: receiptItem(await management.update(id3, changeOf(flags), mutation(command))) }, command)));
|
|
18324
|
-
if (has("cancel"))
|
|
18325
|
-
output(target2(write("cancel").description("cancel a meeting on the service")).option("--occurrence-id <id>", "cancel only this occurrence of a repeating meeting")).action(async (id3, flags, command) => inRun(command, async () => print({
|
|
18326
|
-
item: receiptItem(await management.cancel(id3, {
|
|
18327
|
-
...mutation(command),
|
|
18328
|
-
...flags.occurrenceId === void 0 ? {} : { occurrenceId: flags.occurrenceId }
|
|
18329
|
-
}))
|
|
18330
|
-
}, command)));
|
|
18331
|
-
if (has("invitation"))
|
|
18332
|
-
output(target2(annotate(group.command("invitation"), {
|
|
18333
|
-
effects: REMOTE_READ,
|
|
18334
|
-
offline: false,
|
|
18335
|
-
output: { entity: "meeting_invitation" }
|
|
18336
|
-
}).description("the invitation text the service writes for a meeting"))).action(async (id3, _flags, command) => inRun(command, async () => print({ item: { ...await management.invitation(id3, signalled()), untrusted: ["invitation"] } }, command)));
|
|
18337
|
-
}, "addMeetingManagementCommands");
|
|
18480
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/values.js
|
|
18481
|
+
var values_exports = {};
|
|
18482
|
+
__export(values_exports, {
|
|
18483
|
+
amountOf: () => amountOf,
|
|
18484
|
+
crmValuesOf: () => crmValuesOf,
|
|
18485
|
+
epoch: () => epoch,
|
|
18486
|
+
fieldOf: () => fieldOf,
|
|
18487
|
+
fullName: () => fullName,
|
|
18488
|
+
id: () => id,
|
|
18489
|
+
ids: () => ids,
|
|
18490
|
+
isRaw: () => isRaw,
|
|
18491
|
+
number: () => number2,
|
|
18492
|
+
rawsOf: () => rawsOf,
|
|
18493
|
+
text: () => text,
|
|
18494
|
+
time: () => time
|
|
18495
|
+
});
|
|
18338
18496
|
|
|
18339
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/
|
|
18340
|
-
var
|
|
18341
|
-
|
|
18342
|
-
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18346
|
-
|
|
18347
|
-
|
|
18348
|
-
|
|
18349
|
-
|
|
18350
|
-
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18357
|
-
|
|
18497
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/files.js
|
|
18498
|
+
var foldKey = /* @__PURE__ */ __name((key) => key.replaceAll("_", "").toLowerCase(), "foldKey");
|
|
18499
|
+
var DOWNLOAD_KEYS = new Set(["DOWNLOAD_URL", "downloadUrl", "fileUrl", "CALL_RECORD_URL", "archiveLink", "publicUrl"].map(foldKey));
|
|
18500
|
+
var isDownloadKey = /* @__PURE__ */ __name((key) => DOWNLOAD_KEYS.has(foldKey(key)) || foldKey(key).endsWith("machine"), "isDownloadKey");
|
|
18501
|
+
var WEBHOOK = /\/rest\/\d+\/[^/\s"'?#]+\//iu;
|
|
18502
|
+
var PORTAL_PATH = /\/rest\/|show_file\.php/iu;
|
|
18503
|
+
var TOKEN_QUERY = /(?:[?&]|&)(?:auth|token|access_token)=[^&#\s]/iu;
|
|
18504
|
+
var CREDENTIAL = /(?:[?&]|&)(?:auth|access_token|api_token|x-amz-signature)=[^&#\s]/iu;
|
|
18505
|
+
var isTokened = /* @__PURE__ */ __name((value) => WEBHOOK.test(value) || CREDENTIAL.test(value) || PORTAL_PATH.test(value) && TOKEN_QUERY.test(value), "isTokened");
|
|
18506
|
+
var LINK_REMOVED = "[link removed]";
|
|
18507
|
+
var withoutFileLinks = /* @__PURE__ */ __name((body) => {
|
|
18508
|
+
const walk2 = /* @__PURE__ */ __name((value, key) => {
|
|
18509
|
+
if (typeof value === "string")
|
|
18510
|
+
return isTokened(value) ? LINK_REMOVED : value;
|
|
18511
|
+
if (Array.isArray(value))
|
|
18512
|
+
return value.map((one) => walk2(one));
|
|
18513
|
+
if (value === null || typeof value !== "object")
|
|
18514
|
+
return value;
|
|
18515
|
+
return Object.fromEntries(Object.entries(value).map(([name, one]) => [
|
|
18516
|
+
name,
|
|
18517
|
+
(isDownloadKey(name) || key === "_links" && name === "download") && one !== null && one !== "" ? LINK_REMOVED : walk2(one, name)
|
|
18518
|
+
]));
|
|
18519
|
+
}, "walk");
|
|
18520
|
+
return walk2(body);
|
|
18521
|
+
}, "withoutFileLinks");
|
|
18358
18522
|
|
|
18359
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/
|
|
18360
|
-
var
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
|
|
18365
|
-
|
|
18366
|
-
const
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
|
|
18370
|
-
|
|
18371
|
-
|
|
18372
|
-
|
|
18373
|
-
|
|
18374
|
-
|
|
18375
|
-
|
|
18376
|
-
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
|
|
18380
|
-
|
|
18381
|
-
if (
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18387
|
-
|
|
18388
|
-
|
|
18389
|
-
|
|
18390
|
-
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
const
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18523
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/values.js
|
|
18524
|
+
var isRaw = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRaw");
|
|
18525
|
+
var fieldOf = /* @__PURE__ */ __name((value, key) => isRaw(value) ? value[key] : void 0, "fieldOf");
|
|
18526
|
+
var rawsOf = /* @__PURE__ */ __name((value) => Array.isArray(value) ? value.filter(isRaw) : [], "rawsOf");
|
|
18527
|
+
var text = /* @__PURE__ */ __name((value) => {
|
|
18528
|
+
if (typeof value !== "string" && typeof value !== "number")
|
|
18529
|
+
return null;
|
|
18530
|
+
const trimmed = String(value).trim();
|
|
18531
|
+
return trimmed === "" ? null : trimmed;
|
|
18532
|
+
}, "text");
|
|
18533
|
+
var id = /* @__PURE__ */ __name((value) => {
|
|
18534
|
+
const found = text(value);
|
|
18535
|
+
return found === null || found === "0" ? null : found;
|
|
18536
|
+
}, "id");
|
|
18537
|
+
var ids = /* @__PURE__ */ __name((value) => Array.isArray(value) ? value.map(id).filter((one) => one !== null) : [], "ids");
|
|
18538
|
+
var number2 = /* @__PURE__ */ __name((value) => {
|
|
18539
|
+
if (value === null || value === void 0 || value === "")
|
|
18540
|
+
return null;
|
|
18541
|
+
const found = Number(value);
|
|
18542
|
+
return Number.isFinite(found) ? found : null;
|
|
18543
|
+
}, "number");
|
|
18544
|
+
var time = /* @__PURE__ */ __name((value) => {
|
|
18545
|
+
if (typeof value === "number") {
|
|
18546
|
+
if (!Number.isFinite(value) || value <= 0)
|
|
18547
|
+
return null;
|
|
18548
|
+
return new Date(value > 1e11 ? value : value * 1e3).toISOString();
|
|
18549
|
+
}
|
|
18550
|
+
const found = text(value);
|
|
18551
|
+
if (found === null)
|
|
18552
|
+
return null;
|
|
18553
|
+
const parsed = new Date(found);
|
|
18554
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString();
|
|
18555
|
+
}, "time");
|
|
18556
|
+
var epoch = /* @__PURE__ */ __name((value) => {
|
|
18557
|
+
const found = time(value);
|
|
18558
|
+
return found === null ? null : Date.parse(found);
|
|
18559
|
+
}, "epoch");
|
|
18560
|
+
var amountOf = /* @__PURE__ */ __name((value, currency) => {
|
|
18561
|
+
const found = number2(value);
|
|
18562
|
+
const code = text(currency)?.toUpperCase() ?? null;
|
|
18563
|
+
if (found === null || found <= 0 || code === null)
|
|
18564
|
+
return { amount: null, currency: null };
|
|
18565
|
+
return { amount: typeof value === "string" ? value.trim() : String(found), currency: code };
|
|
18566
|
+
}, "amountOf");
|
|
18567
|
+
var fullName = /* @__PURE__ */ __name((...parts) => parts.map(text).filter((part) => part !== null).join(" ") || null, "fullName");
|
|
18568
|
+
var optionLabel = /* @__PURE__ */ __name((field, option) => field.options?.find(({ id: id3 }) => id3 === String(option))?.label ?? String(option), "optionLabel");
|
|
18569
|
+
var crmValuesOf = /* @__PURE__ */ __name((values, fields) => {
|
|
18570
|
+
const byCode = new Map(fields.map((field) => [field.code, field]));
|
|
18571
|
+
return Object.fromEntries(Object.entries(values).map(([code, value]) => {
|
|
18572
|
+
const field = byCode.get(code);
|
|
18573
|
+
const label = field?.label ?? null;
|
|
18574
|
+
if (!field?.options)
|
|
18575
|
+
return [code, { label, value: withoutFileLinks(value) }];
|
|
18576
|
+
if (Array.isArray(value))
|
|
18577
|
+
return [code, { label, value: value.map((one) => optionLabel(field, one)), option_id: value.map(String) }];
|
|
18578
|
+
return [code, { label, value: optionLabel(field, value), option_id: String(value) }];
|
|
18579
|
+
}));
|
|
18580
|
+
}, "crmValuesOf");
|
|
18400
18581
|
|
|
18401
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/
|
|
18402
|
-
var
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
const
|
|
18409
|
-
|
|
18410
|
-
|
|
18411
|
-
|
|
18412
|
-
|
|
18413
|
-
|
|
18414
|
-
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
|
|
18420
|
-
});
|
|
18421
|
-
}, "addMeetingProjectEvidenceCommandDefinition");
|
|
18422
|
-
var addMeetingProjectEvidenceCommand = sharedCommand(addMeetingProjectEvidenceCommandDefinition);
|
|
18582
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/walk.js
|
|
18583
|
+
var crmWindowOf = /* @__PURE__ */ __name((query) => {
|
|
18584
|
+
const page = query.page ?? 1;
|
|
18585
|
+
return { offset: (Number.isSafeInteger(page) && page > 1 ? page - 1 : 0) * query.limit, limit: query.limit };
|
|
18586
|
+
}, "crmWindowOf");
|
|
18587
|
+
var walk = /* @__PURE__ */ __name(async (window3, largest, fetchPage) => {
|
|
18588
|
+
const want = window3.limit + 1;
|
|
18589
|
+
const rows = [];
|
|
18590
|
+
let at = window3.offset;
|
|
18591
|
+
while (rows.length < want) {
|
|
18592
|
+
const page = await fetchPage(at, Math.min(largest, want - rows.length));
|
|
18593
|
+
for (const row of page.rows)
|
|
18594
|
+
rows.push(row);
|
|
18595
|
+
at += page.rows.length;
|
|
18596
|
+
if (!page.more || page.rows.length === 0)
|
|
18597
|
+
break;
|
|
18598
|
+
}
|
|
18599
|
+
return { items: rows.slice(0, window3.limit), hasMore: rows.length > window3.limit };
|
|
18600
|
+
}, "walk");
|
|
18423
18601
|
|
|
18424
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/
|
|
18425
|
-
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18429
|
-
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
18433
|
-
throw new CliError("validation_error", "expected a positive safe integer");
|
|
18434
|
-
return Number(value);
|
|
18435
|
-
}, "integer");
|
|
18436
|
-
var createMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program) => {
|
|
18437
|
-
let search = program.commands.find((command2) => command2.name() === "search");
|
|
18438
|
-
if (!search) {
|
|
18439
|
-
search = new Command("search").description("search the stored resources");
|
|
18440
|
-
program.addCommand(search);
|
|
18602
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/sends/pace.js
|
|
18603
|
+
import { readFileSync as readFileSync5, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
18604
|
+
import { join as join5 } from "node:path";
|
|
18605
|
+
var DEFAULT_PACE = { perMinute: 60, burst: 20 };
|
|
18606
|
+
var pacePathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join5(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "pace", `${profile}.json`), "pacePathFor");
|
|
18607
|
+
var Pacer = class {
|
|
18608
|
+
static {
|
|
18609
|
+
__name(this, "Pacer");
|
|
18441
18610
|
}
|
|
18442
|
-
|
|
18443
|
-
|
|
18444
|
-
|
|
18445
|
-
|
|
18446
|
-
|
|
18447
|
-
|
|
18448
|
-
|
|
18449
|
-
|
|
18450
|
-
|
|
18451
|
-
|
|
18452
|
-
|
|
18453
|
-
|
|
18454
|
-
|
|
18455
|
-
|
|
18456
|
-
|
|
18457
|
-
|
|
18458
|
-
|
|
18459
|
-
|
|
18460
|
-
|
|
18461
|
-
|
|
18462
|
-
|
|
18463
|
-
|
|
18464
|
-
|
|
18465
|
-
|
|
18466
|
-
|
|
18467
|
-
|
|
18468
|
-
|
|
18469
|
-
|
|
18470
|
-
|
|
18471
|
-
|
|
18472
|
-
|
|
18473
|
-
|
|
18474
|
-
|
|
18475
|
-
|
|
18476
|
-
|
|
18477
|
-
|
|
18478
|
-
|
|
18479
|
-
|
|
18480
|
-
|
|
18481
|
-
|
|
18482
|
-
|
|
18483
|
-
|
|
18484
|
-
|
|
18485
|
-
|
|
18486
|
-
|
|
18611
|
+
path;
|
|
18612
|
+
rate;
|
|
18613
|
+
now;
|
|
18614
|
+
constructor(path, rate, now = Date.now) {
|
|
18615
|
+
this.path = path;
|
|
18616
|
+
this.rate = rate;
|
|
18617
|
+
this.now = now;
|
|
18618
|
+
}
|
|
18619
|
+
get interval() {
|
|
18620
|
+
return this.rate.perMinute > 0 ? 6e4 / this.rate.perMinute : 0;
|
|
18621
|
+
}
|
|
18622
|
+
/** When this call may go; reserved at once, so the next caller in any process lines up behind it. */
|
|
18623
|
+
async reserve() {
|
|
18624
|
+
if (this.interval === 0)
|
|
18625
|
+
return this.now();
|
|
18626
|
+
return withFileLockAsync(this.path, "the request pace", () => {
|
|
18627
|
+
const now = this.now();
|
|
18628
|
+
const tat = Math.max(this.read(now), now);
|
|
18629
|
+
this.write(tat + this.interval, now);
|
|
18630
|
+
return Math.max(now, tat - this.rate.burst * this.interval);
|
|
18631
|
+
});
|
|
18632
|
+
}
|
|
18633
|
+
/** The messenger asked every caller to wait: nothing goes before `now + waitMs`, in any process. */
|
|
18634
|
+
async holdFor(waitMs) {
|
|
18635
|
+
if (this.interval === 0)
|
|
18636
|
+
return;
|
|
18637
|
+
await withFileLockAsync(this.path, "the request pace", () => {
|
|
18638
|
+
const now = this.now();
|
|
18639
|
+
const hold = now + waitMs + this.rate.burst * this.interval;
|
|
18640
|
+
this.write(Math.max(this.read(now), hold), now);
|
|
18641
|
+
});
|
|
18642
|
+
}
|
|
18643
|
+
/** The owner's `flood clear`: every process may go again at once. */
|
|
18644
|
+
async reset() {
|
|
18645
|
+
await withFileLockAsync(this.path, "the request pace", () => this.write(0, this.now()));
|
|
18646
|
+
}
|
|
18647
|
+
read(now) {
|
|
18648
|
+
try {
|
|
18649
|
+
const file = JSON.parse(readFileSync5(this.path, "utf8"));
|
|
18650
|
+
const tat = Number(file.tat);
|
|
18651
|
+
if (!Number.isFinite(tat))
|
|
18652
|
+
return 0;
|
|
18653
|
+
const at = Number(file.at);
|
|
18654
|
+
return Number.isFinite(at) && at > now ? now + Math.max(0, tat - at) : tat;
|
|
18655
|
+
} catch {
|
|
18656
|
+
return 0;
|
|
18657
|
+
}
|
|
18658
|
+
}
|
|
18659
|
+
write(tat, at) {
|
|
18660
|
+
const temporary = `${this.path}.${process.pid}.tmp`;
|
|
18661
|
+
writeFileSync2(temporary, JSON.stringify({ tat, at }), { mode: 384 });
|
|
18662
|
+
renameSync2(temporary, this.path);
|
|
18663
|
+
}
|
|
18664
|
+
};
|
|
18665
|
+
var ANNOUNCE_WAIT_MS = 5e3;
|
|
18666
|
+
var LONGEST_PACE_WAIT_MS = 5 * 6e4;
|
|
18667
|
+
var waitForTurn = /* @__PURE__ */ __name(async (pacer, options2) => {
|
|
18668
|
+
const { name, operation, warn } = options2;
|
|
18669
|
+
const now = options2.now ?? Date.now;
|
|
18670
|
+
let at = now();
|
|
18671
|
+
try {
|
|
18672
|
+
at = await pacer.reserve();
|
|
18673
|
+
} catch (error) {
|
|
18674
|
+
warn?.(`could not remember ${name}'s wait (${error instanceof Error ? error.message : String(error)})`, {
|
|
18675
|
+
event: "warning",
|
|
18676
|
+
code: "wait_not_remembered",
|
|
18677
|
+
operation
|
|
18678
|
+
});
|
|
18679
|
+
}
|
|
18680
|
+
const waitMs = at - now();
|
|
18681
|
+
if (waitMs <= 0)
|
|
18682
|
+
return;
|
|
18683
|
+
if (waitMs > (options2.longestWaitMs ?? LONGEST_PACE_WAIT_MS))
|
|
18684
|
+
throw new CliError("rate_limited", `this profile's next request to ${name} has to wait ${Math.ceil(waitMs / 1e3)} s more \u2014 nothing was sent to ${name}`, { retry_after_ms: waitMs, retry_at: new Date(at).toISOString(), remembered: true });
|
|
18685
|
+
if (waitMs >= ANNOUNCE_WAIT_MS) {
|
|
18686
|
+
const seconds = Math.ceil(waitMs / 1e3);
|
|
18687
|
+
warn?.(`waiting ${seconds} s to keep this profile's pace with ${name}`, {
|
|
18688
|
+
event: "warning",
|
|
18689
|
+
code: "pace_wait",
|
|
18690
|
+
operation,
|
|
18691
|
+
counts: { seconds }
|
|
18692
|
+
});
|
|
18693
|
+
}
|
|
18694
|
+
await (options2.sleep ?? ((ms) => new Promise((resolve7) => setTimeout(resolve7, ms))))(waitMs);
|
|
18695
|
+
}, "waitForTurn");
|
|
18696
|
+
|
|
18697
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/provider-call.js
|
|
18698
|
+
var RETRY = { retries: 3, baseDelayMs: 1e3, maxDelayMs: 1e4, maxRetryAfterMs: 3e4 };
|
|
18699
|
+
var UNANSWERED = /* @__PURE__ */ new Set(["timeout", "network_error", "provider_unavailable", "cancelled", "invalid_response"]);
|
|
18700
|
+
var unanswered = /* @__PURE__ */ __name((error) => !isCliError(error) || UNANSWERED.has(error.code) && error.details.sent !== false, "unanswered");
|
|
18701
|
+
var providerCall = /* @__PURE__ */ __name(async (options2) => {
|
|
18702
|
+
const retries = options2.retries ?? RETRY.retries;
|
|
18703
|
+
const sleep5 = options2.sleep ?? ((ms) => realSleep(ms));
|
|
18704
|
+
let refreshed = false;
|
|
18705
|
+
for (let attempt = 1; ; attempt++) {
|
|
18706
|
+
if (options2.pace)
|
|
18707
|
+
await waitForTurn(options2.pace.pacer, options2.pace);
|
|
18708
|
+
try {
|
|
18709
|
+
return await options2.send();
|
|
18710
|
+
} catch (error) {
|
|
18711
|
+
if (!refreshed && options2.refresh && isCliError(error) && error.code === "authentication_error" && error.details.reason === "oauth.expired") {
|
|
18712
|
+
refreshed = true;
|
|
18713
|
+
if (await options2.refresh())
|
|
18714
|
+
continue;
|
|
18715
|
+
throw error;
|
|
18716
|
+
}
|
|
18717
|
+
if (options2.write && unanswered(error))
|
|
18718
|
+
throw new CliError("outcome_unknown", `${error instanceof Error ? error.message : String(error)}; the CRM may or may not have carried it out`, { ...isCliError(error) ? error.details : {}, retryable: false });
|
|
18719
|
+
if (!isCliError(error))
|
|
18720
|
+
throw error;
|
|
18721
|
+
const asked = error.details.retry_after_ms;
|
|
18722
|
+
const wait = typeof asked === "number" ? asked : backoffMs(attempt, RETRY, options2.random ?? Math.random);
|
|
18723
|
+
const again = error.code === "rate_limited" || !options2.write && error.details.retryable === true;
|
|
18724
|
+
if (!again || wait > RETRY.maxRetryAfterMs || attempt > retries)
|
|
18725
|
+
throw error;
|
|
18726
|
+
if (error.code === "rate_limited")
|
|
18727
|
+
await options2.pace?.pacer.holdFor(wait);
|
|
18728
|
+
await sleep5(wait);
|
|
18729
|
+
}
|
|
18730
|
+
}
|
|
18731
|
+
}, "providerCall");
|
|
18732
|
+
|
|
18733
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/services/moment.js
|
|
18734
|
+
var read = /* @__PURE__ */ __name((reference, flag, now, at) => {
|
|
18735
|
+
const found = readMoment(reference, flag, { ...at, now });
|
|
18736
|
+
if (found === void 0)
|
|
18737
|
+
throw new CliError("validation_error", `${flag} takes an ISO 8601 time, today, yesterday, or 30m, 2h, 1d ago \u2014 not "${reference.trim()}"`);
|
|
18738
|
+
return found;
|
|
18739
|
+
}, "read");
|
|
18740
|
+
var momentOf = /* @__PURE__ */ __name((reference, flag = "--since", now = Date.now(), at = {}) => read(reference, flag, now, at).time, "momentOf");
|
|
18741
|
+
var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Date.now(), names: names2 = ["--since-time", "--until-time"] }) => {
|
|
18742
|
+
const at = zone === void 0 ? {} : { zone };
|
|
18743
|
+
const lower = sinceTime === void 0 ? void 0 : read(sinceTime, names2[0], now, at);
|
|
18744
|
+
const upper = untilTime === void 0 ? void 0 : read(untilTime, names2[1], now, { ...at, end: true });
|
|
18745
|
+
const since = lower?.time;
|
|
18746
|
+
const until = upper?.time;
|
|
18747
|
+
const readInZone = lower?.local === true || upper?.local === true;
|
|
18487
18748
|
const window3 = {
|
|
18488
|
-
...
|
|
18489
|
-
...
|
|
18749
|
+
...since === void 0 ? {} : { since: new Date(since).toISOString() },
|
|
18750
|
+
...until === void 0 ? {} : { until: new Date(until).toISOString() }
|
|
18490
18751
|
};
|
|
18491
18752
|
return {
|
|
18492
|
-
...
|
|
18493
|
-
...
|
|
18494
|
-
|
|
18495
|
-
},
|
|
18496
|
-
|
|
18497
|
-
|
|
18498
|
-
|
|
18499
|
-
}
|
|
18500
|
-
var createMeetingSearchCommand = sharedCommand(createMeetingSearchCommandDefinition);
|
|
18501
|
-
var addMeetingSearchCommand = sharedCommand(addMeetingSearchCommandDefinition);
|
|
18753
|
+
...since === void 0 ? {} : { since },
|
|
18754
|
+
...until === void 0 ? {} : { until },
|
|
18755
|
+
meta: {
|
|
18756
|
+
...readInZone ? { timezone: timezoneOf(zone) } : {},
|
|
18757
|
+
...since === void 0 && until === void 0 ? {} : { window: window3 }
|
|
18758
|
+
}
|
|
18759
|
+
};
|
|
18760
|
+
}, "dateWindow");
|
|
18502
18761
|
|
|
18503
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/meetings/cli/
|
|
18504
|
-
var
|
|
18505
|
-
var
|
|
18506
|
-
|
|
18507
|
-
|
|
18508
|
-
|
|
18509
|
-
}, "integer");
|
|
18510
|
-
var lookbackDays = /* @__PURE__ */ __name((text3) => {
|
|
18511
|
-
if (!/^(0|[1-9]\d*)$/.test(text3) || Number(text3) > 31)
|
|
18512
|
-
throw new InvalidArgumentError("expected an integer from 0 through 31 days");
|
|
18762
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/meetings/cli/management.js
|
|
18763
|
+
var REMOTE_READ = { remote: "read", local: "read" };
|
|
18764
|
+
var REMOTE_WRITE = { remote: "write", local: "write" };
|
|
18765
|
+
var minutes = /* @__PURE__ */ __name((text3) => {
|
|
18766
|
+
if (!/^[1-9]\d*$/.test(text3))
|
|
18767
|
+
throw new InvalidArgumentError("expected whole minutes");
|
|
18513
18768
|
return Number(text3);
|
|
18514
|
-
}, "
|
|
18515
|
-
var
|
|
18516
|
-
|
|
18517
|
-
|
|
18518
|
-
if (!
|
|
18519
|
-
throw new InvalidArgumentError("expected
|
|
18520
|
-
return
|
|
18521
|
-
}, "
|
|
18522
|
-
var
|
|
18523
|
-
var
|
|
18524
|
-
|
|
18525
|
-
|
|
18526
|
-
|
|
18527
|
-
const
|
|
18528
|
-
|
|
18529
|
-
|
|
18530
|
-
|
|
18531
|
-
|
|
18532
|
-
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
const
|
|
18769
|
+
}, "minutes");
|
|
18770
|
+
var setting = /* @__PURE__ */ __name((text3, previous = []) => {
|
|
18771
|
+
const at = text3.indexOf("=");
|
|
18772
|
+
const name = text3.slice(0, at);
|
|
18773
|
+
if (at < 1 || !SNAKE_CASE.test(name))
|
|
18774
|
+
throw new InvalidArgumentError("expected name=value with a snake_case name, such as access_type=trusted");
|
|
18775
|
+
return [...previous, [name, text3.slice(at + 1)]];
|
|
18776
|
+
}, "setting");
|
|
18777
|
+
var valuesOf = /* @__PURE__ */ __name((one) => one.type === "choice" ? one.values.join("|") : one.type === "boolean" ? "true|false" : "<text>", "valuesOf");
|
|
18778
|
+
var changeOptions = /* @__PURE__ */ __name((command, declared, create) => {
|
|
18779
|
+
const settings = declared.settings.length ? declared.settings.map((one) => `${one.name}=${valuesOf(one)}`).join(", ") : "this service has none";
|
|
18780
|
+
const takes = declared.fields.map(meetingFieldFlag).join(", ") || "none of the options above";
|
|
18781
|
+
const schedules = declared.fields.includes("startTime");
|
|
18782
|
+
const start = !create ? "" : !schedules ? "; this service takes none, its meetings start now" : declared.fields.includes("kind") ? "; for a meeting that starts now, give --kind instant instead" : "";
|
|
18783
|
+
return command.option("--title <title>", "the meeting's title").addOption(new Option("--kind <kind>", "an instant or a scheduled meeting").choices(["instant", "scheduled"])).option("--start-time <time>", `when it starts: an ISO time with its offset, 2026-11-20T10:00:00+01:00${start}`).option("--duration-minutes <minutes>", "how long it lasts, 1\u20131440", minutes).option("--timezone <zone>", "its IANA time zone, Europe/Madrid").option("--agenda <text>", "its agenda").option("--setting <name=value>", `a setting of this service; repeat it for more: ${settings}`, setting).addHelpText("after", [
|
|
18784
|
+
"",
|
|
18785
|
+
`This service takes ${takes}.`,
|
|
18786
|
+
...declared.settings.length ? ["Its settings:", ...declared.settings.map((one) => ` ${one.name}=${valuesOf(one)} ${one.description}`)] : []
|
|
18787
|
+
].join("\n"));
|
|
18788
|
+
}, "changeOptions");
|
|
18789
|
+
var changeOf = /* @__PURE__ */ __name((flags) => {
|
|
18790
|
+
const change = Object.fromEntries(MEETING_FIELDS.flatMap((key) => flags[key] === void 0 ? [] : [[key, flags[key]]]));
|
|
18791
|
+
if (!flags.setting)
|
|
18792
|
+
return change;
|
|
18793
|
+
const settings = /* @__PURE__ */ new Map();
|
|
18794
|
+
for (const [name, value] of flags.setting) {
|
|
18795
|
+
if (settings.has(name))
|
|
18796
|
+
throw new CliError("validation_error", `--setting ${name} is given twice`);
|
|
18797
|
+
settings.set(name, value);
|
|
18798
|
+
}
|
|
18799
|
+
return { ...change, settings: Object.fromEntries(settings) };
|
|
18800
|
+
}, "changeOf");
|
|
18801
|
+
var meetingOf = /* @__PURE__ */ __name((one) => ({
|
|
18802
|
+
id: one.id,
|
|
18803
|
+
title: one.title,
|
|
18804
|
+
kind: one.kind,
|
|
18805
|
+
start_time: one.startTime,
|
|
18806
|
+
duration_minutes: one.durationMinutes,
|
|
18807
|
+
timezone: one.timezone,
|
|
18808
|
+
agenda: one.agenda,
|
|
18809
|
+
join_url: one.joinUrl
|
|
18810
|
+
}), "meetingOf");
|
|
18811
|
+
var receiptItem = /* @__PURE__ */ __name((receipt) => {
|
|
18812
|
+
const { change } = receipt;
|
|
18813
|
+
return {
|
|
18814
|
+
action: receipt.action,
|
|
18815
|
+
provider: receipt.scope.provider,
|
|
18816
|
+
account: receipt.scope.account,
|
|
18817
|
+
...receipt.id === void 0 ? {} : { id: receipt.id },
|
|
18818
|
+
...receipt.occurrenceId === void 0 ? {} : { occurrence_id: receipt.occurrenceId },
|
|
18819
|
+
...change ? {
|
|
18820
|
+
change: {
|
|
18821
|
+
...Object.fromEntries(MEETING_FIELDS.flatMap((key) => change[key] === void 0 ? [] : [[MEETING_FIELD_KEYS[key], change[key]]])),
|
|
18822
|
+
...change.settings === void 0 ? {} : { settings: { ...change.settings } }
|
|
18823
|
+
}
|
|
18824
|
+
} : {},
|
|
18825
|
+
applied: receipt.applied,
|
|
18826
|
+
...receipt.meeting ? { meeting: meetingOf(receipt.meeting), untrusted: ["meeting.title", "meeting.agenda", "meeting.join_url"] } : {}
|
|
18827
|
+
};
|
|
18828
|
+
}, "receiptItem");
|
|
18829
|
+
var addMeetingManagementCommands = /* @__PURE__ */ __name((group, deps) => {
|
|
18830
|
+
const { management, print, output, inRun, askFirst } = deps;
|
|
18831
|
+
const signalled = /* @__PURE__ */ __name(() => {
|
|
18536
18832
|
const signal = deps.signal?.();
|
|
18537
|
-
return {
|
|
18538
|
-
|
|
18539
|
-
|
|
18540
|
-
|
|
18541
|
-
|
|
18542
|
-
|
|
18543
|
-
|
|
18544
|
-
|
|
18545
|
-
|
|
18546
|
-
|
|
18547
|
-
|
|
18548
|
-
|
|
18549
|
-
|
|
18550
|
-
|
|
18551
|
-
|
|
18552
|
-
|
|
18833
|
+
return signal ? { signal } : {};
|
|
18834
|
+
}, "signalled");
|
|
18835
|
+
const has = /* @__PURE__ */ __name((name) => management.capabilities.includes(name), "has");
|
|
18836
|
+
const mutation = /* @__PURE__ */ __name((command) => ({
|
|
18837
|
+
apply: true,
|
|
18838
|
+
dryRun: command.optsWithGlobals().dryRun === true,
|
|
18839
|
+
...signalled(),
|
|
18840
|
+
confirm: /* @__PURE__ */ __name(async () => {
|
|
18841
|
+
if (!askFirst)
|
|
18842
|
+
throw new CliError("configuration_error", "this tool cannot ask before it changes a meeting on the service");
|
|
18843
|
+
await askFirst(command);
|
|
18844
|
+
}, "confirm")
|
|
18845
|
+
}), "mutation");
|
|
18846
|
+
const write = /* @__PURE__ */ __name((name) => annotate(group.command(name), { effects: REMOTE_WRITE, offline: false, output: { entity: "meeting_change" } }), "write");
|
|
18847
|
+
const target2 = /* @__PURE__ */ __name((command) => command.argument("<meeting>", "the service's id of the meeting"), "target");
|
|
18848
|
+
if (has("create"))
|
|
18849
|
+
output(changeOptions(write("create").description("create a meeting on the service"), management.fields.create, true)).action(async (flags, command) => inRun(command, async () => print({ item: receiptItem(await management.create(changeOf(flags), mutation(command))) }, command)));
|
|
18850
|
+
if (has("update"))
|
|
18851
|
+
output(changeOptions(target2(write("update").description("change a meeting on the service")), management.fields.update, false)).action(async (id3, flags, command) => inRun(command, async () => print({ item: receiptItem(await management.update(id3, changeOf(flags), mutation(command))) }, command)));
|
|
18852
|
+
if (has("cancel"))
|
|
18853
|
+
output(target2(write("cancel").description("cancel a meeting on the service")).option("--occurrence-id <id>", "cancel only this occurrence of a repeating meeting")).action(async (id3, flags, command) => inRun(command, async () => print({
|
|
18854
|
+
item: receiptItem(await management.cancel(id3, {
|
|
18855
|
+
...mutation(command),
|
|
18856
|
+
...flags.occurrenceId === void 0 ? {} : { occurrenceId: flags.occurrenceId }
|
|
18857
|
+
}))
|
|
18858
|
+
}, command)));
|
|
18859
|
+
if (has("invitation"))
|
|
18860
|
+
output(target2(annotate(group.command("invitation"), {
|
|
18861
|
+
effects: REMOTE_READ,
|
|
18862
|
+
offline: false,
|
|
18863
|
+
output: { entity: "meeting_invitation" }
|
|
18864
|
+
}).description("the invitation text the service writes for a meeting"))).action(async (id3, _flags, command) => inRun(command, async () => print({ item: { ...await management.invitation(id3, signalled()), untrusted: ["invitation"] } }, command)));
|
|
18865
|
+
}, "addMeetingManagementCommands");
|
|
18866
|
+
|
|
18867
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/meetings/cli/query-options.js
|
|
18868
|
+
var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
|
|
18869
|
+
command.allowUnknownOption();
|
|
18870
|
+
const parse2 = command.parseOptions.bind(command);
|
|
18871
|
+
command.parseOptions = (args) => {
|
|
18872
|
+
const parsed = parse2(args);
|
|
18873
|
+
const end = parsed.unknown.indexOf("--");
|
|
18874
|
+
const help = command._getHelpOption();
|
|
18875
|
+
const typo = parsed.unknown.slice(0, end < 0 ? void 0 : end).find((word) => word.startsWith("--") && !help?.is(word));
|
|
18876
|
+
if (typo !== void 0) {
|
|
18877
|
+
command.allowUnknownOption(false);
|
|
18878
|
+
command.unknownOption(typo);
|
|
18879
|
+
}
|
|
18880
|
+
if (end >= 0)
|
|
18881
|
+
parsed.unknown.splice(end, 1);
|
|
18882
|
+
return parsed;
|
|
18883
|
+
};
|
|
18884
|
+
return command;
|
|
18885
|
+
}, "queryWordsAfterOptions");
|
|
18886
|
+
|
|
18887
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/meetings/cli/passage.js
|
|
18888
|
+
var count = /* @__PURE__ */ __name((value) => {
|
|
18889
|
+
if (!/^(0|[1-9]\d*)$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
18890
|
+
throw new CliError("validation_error", "expected a nonnegative safe integer");
|
|
18891
|
+
return Number(value);
|
|
18892
|
+
}, "count");
|
|
18893
|
+
var meetingPassageRequest = /* @__PURE__ */ __name((reference, options2, signal) => {
|
|
18894
|
+
const input = {
|
|
18895
|
+
before: options2.beforeN,
|
|
18896
|
+
after: options2.afterN,
|
|
18897
|
+
bytes: options2.bytes,
|
|
18898
|
+
max_read_bytes: options2.maxReadBytes,
|
|
18899
|
+
expected_fingerprint: options2.expectedFingerprint,
|
|
18900
|
+
format: options2.format ?? "text",
|
|
18901
|
+
signal
|
|
18902
|
+
};
|
|
18903
|
+
validateMeetingPassage(reference, input);
|
|
18904
|
+
signal?.throwIfAborted();
|
|
18905
|
+
return input;
|
|
18906
|
+
}, "meetingPassageRequest");
|
|
18907
|
+
var createMeetingPassageCommandDefinition = /* @__PURE__ */ __name((program) => {
|
|
18908
|
+
const meetings = program.commands.find((command) => command.name() === "meetings");
|
|
18909
|
+
if (!meetings)
|
|
18910
|
+
throw new CliError("configuration_error", "meeting command group is unavailable");
|
|
18911
|
+
return annotate(meetings.command("passage").description("read a cited cue with bounded context before and after it").argument("<reference>", "retained transcript cue reference from a search hit").option("--before-n <n>", "preceding cues (default 3)", count).option("--after-n <n>", "following cues (default 3); at most 999 surrounding cues in total", count).option("--bytes <bytes>", "cue JSON byte budget (default 65536); the anchor must fit", count).option("--max-read-bytes <bytes>", "stored text byte budget (default 4194304); boundary probes read metadata only", count).option("--expected-fingerprint <hash>", "reject a changed anchor using its previously read cue fingerprint").addOption(new Option("--format <format>", "compact text, Markdown or structured JSON").choices(["text", "markdown", "json"]).default("text")), {
|
|
18912
|
+
origin: "handwritten",
|
|
18913
|
+
effects: { remote: "none", local: "read" },
|
|
18914
|
+
output: { entity: "meeting_passage" },
|
|
18915
|
+
examples: [`${program.name()} meetings passage meeting:1/1/1/0 --json`]
|
|
18553
18916
|
});
|
|
18554
|
-
|
|
18555
|
-
|
|
18556
|
-
|
|
18557
|
-
|
|
18558
|
-
|
|
18559
|
-
|
|
18560
|
-
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
|
|
18565
|
-
|
|
18917
|
+
}, "createMeetingPassageCommandDefinition");
|
|
18918
|
+
var addMeetingPassageCommandDefinition = /* @__PURE__ */ __name((program, deps) => createMeetingPassageCommand(program).action(async (reference, options2, command) => {
|
|
18919
|
+
const globals = command.optsWithGlobals();
|
|
18920
|
+
const format = globals.json || globals.jsonl ? "json" : options2.format ?? "text";
|
|
18921
|
+
const input = meetingPassageRequest(reference, { ...options2, format }, deps.signal());
|
|
18922
|
+
const result = markedPassage(await deps.read(reference, input));
|
|
18923
|
+
input.signal?.throwIfAborted();
|
|
18924
|
+
deps.output(result, format);
|
|
18925
|
+
}), "addMeetingPassageCommandDefinition");
|
|
18926
|
+
var createMeetingPassageCommand = sharedCommand(createMeetingPassageCommandDefinition);
|
|
18927
|
+
var addMeetingPassageCommand = sharedCommand(addMeetingPassageCommandDefinition);
|
|
18928
|
+
|
|
18929
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/meetings/cli/project-evidence.js
|
|
18930
|
+
var integer2 = /* @__PURE__ */ __name((value) => {
|
|
18931
|
+
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
18932
|
+
throw new CliError("validation_error", "expected a positive safe integer");
|
|
18933
|
+
return Number(value);
|
|
18934
|
+
}, "integer");
|
|
18935
|
+
var addMeetingProjectEvidenceCommandDefinition = /* @__PURE__ */ __name((program, deps) => {
|
|
18936
|
+
const group = program.commands.find((command) => command.name() === "meetings");
|
|
18937
|
+
if (!group)
|
|
18938
|
+
throw new CliError("configuration_error", "meeting command group is unavailable");
|
|
18939
|
+
const projects = group.commands.find((command) => command.name() === "projects") ?? group.command("projects").description("project-name evidence in stored meetings");
|
|
18940
|
+
return annotate(queryWordsAfterOptions(projects.command("evidence").description("find cited project-name and alias evidence in the local meeting index; does not refresh it or confirm membership")).argument("<project>", "existing project name, key or explicit alias").argument("[query...]", "exact ID fields and a UTC started_at range, joined by AND").addHelpText("after", `
|
|
18941
|
+
${fieldsHelp(MEETING_PROJECT_EVIDENCE_QUERY)}`).option("--limit <n>", "hits in one name page, 1 through 1000 (default 100)", integer2).option("--cursor <cursor>", "continue with the same project and frozen selection from next").option("--max-read-bytes <bytes>", "word-read byte budget, at most 67108864 (default 4194304)", integer2).action(async (project, words3, options2) => {
|
|
18942
|
+
deps.output(await readMeetingProjectEvidence(deps.read, project, { ...options2, query: words3.join(" "), signal: deps.signal() }, deps.now?.()));
|
|
18943
|
+
}), {
|
|
18944
|
+
origin: "handwritten",
|
|
18945
|
+
effects: { remote: "none", local: "read" },
|
|
18946
|
+
query: MEETING_PROJECT_EVIDENCE_QUERY,
|
|
18947
|
+
output: { entity: "meeting_project_evidence" }
|
|
18948
|
+
});
|
|
18949
|
+
}, "addMeetingProjectEvidenceCommandDefinition");
|
|
18950
|
+
var addMeetingProjectEvidenceCommand = sharedCommand(addMeetingProjectEvidenceCommandDefinition);
|
|
18951
|
+
|
|
18952
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/meetings/cli/search.js
|
|
18953
|
+
var moment = /* @__PURE__ */ __name((flag, end, readIn) => (value) => {
|
|
18954
|
+
const { since, until, meta } = dateWindow(end ? { untilTime: value, names: [flag, flag] } : { sinceTime: value, names: [flag, flag] });
|
|
18955
|
+
if (meta.timezone)
|
|
18956
|
+
readIn(meta.timezone);
|
|
18957
|
+
return end ? until : since;
|
|
18958
|
+
}, "moment");
|
|
18959
|
+
var integer3 = /* @__PURE__ */ __name((value) => {
|
|
18960
|
+
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
18961
|
+
throw new CliError("validation_error", "expected a positive safe integer");
|
|
18962
|
+
return Number(value);
|
|
18963
|
+
}, "integer");
|
|
18964
|
+
var createMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program) => {
|
|
18965
|
+
let search = program.commands.find((command2) => command2.name() === "search");
|
|
18966
|
+
if (!search) {
|
|
18967
|
+
search = new Command("search").description("search the stored resources");
|
|
18968
|
+
program.addCommand(search);
|
|
18969
|
+
}
|
|
18970
|
+
const readIn = /* @__PURE__ */ __name((zone) => command.setOptionValue("timesReadIn", zone), "readIn");
|
|
18971
|
+
const command = search.command("meetings").description("find words in stored meetings, indexing new ones first").argument("<query>", 'words, OR, (groups), -word, "a phrase", "a b"~N (within N lines), exact:word, from:"Name" (who said the line); date>=30d, project:, tag:, topic: choose meetings; a word also matches its other forms and spellings speech recognition garbled').option("--meeting-id <id>", "only this stored meeting", integer3).option("--identity-id <id>", "meetings with this participant identity; does not say who spoke a hit", integer3).option("--person-id <id>", "meetings with a participant linked to this person", integer3).option("--event-id <id>", "only meetings linked to this stored event", integer3).option("--series-id <id>", "only meetings in this stored series", integer3).option("--project <project>", "meetings confirmed in this project, by name, key or alias").option("--tag <name>", "meetings with this tag, by name or alias").option("--topic-name <name>", "meetings with this topic, by name or alias").option("--since-time <time>", "meetings starting at or after this ISO 8601 date or time, or 30m, 2h, 7d ago", moment("--since-time", false, readIn)).option("--until-time <time>", "meetings starting at or before this ISO 8601 date or time; a date alone covers that whole local day", moment("--until-time", true, readIn)).option("--limit <n>", "how many hits, 1 through 1000; the profile's defaults.limit when absent", integer3).option("--cursor <cursor>", "continue from the previous page's page.next_cursor, with the same query and filters").option("--max-read-bytes <bytes>", "most stored bytes to read, 1 through 67108864 (default 4194304)", integer3);
|
|
18972
|
+
annotate(command, {
|
|
18973
|
+
origin: "handwritten",
|
|
18974
|
+
effects: { remote: "none", local: "read" },
|
|
18975
|
+
output: { entity: "meeting_hit" }
|
|
18976
|
+
});
|
|
18977
|
+
return command;
|
|
18978
|
+
}, "createMeetingSearchCommandDefinition");
|
|
18979
|
+
var meetingHitSearchRequest = /* @__PURE__ */ __name((query, options2, limit, signal) => {
|
|
18980
|
+
const request = {
|
|
18981
|
+
meetingId: options2.meetingId,
|
|
18982
|
+
participantIdentityId: options2.identityId,
|
|
18983
|
+
personId: options2.personId,
|
|
18984
|
+
eventId: options2.eventId,
|
|
18985
|
+
meetingSeriesId: options2.seriesId,
|
|
18986
|
+
project: options2.project,
|
|
18987
|
+
tag: options2.tag,
|
|
18988
|
+
topic: options2.topicName ?? options2.topic,
|
|
18989
|
+
since: options2.sinceTime,
|
|
18990
|
+
until: options2.untilTime,
|
|
18991
|
+
limit: options2.limit ?? limit,
|
|
18992
|
+
after: options2.cursor,
|
|
18993
|
+
maxReadBytes: options2.maxReadBytes,
|
|
18994
|
+
signal
|
|
18995
|
+
};
|
|
18996
|
+
validateMeetingHitSearch(query, request);
|
|
18997
|
+
signal?.throwIfAborted();
|
|
18998
|
+
return request;
|
|
18999
|
+
}, "meetingHitSearchRequest");
|
|
19000
|
+
var meetingSearchArguments = /* @__PURE__ */ __name((query, options2) => Object.fromEntries(Object.entries({
|
|
19001
|
+
query,
|
|
19002
|
+
meeting_id: options2.meetingId?.toString(),
|
|
19003
|
+
identity_id: options2.identityId?.toString(),
|
|
19004
|
+
person_id: options2.personId?.toString(),
|
|
19005
|
+
event_id: options2.eventId?.toString(),
|
|
19006
|
+
series_id: options2.seriesId?.toString(),
|
|
19007
|
+
project: options2.project,
|
|
19008
|
+
tag: options2.tag,
|
|
19009
|
+
topic_name: options2.topicName ?? options2.topic,
|
|
19010
|
+
since_time: options2.sinceTime === void 0 ? void 0 : new Date(options2.sinceTime).toISOString(),
|
|
19011
|
+
until_time: options2.untilTime === void 0 ? void 0 : new Date(options2.untilTime).toISOString(),
|
|
19012
|
+
max_read_bytes: options2.maxReadBytes ?? 4194304
|
|
19013
|
+
}).filter(([, value]) => value !== void 0)), "meetingSearchArguments");
|
|
19014
|
+
var meetingSearchMeta = /* @__PURE__ */ __name((options2) => {
|
|
19015
|
+
const window3 = {
|
|
19016
|
+
...options2.sinceTime === void 0 ? {} : { since: new Date(options2.sinceTime).toISOString() },
|
|
19017
|
+
...options2.untilTime === void 0 ? {} : { until: new Date(options2.untilTime).toISOString() }
|
|
19018
|
+
};
|
|
19019
|
+
return {
|
|
19020
|
+
...options2.timesReadIn === void 0 ? {} : { timezone: options2.timesReadIn },
|
|
19021
|
+
...Object.keys(window3).length === 0 ? {} : { window: window3 }
|
|
19022
|
+
};
|
|
19023
|
+
}, "meetingSearchMeta");
|
|
19024
|
+
var addMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program, deps) => createMeetingSearchCommand(program).action(async (query, options2, command) => {
|
|
19025
|
+
const request = meetingHitSearchRequest(query, options2, deps.pagingOf(command).limit, deps.signal());
|
|
19026
|
+
deps.output(meetingHitsList(await deps.search(query, request, options2), request.limit, "search meetings", meetingSearchArguments(query, options2), meetingSearchMeta(options2)));
|
|
19027
|
+
}), "addMeetingSearchCommandDefinition");
|
|
19028
|
+
var createMeetingSearchCommand = sharedCommand(createMeetingSearchCommandDefinition);
|
|
19029
|
+
var addMeetingSearchCommand = sharedCommand(addMeetingSearchCommandDefinition);
|
|
19030
|
+
|
|
19031
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/meetings/cli/index.js
|
|
19032
|
+
var EVENT_UNTRUSTED = ["title", "description", "location"];
|
|
19033
|
+
var integer4 = /* @__PURE__ */ __name((text3) => {
|
|
19034
|
+
if (!/^[1-9]\d*$/.test(text3) || !Number.isSafeInteger(Number(text3)))
|
|
19035
|
+
throw new InvalidArgumentError("expected a positive integer");
|
|
19036
|
+
return Number(text3);
|
|
19037
|
+
}, "integer");
|
|
19038
|
+
var lookbackDays = /* @__PURE__ */ __name((text3) => {
|
|
19039
|
+
if (!/^(0|[1-9]\d*)$/.test(text3) || Number(text3) > 31)
|
|
19040
|
+
throw new InvalidArgumentError("expected an integer from 0 through 31 days");
|
|
19041
|
+
return Number(text3);
|
|
19042
|
+
}, "lookbackDays");
|
|
19043
|
+
var LOCAL_READ = { remote: "none", local: "read" };
|
|
19044
|
+
var REMOTE_READ2 = { remote: "read", local: "read" };
|
|
19045
|
+
var backendOf = /* @__PURE__ */ __name((value) => {
|
|
19046
|
+
if (!BACKENDS.includes(value))
|
|
19047
|
+
throw new InvalidArgumentError("expected archive, server or both");
|
|
19048
|
+
return value;
|
|
19049
|
+
}, "backendOf");
|
|
19050
|
+
var backendOption = /* @__PURE__ */ __name((command) => command.option("--backend <archive|server|both>", "where to read: the store (archive), the service (server), or both, kept in the store (default: both)", backendOf), "backendOption");
|
|
19051
|
+
var BACKEND_HELP = "--backend both asks the service with the part of the query it can filter, keeps what it returns, then runs the whole query over the store; each item says found_in archive, server or both. --offline reads the store only.";
|
|
19052
|
+
var LOCAL_WRITE = { remote: "none", local: "write" };
|
|
19053
|
+
var FETCH = { remote: "read", local: "write" };
|
|
19054
|
+
var addMeetingCommandsDefinition = /* @__PURE__ */ __name((program, deps) => {
|
|
19055
|
+
const group = annotate(program.command("meetings").description("stored meetings and their records"), {
|
|
19056
|
+
effects: { remote: "none", local: "none" }
|
|
19057
|
+
});
|
|
19058
|
+
const output = /* @__PURE__ */ __name((command) => command, "output");
|
|
19059
|
+
const print = /* @__PURE__ */ __name((value, command) => {
|
|
19060
|
+
const opts = command.optsWithGlobals();
|
|
19061
|
+
deps.write(value, opts.json ? "json" : opts.jsonl ? "jsonl" : "text");
|
|
19062
|
+
}, "print");
|
|
19063
|
+
const access = /* @__PURE__ */ __name((command, backend) => {
|
|
19064
|
+
const signal = deps.signal?.();
|
|
19065
|
+
return {
|
|
19066
|
+
...backend === void 0 ? {} : { backend },
|
|
19067
|
+
offline: command.optsWithGlobals().offline === true,
|
|
19068
|
+
timezone: timezoneOf(deps.timezone),
|
|
19069
|
+
...deps.now ? { now: deps.now() } : {},
|
|
19070
|
+
...signal ? { signal } : {}
|
|
19071
|
+
};
|
|
19072
|
+
}, "access");
|
|
19073
|
+
const list2 = queryWordsAfterOptions(group.command("list").description("meetings, newest first: the service's and the stored ones, kept in the store")).argument("[query...]", "field:value terms that narrow the list \u2014 the fields are below").addHelpText("after", `
|
|
19074
|
+
${fieldsHelp(MEETING_QUERY, MEETING_QUERY_GUIDE)}
|
|
19075
|
+
${BACKEND_HELP}`);
|
|
19076
|
+
annotate(list2, {
|
|
19077
|
+
effects: REMOTE_READ2,
|
|
19078
|
+
partial: true,
|
|
19079
|
+
query: defineQuery(MEETING_QUERY),
|
|
19080
|
+
output: { entity: "meeting" }
|
|
19081
|
+
});
|
|
19082
|
+
backendOption(output(list2)).option("--limit <n>", "meetings per page; the profile's defaults.limit when absent", integer4).option("--page <n>", "which page, starting at 1", integer4).action(async (words3, opts, command) => {
|
|
19083
|
+
const query = meetingsQuery(words3.join(" "));
|
|
19084
|
+
const { limit, page } = deps.pagingOf(command);
|
|
19085
|
+
await deps.inRun(command, async () => {
|
|
19086
|
+
const { server: _server, ...answer } = await meetingsListThrough(deps.source, deps.store, {
|
|
19087
|
+
accountId: deps.accountId,
|
|
19088
|
+
limit,
|
|
19089
|
+
offset: (page - 1) * limit,
|
|
19090
|
+
...query ? { query } : {}
|
|
19091
|
+
}, access(command, opts.backend));
|
|
19092
|
+
print(answer, command);
|
|
19093
|
+
});
|
|
18566
19094
|
});
|
|
18567
19095
|
backendOption(output(annotate(group.command("show"), { effects: REMOTE_READ2, partial: true, output: { entity: "meeting_details" } }).description("show a meeting, read again from the service with its people, transcript and documents").argument("<meeting>", "the stored meeting's number, its meeting: ref, or the service's id (provider_id)").addHelpText("after", `${SAVE_HELP}
|
|
18568
19096
|
${BACKEND_HELP}`))).action(async (meeting, opts, command) => {
|
|
@@ -18641,695 +19169,192 @@ ${BACKEND_HELP}`))).action(async (meeting, opts, command) => {
|
|
|
18641
19169
|
importCommand.addHelpText("after", `
|
|
18642
19170
|
${deps.importHelp}`);
|
|
18643
19171
|
output(importCommand).action(async (folder, _opts, command) => {
|
|
18644
|
-
if (!deps.readFiles)
|
|
18645
|
-
throw new MeetingError("configuration_error", "file reader is unavailable");
|
|
18646
|
-
const files = await deps.readFiles(folder);
|
|
18647
|
-
if (files.some((file) => file.meeting.accountId !== deps.accountId))
|
|
18648
|
-
throw new MeetingError("validation_error", "file account differs from selected account");
|
|
18649
|
-
print(await importFiles(files, deps.store, deps.now?.()), command);
|
|
18650
|
-
});
|
|
18651
|
-
output(annotate(group.command("repair"), {
|
|
18652
|
-
effects: LOCAL_WRITE,
|
|
18653
|
-
output: { entity: "meeting_repair" }
|
|
18654
|
-
}).description("preview filling in what older builds left out of stored transcripts (their language); --yes stores it")).option("--yes", "store the detected languages; otherwise only preview").action(async (opts, command) => {
|
|
18655
|
-
if (!deps.store.fillTranscriptLanguages)
|
|
18656
|
-
throw new MeetingError("configuration_error", "this store cannot fill transcript languages");
|
|
18657
|
-
print(await deps.store.fillTranscriptLanguages({
|
|
18658
|
-
accountId: deps.accountId,
|
|
18659
|
-
apply: opts.yes === true,
|
|
18660
|
-
now: deps.now?.() ?? Date.now()
|
|
18661
|
-
}), command);
|
|
18662
|
-
});
|
|
18663
|
-
if (deps.management)
|
|
18664
|
-
addMeetingManagementCommands(group, {
|
|
18665
|
-
management: deps.management,
|
|
18666
|
-
print,
|
|
18667
|
-
output,
|
|
18668
|
-
inRun: deps.inRun,
|
|
18669
|
-
...deps.askFirst ? { askFirst: deps.askFirst } : {},
|
|
18670
|
-
...deps.signal ? { signal: deps.signal } : {}
|
|
18671
|
-
});
|
|
18672
|
-
const eventList = queryWordsAfterOptions(annotate(program.command("events").description("the owner's stored events"), {
|
|
18673
|
-
effects: { remote: "none", local: "none" }
|
|
18674
|
-
}).command("list")).description("list stored events").argument("[query...]", "event id, origin or time fields that narrow the list").addHelpText("after", `
|
|
18675
|
-
${fieldsHelp(EVENT_QUERY, MEETING_QUERY_GUIDE)}`);
|
|
18676
|
-
annotate(eventList, { effects: LOCAL_READ, output: { entity: "event" }, query: EVENT_QUERY });
|
|
18677
|
-
output(eventList).action(async (words3, _opts, command) => {
|
|
18678
|
-
const query = words3.length ? parseLucene(words3.join(" "), { defaultField: "none", command: "events list" }) : void 0;
|
|
18679
|
-
if (query)
|
|
18680
|
-
validateQuery(query, EVENT_QUERY, { command: "events list" });
|
|
18681
|
-
if (query && !deps.store.queryEvents)
|
|
18682
|
-
throw new MeetingError("validation_error", "this store cannot filter events");
|
|
18683
|
-
const events = query ? await deps.store.queryEvents?.(query) : await deps.store.events();
|
|
18684
|
-
print(listed((events ?? []).map((one) => ({ ...eventItem(one), untrusted: [...EVENT_UNTRUSTED] }))), command);
|
|
18685
|
-
});
|
|
18686
|
-
}, "addMeetingCommandsDefinition");
|
|
18687
|
-
var addMeetingCommands = sharedCommand(addMeetingCommandsDefinition);
|
|
18688
|
-
|
|
18689
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/cli/list-query.js
|
|
18690
|
-
var LIST_QUERY_GUIDE = "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md";
|
|
18691
|
-
var QUERY_ARGUMENT = "field:value terms that narrow the list \u2014 the fields are below";
|
|
18692
|
-
var withQuery = /* @__PURE__ */ __name((command, registry) => {
|
|
18693
|
-
const query = defineQuery(registry);
|
|
18694
|
-
annotate(command, { query, output: { entity: registry.entity } });
|
|
18695
|
-
const shown = askable(query);
|
|
18696
|
-
queryWordsAfterOptions(command).argument("[query...]", shown.length > 0 ? QUERY_ARGUMENT : "field:value terms; this list filters by none yet");
|
|
18697
|
-
if (shown.length > 0)
|
|
18698
|
-
command.addHelpText("after", `
|
|
18699
|
-
${fieldsHelp({ ...query, fields: shown }, LIST_QUERY_GUIDE)}`);
|
|
18700
|
-
return command;
|
|
18701
|
-
}, "withQuery");
|
|
18702
|
-
var unfilteredQuery = /* @__PURE__ */ __name((entity, schema2) => ({
|
|
18703
|
-
entity,
|
|
18704
|
-
backend: "native",
|
|
18705
|
-
fields: queryFieldsOf(schema2, {})
|
|
18706
|
-
}), "unfilteredQuery");
|
|
18707
|
-
var commandPath = /* @__PURE__ */ __name((command) => {
|
|
18708
|
-
const words3 = [];
|
|
18709
|
-
for (let at = command; at?.parent; at = at.parent)
|
|
18710
|
-
words3.unshift(at.name());
|
|
18711
|
-
return words3.join(" ");
|
|
18712
|
-
}, "commandPath");
|
|
18713
|
-
var withTomorrow = /* @__PURE__ */ __name((query, registry, zone = timezoneOf(), now = Date.now()) => {
|
|
18714
|
-
const times = new Set(registry.fields.filter(({ type }) => type === "time").map(({ name }) => name));
|
|
18715
|
-
const date = /* @__PURE__ */ new Date(`${new Intl.DateTimeFormat("en-CA", { timeZone: zone }).format(now)}T00:00:00Z`);
|
|
18716
|
-
date.setUTCDate(date.getUTCDate() + 1);
|
|
18717
|
-
const tomorrow = date.toISOString().slice(0, 10);
|
|
18718
|
-
const day2 = /* @__PURE__ */ __name((value) => value.toLowerCase() === "tomorrow" ? tomorrow : value, "day");
|
|
18719
|
-
const map = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? times.has(node.field) ? { ...node, value: day2(node.value), ...node.upper === void 0 ? {} : { upper: day2(node.upper) } } : node : { ...node, clauses: node.clauses.map((clause) => ({ ...clause, node: map(clause.node) })) }, "map");
|
|
18720
|
-
return { ...query, root: map(query.root) };
|
|
18721
|
-
}, "withTomorrow");
|
|
18722
|
-
var listQuery = /* @__PURE__ */ __name((text3, registry, command, { defaultField = "none" } = {}) => {
|
|
18723
|
-
const context2 = { command, guide: LIST_QUERY_GUIDE };
|
|
18724
|
-
const signed = text3.replace(/(^|[\s(])([\p{L}_][\p{L}\p{N}_.]*:)\+([^\s()"]+)/gu, '$1$2"+$3"');
|
|
18725
|
-
const parsed = signed.trim() === "" ? void 0 : parseLucene(signed, { defaultField, ...context2 });
|
|
18726
|
-
const typed = parsed && withTomorrow(parsed, registry);
|
|
18727
|
-
if (typed)
|
|
18728
|
-
validateQuery(typed, registry, context2);
|
|
18729
|
-
const named3 = typed ? fieldsNamed(typed) : /* @__PURE__ */ new Set();
|
|
18730
|
-
const defaults = (registry.defaults ?? []).filter((term) => !named3.has(term.replace(/^-/, "").split(/[:<>=]/)[0] ?? "")).map((term) => parseLucene(term, { defaultField: "none", ...context2 }).root);
|
|
18731
|
-
const roots = [...typed ? [typed.root] : [], ...defaults];
|
|
18732
|
-
if (roots.length === 0)
|
|
18733
|
-
return void 0;
|
|
18734
|
-
if (roots.length === 1 && typed)
|
|
18735
|
-
return typed;
|
|
18736
|
-
return {
|
|
18737
|
-
version: 1,
|
|
18738
|
-
language: "lucene-v1",
|
|
18739
|
-
root: {
|
|
18740
|
-
kind: "boolean",
|
|
18741
|
-
clauses: roots.map((node) => ({ occur: "must", node })),
|
|
18742
|
-
span: { start: 0, end: text3.length }
|
|
18743
|
-
}
|
|
18744
|
-
};
|
|
18745
|
-
}, "listQuery");
|
|
18746
|
-
var typedQuery = /* @__PURE__ */ __name((words3) => typeof words3 === "string" ? words3 : (words3 ?? []).join(" "), "typedQuery");
|
|
18747
|
-
var EVERY = Number.MAX_SAFE_INTEGER - 1;
|
|
18748
|
-
var pageOf = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { limit: EVERY, offset: 0 } : { limit, offset: (page - 1) * limit }, "pageOf");
|
|
18749
|
-
var pagedList = /* @__PURE__ */ __name((command, { limit, page, all }, { items, hasMore, ...rest }) => listOf(command, {
|
|
18750
|
-
...rest,
|
|
18751
|
-
items,
|
|
18752
|
-
limit: all ? Math.max(1, items.length) : limit,
|
|
18753
|
-
has_more: all ? false : hasMore,
|
|
18754
|
-
page
|
|
18755
|
-
}), "pagedList");
|
|
18756
|
-
var askable = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "askable");
|
|
18757
|
-
var nativeTerms = /* @__PURE__ */ __name((ast, command) => new Map([...nativeTermLists(ast, command)].map(([field, [node]]) => [field, node])), "nativeTerms");
|
|
18758
|
-
var nativeTermLists = /* @__PURE__ */ __name((ast, command, repeatable = [], negatable = []) => {
|
|
18759
|
-
const terms = /* @__PURE__ */ new Map();
|
|
18760
|
-
if (!ast)
|
|
18761
|
-
return terms;
|
|
18762
|
-
const context2 = { command, guide: LIST_QUERY_GUIDE };
|
|
18763
|
-
const add = /* @__PURE__ */ __name((node) => {
|
|
18764
|
-
if (node.kind === "boolean") {
|
|
18765
|
-
for (const clause of node.clauses) {
|
|
18766
|
-
const excluded = clause.occur === "must_not" && clause.node.kind === "predicate" && negatable.includes(clause.node.field);
|
|
18767
|
-
if (excluded && clause.node.kind === "predicate") {
|
|
18768
|
-
const key = `-${clause.node.field}`;
|
|
18769
|
-
terms.set(key, [...terms.get(key) ?? [], clause.node]);
|
|
18770
|
-
continue;
|
|
18771
|
-
}
|
|
18772
|
-
if (clause.occur !== "must")
|
|
18773
|
-
queryError("query.unsupported-placement", clause.node.span, negatable.length ? `this list takes only field:value terms joined by AND, and -field:value for ${negatable.join(", ")}` : "this list takes only field:value terms joined by AND", context2);
|
|
18774
|
-
add(clause.node);
|
|
18775
|
-
}
|
|
18776
|
-
return;
|
|
18777
|
-
}
|
|
18778
|
-
const held = terms.get(node.field);
|
|
18779
|
-
if (held && !repeatable.includes(node.field))
|
|
18780
|
-
queryError("query.unsupported-placement", node.span, `${node.field} only once here`, context2);
|
|
18781
|
-
terms.set(node.field, [...held ?? [], node]);
|
|
18782
|
-
}, "add");
|
|
18783
|
-
add(ast.root);
|
|
18784
|
-
return terms;
|
|
18785
|
-
}, "nativeTermLists");
|
|
18786
|
-
var queryTerms = /* @__PURE__ */ __name((words3, registry, command, ranged = []) => {
|
|
18787
|
-
const terms = /* @__PURE__ */ new Map();
|
|
18788
|
-
for (const [field, node] of nativeTerms(listQuery(typedQuery(words3), registry, command), command)) {
|
|
18789
|
-
if (ranged.includes(field))
|
|
18790
|
-
continue;
|
|
18791
|
-
if (node.operator !== "term" && node.operator !== "phrase")
|
|
18792
|
-
queryError("query.unsupported-placement", node.span, `${field} takes one whole value here`, {
|
|
18793
|
-
command,
|
|
18794
|
-
guide: LIST_QUERY_GUIDE
|
|
18795
|
-
});
|
|
18796
|
-
const enumerated = registry.fields.find(({ name }) => name === field)?.type === "enum";
|
|
18797
|
-
terms.set(field, enumerated ? node.value.toLowerCase() : node.value);
|
|
18798
|
-
}
|
|
18799
|
-
return terms;
|
|
18800
|
-
}, "queryTerms");
|
|
18801
|
-
var timeBounds = /* @__PURE__ */ __name((term, zone = timezoneOf(), now) => {
|
|
18802
|
-
if (!term)
|
|
18803
|
-
return {};
|
|
18804
|
-
const upper = term.operator === "range" ? term.upper ?? "*" : term.value;
|
|
18805
|
-
const range3 = dateRange(term.value, upper, term.operator === "range" ? term.lower_inclusive !== false : true, term.operator === "range" ? term.upper_inclusive !== false : true, zone, term.span, now);
|
|
18806
|
-
const until = range3.upper === void 0 ? void 0 : range3.upper - (range3.upper_inclusive ? 0 : 1);
|
|
18807
|
-
return {
|
|
18808
|
-
...range3.lower === void 0 ? {} : { since: range3.lower },
|
|
18809
|
-
...until === void 0 ? {} : { until },
|
|
18810
|
-
meta: {
|
|
18811
|
-
timezone: zone,
|
|
18812
|
-
window: {
|
|
18813
|
-
...range3.lower === void 0 ? {} : { since: new Date(range3.lower).toISOString() },
|
|
18814
|
-
...until === void 0 ? {} : { until: new Date(until).toISOString() }
|
|
18815
|
-
}
|
|
18816
|
-
}
|
|
18817
|
-
};
|
|
18818
|
-
}, "timeBounds");
|
|
18819
|
-
var searchText = /* @__PURE__ */ __name((term) => term === void 0 ? void 0 : term.value.replace(/^\*+|\*+$/g, ""), "searchText");
|
|
18820
|
-
var nativeField = /* @__PURE__ */ __name((field) => ({ ...field, native: true }), "nativeField");
|
|
18821
|
-
var termField = /* @__PURE__ */ __name((name, type, example, more = {}) => nativeField({
|
|
18822
|
-
name,
|
|
18823
|
-
type,
|
|
18824
|
-
operators: OPERATORS_BY_TYPE[type].filter((operator) => operator === "term" || operator === "phrase"),
|
|
18825
|
-
example,
|
|
18826
|
-
...more
|
|
18827
|
-
}), "termField");
|
|
18828
|
-
var queryHelp = /* @__PURE__ */ __name((registry) => `
|
|
18829
|
-
${fieldsHelp(registry, LIST_QUERY_GUIDE)}`, "queryHelp");
|
|
18830
|
-
|
|
18831
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/sends/keyed-guard.js
|
|
18832
|
-
var keyedGuard = /* @__PURE__ */ __name((build, ask2, levelOf, extra) => {
|
|
18833
|
-
let question;
|
|
18834
|
-
let answered = false;
|
|
18835
|
-
const guard = build(async (key, request) => {
|
|
18836
|
-
if (answered)
|
|
18837
|
-
return;
|
|
18838
|
-
await ask2(question || key, request);
|
|
18839
|
-
answered = true;
|
|
18840
|
-
});
|
|
18841
|
-
const probes = /* @__PURE__ */ new WeakMap();
|
|
18842
|
-
const all = /* @__PURE__ */ __name((request) => {
|
|
18843
|
-
let found = probes.get(request);
|
|
18844
|
-
if (!found) {
|
|
18845
|
-
found = extra.map((key) => ({ chatId: null, kind: "read", key }));
|
|
18846
|
-
probes.set(request, found);
|
|
18847
|
-
}
|
|
18848
|
-
return [request, ...found];
|
|
18849
|
-
}, "all");
|
|
18850
|
-
const levelOfRequest = /* @__PURE__ */ __name(({ key }) => levelOf(key ?? ""), "levelOfRequest");
|
|
18851
|
-
const refuse = /* @__PURE__ */ __name((request) => {
|
|
18852
|
-
const refused = all(request).find((one) => stops(levelOfRequest(one), one.key ?? ""));
|
|
18853
|
-
if (refused)
|
|
18854
|
-
guard.check(refused, { reserve: false });
|
|
18855
|
-
}, "refuse");
|
|
18856
|
-
return {
|
|
18857
|
-
refuse,
|
|
18858
|
-
ask: /* @__PURE__ */ __name(async (request) => {
|
|
18859
|
-
refuse(request);
|
|
18860
|
-
question = all(request).filter((one) => levelOfRequest(one) === "ask").map(({ key }) => key).join(" and ");
|
|
18861
|
-
for (const one of all(request))
|
|
18862
|
-
await guard.ask?.(one);
|
|
18863
|
-
}, "ask"),
|
|
18864
|
-
check: /* @__PURE__ */ __name((request, options2) => {
|
|
18865
|
-
for (const one of all(request).slice(1))
|
|
18866
|
-
guard.check(one, { reserve: false });
|
|
18867
|
-
guard.check(request, options2);
|
|
18868
|
-
}, "check"),
|
|
18869
|
-
...guard.reserve ? { reserve: guard.reserve } : {},
|
|
18870
|
-
record: /* @__PURE__ */ __name((entry) => guard.record(entry), "record")
|
|
18871
|
-
};
|
|
18872
|
-
}, "keyedGuard");
|
|
18873
|
-
|
|
18874
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/sends/send-id.js
|
|
18875
|
-
import { randomBytes } from "node:crypto";
|
|
18876
|
-
var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
|
|
18877
|
-
var newOperationId = newSendId;
|
|
18878
|
-
|
|
18879
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/writer.js
|
|
18880
|
-
var CRM_ASSIGN_OTHERS_KEY = "crm.assign-others";
|
|
18881
|
-
var CRM_WRITE_DEFAULTS = {
|
|
18882
|
-
"deals.delete": "ask",
|
|
18883
|
-
"leads.delete": "ask",
|
|
18884
|
-
[CRM_ASSIGN_OTHERS_KEY]: "deny"
|
|
18885
|
-
};
|
|
18886
|
-
|
|
18887
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/writes.js
|
|
18888
|
-
var moneyChecked = /* @__PURE__ */ __name((check2, param) => {
|
|
18889
|
-
try {
|
|
18890
|
-
check2();
|
|
18891
|
-
} catch (error) {
|
|
18892
|
-
if (isCliError(error))
|
|
18893
|
-
throw new CliError(error.code, error.message, { ...error.details, param });
|
|
18894
|
-
throw error;
|
|
18895
|
-
}
|
|
18896
|
-
}, "moneyChecked");
|
|
18897
|
-
var PLURAL = {
|
|
18898
|
-
deal: "deals",
|
|
18899
|
-
lead: "leads",
|
|
18900
|
-
person: "people",
|
|
18901
|
-
organization: "organizations"
|
|
18902
|
-
};
|
|
18903
|
-
var COMMAND = {
|
|
18904
|
-
create: "create",
|
|
18905
|
-
update: "update",
|
|
18906
|
-
move: "move",
|
|
18907
|
-
close: "close",
|
|
18908
|
-
remove: "delete"
|
|
18909
|
-
};
|
|
18910
|
-
var keyOf2 = /* @__PURE__ */ __name((kind, verb) => `${PLURAL[kind]}.${COMMAND[verb]}`, "keyOf");
|
|
18911
|
-
var OPERATION_ID = /^[\x21-\x7e]{1,255}$/u;
|
|
18912
|
-
var DECIMAL = /^\d{1,16}(\.\d{1,6})?$/u;
|
|
18913
|
-
var CURRENCY = /^[A-Z]{3}$/u;
|
|
18914
|
-
var DAY = /^\d{4}-\d{2}-\d{2}$/u;
|
|
18915
|
-
var FIELD_CODE = /^[A-Za-z][\w.-]{0,99}$/u;
|
|
18916
|
-
var invalid = /* @__PURE__ */ __name((message, param) => new CliError("validation_error", message, { reason: "deal.field", ...param ? { param } : {} }), "invalid");
|
|
18917
|
-
var supported = /* @__PURE__ */ __name((writer, kind, verb) => {
|
|
18918
|
-
const { kinds, verbs } = writer.capabilities;
|
|
18919
|
-
if (!kinds.includes(kind) || !verbs.includes(verb))
|
|
18920
|
-
throw new CliError("validation_error", `this CRM does not take a ${COMMAND[verb]} of ${PLURAL[kind]}`, {
|
|
18921
|
-
reason: "crm.write-unsupported",
|
|
18922
|
-
sent: false
|
|
18923
|
-
});
|
|
18924
|
-
}, "supported");
|
|
18925
|
-
var operationOf = /* @__PURE__ */ __name((context2, given) => {
|
|
18926
|
-
if (given === void 0)
|
|
18927
|
-
return newOperationId();
|
|
18928
|
-
const name = context2.names?.id ?? "--operation-id";
|
|
18929
|
-
if (!context2.writes.writer.capabilities.idempotent)
|
|
18930
|
-
throw new CliError("validation_error", `this CRM does not recognise a repeated write, so ${name} would do it a second time; sync and look before writing again`, { reason: "crm.write-unsupported", param: name, sent: false });
|
|
18931
|
-
if (!OPERATION_ID.test(given))
|
|
18932
|
-
throw new CliError("validation_error", `${name} takes 1 to 255 printable characters with no spaces`, {
|
|
18933
|
-
param: name
|
|
18934
|
-
});
|
|
18935
|
-
return given;
|
|
18936
|
-
}, "operationOf");
|
|
18937
|
-
var copyOf = /* @__PURE__ */ __name(async (context2, kind, reference) => {
|
|
18938
|
-
if (!reference.startsWith(`${kind}:`))
|
|
18939
|
-
throw new CliError("validation_error", `name the ${kind} as ${kind}:<id>, as a list shows it`, {
|
|
18940
|
-
reason: "ref.malformed"
|
|
18941
|
-
});
|
|
18942
|
-
const found = await context2.store.deals.get(reference);
|
|
18943
|
-
const { provider, account } = context2.account;
|
|
18944
|
-
if (found.account?.provider !== provider || found.account.account !== account || found.externalId === null)
|
|
18945
|
-
throw new CliError("not_found", `${reference} is not a copy from this profile's CRM account`);
|
|
18946
|
-
return found;
|
|
18947
|
-
}, "copyOf");
|
|
18948
|
-
var pipelineOf = /* @__PURE__ */ __name(async (context2, kind, reference, param = "--pipeline", window3 = {}) => {
|
|
18949
|
-
const scope = { ...window3, ...kind ? { kind } : {}, account: context2.account };
|
|
18950
|
-
if (reference !== void 0) {
|
|
18951
|
-
const found = await context2.store.deals.pipeline(reference, scope);
|
|
18952
|
-
if (found.externalId === null)
|
|
18953
|
-
throw new CliError("not_found", `${reference} is not a pipeline of this CRM account`);
|
|
18954
|
-
return found;
|
|
18955
|
-
}
|
|
18956
|
-
const all = await context2.store.deals.pipelines(scope);
|
|
18957
|
-
if (all.length === 1)
|
|
18958
|
-
return context2.store.deals.pipeline(all[0].ref, scope);
|
|
18959
|
-
const what = kind ? `${kind} pipeline` : "pipeline";
|
|
18960
|
-
throw new CliError("validation_error", all.length === 0 ? `no ${what} of this CRM is stored; run sync first` : `this CRM has ${all.length} ${what}s; name one${param.startsWith("--") ? ` with ${param}` : ""}: ` + all.map(({ name, ref }) => `${name} (${ref})`).join(", "), { reason: "crm.pipeline-required", param, allowed: all.map(({ ref }) => ref) });
|
|
18961
|
-
}, "pipelineOf");
|
|
18962
|
-
var stageOf = /* @__PURE__ */ __name((pipeline2, given) => {
|
|
18963
|
-
const byId2 = pipeline2.stages.find((stage) => stage.externalId === given);
|
|
18964
|
-
if (byId2)
|
|
18965
|
-
return byId2;
|
|
18966
|
-
const folded = given.trim().toLocaleLowerCase();
|
|
18967
|
-
const named3 = pipeline2.stages.filter((stage) => stage.name.toLocaleLowerCase() === folded);
|
|
18968
|
-
if (named3.length === 1)
|
|
18969
|
-
return named3[0];
|
|
18970
|
-
throw new CliError("validation_error", `${pipeline2.name} has ${named3.length ? "more than one" : "no"} stage ${given}: ` + pipeline2.stages.map(({ name }) => name).join(", "), { reason: "deal.stage", param: "--stage" });
|
|
18971
|
-
}, "stageOf");
|
|
18972
|
-
var validDay = /* @__PURE__ */ __name((text3) => {
|
|
18973
|
-
const date = /* @__PURE__ */ new Date(`${text3}T00:00:00Z`);
|
|
18974
|
-
return DAY.test(text3) && !Number.isNaN(date.getTime()) && date.toISOString().startsWith(text3);
|
|
18975
|
-
}, "validDay");
|
|
18976
|
-
var fieldsOf = /* @__PURE__ */ __name((input, pipeline2, currency) => {
|
|
18977
|
-
const fields = {};
|
|
18978
|
-
if (input.title !== void 0) {
|
|
18979
|
-
if (!input.title.trim())
|
|
18980
|
-
throw invalid("a title is never empty", "--title");
|
|
18981
|
-
fields.title = input.title.trim();
|
|
18982
|
-
}
|
|
18983
|
-
if (pipeline2 && input.pipeline !== void 0)
|
|
18984
|
-
fields.pipeline = pipeline2.externalId;
|
|
18985
|
-
const stage = pipeline2 && input.stage !== void 0 ? stageOf(pipeline2, input.stage) : void 0;
|
|
18986
|
-
if (stage)
|
|
18987
|
-
fields.stage = stage.externalId;
|
|
18988
|
-
if (input.amount !== void 0 || input.currency !== void 0) {
|
|
18989
|
-
const code = (input.currency ?? currency ?? "").toUpperCase();
|
|
18990
|
-
if (input.amount === void 0)
|
|
18991
|
-
throw invalid("--currency goes with --amount", "--amount");
|
|
18992
|
-
if (!DECIMAL.test(input.amount))
|
|
18993
|
-
throw invalid("--amount is a decimal such as 1500.50", "--amount");
|
|
18994
|
-
if (!CURRENCY.test(code))
|
|
18995
|
-
throw invalid("--amount needs --currency, an ISO 4217 code such as EUR", "--currency");
|
|
18996
|
-
moneyChecked(() => currencyOf(code), "--currency");
|
|
18997
|
-
moneyChecked(() => minorUnits(input.amount, code, "--amount"), "--amount");
|
|
18998
|
-
fields.amount = input.amount;
|
|
18999
|
-
fields.currency = code;
|
|
19000
|
-
}
|
|
19001
|
-
if (input.closeDate !== void 0) {
|
|
19002
|
-
if (!validDay(input.closeDate))
|
|
19003
|
-
throw invalid("--close-date is a day, YYYY-MM-DD", "--close-date");
|
|
19004
|
-
fields.closeDate = input.closeDate;
|
|
19005
|
-
}
|
|
19006
|
-
if (input.owner !== void 0) {
|
|
19007
|
-
if (!input.owner.trim())
|
|
19008
|
-
throw invalid("--owner is the CRM user's id", "--owner");
|
|
19009
|
-
fields.owner = input.owner.trim();
|
|
19010
|
-
}
|
|
19011
|
-
return { fields, stage };
|
|
19012
|
-
}, "fieldsOf");
|
|
19013
|
-
var foldFieldName = /* @__PURE__ */ __name((name) => foldName(name.trim()).replace(/[\s_]+/gu, " "), "foldFieldName");
|
|
19014
|
-
var named = /* @__PURE__ */ __name(({ code, label }) => ({ code, label }), "named");
|
|
19015
|
-
var unknownField = /* @__PURE__ */ __name((fields, name, param = "--field") => {
|
|
19016
|
-
const want = foldFieldName(name);
|
|
19017
|
-
const close = fields.filter((field) => [field.code, field.label ?? ""].some((one) => {
|
|
19018
|
-
const other = foldFieldName(one);
|
|
19019
|
-
return other !== "" && (other.includes(want) || want.includes(other));
|
|
19020
|
-
}));
|
|
19021
|
-
return new CliError("validation_error", `no custom field is named ${name}${close.length ? "; close ones are in candidates" : ""} \u2014 \`fields list\` lists them`, { reason: "field.unknown", param, candidates: close.map(named) });
|
|
19022
|
-
}, "unknownField");
|
|
19023
|
-
var fieldNamed = /* @__PURE__ */ __name((fields, name, param = "--field") => {
|
|
19024
|
-
const want = foldFieldName(name);
|
|
19025
|
-
const byCode = fields.find((field) => foldFieldName(field.code) === want);
|
|
19026
|
-
if (byCode)
|
|
19027
|
-
return byCode;
|
|
19028
|
-
const labelled = fields.filter((field) => field.label !== null && foldFieldName(field.label) === want);
|
|
19029
|
-
if (labelled.length === 1)
|
|
19030
|
-
return labelled[0];
|
|
19031
|
-
if (labelled.length > 1)
|
|
19032
|
-
throw new CliError("validation_error", `${labelled.length} custom fields are labelled ${name}; name one by its code`, {
|
|
19033
|
-
reason: "field.ambiguous",
|
|
19034
|
-
param,
|
|
19035
|
-
candidates: labelled.map(named)
|
|
19036
|
-
});
|
|
19037
|
-
throw unknownField(fields, name, param);
|
|
19038
|
-
}, "fieldNamed");
|
|
19039
|
-
var optionOf = /* @__PURE__ */ __name((field, value, param = "--field") => {
|
|
19040
|
-
if (!field.options)
|
|
19041
|
-
return value;
|
|
19042
|
-
const want = foldFieldName(value);
|
|
19043
|
-
const byId2 = field.options.find((option) => option.id === value.trim());
|
|
19044
|
-
const named3 = byId2 ? [] : field.options.filter((option) => foldFieldName(option.label) === want);
|
|
19045
|
-
if (named3.length > 1)
|
|
19046
|
-
throw new CliError("validation_error", `${field.label ?? field.code} has ${named3.length} options named ${value}; name one by its id`, {
|
|
19047
|
-
reason: "field.ambiguous-option",
|
|
19048
|
-
param,
|
|
19049
|
-
field: field.code,
|
|
19050
|
-
candidates: named3
|
|
19051
|
-
});
|
|
19052
|
-
const found = byId2 ?? named3[0];
|
|
19053
|
-
if (!found)
|
|
19054
|
-
throw new CliError("validation_error", `${field.label ?? field.code} has no option ${value}`, {
|
|
19055
|
-
reason: "field.unknown-option",
|
|
19056
|
-
param,
|
|
19057
|
-
field: field.code,
|
|
19058
|
-
allowed: field.options
|
|
19059
|
-
});
|
|
19060
|
-
return found.id;
|
|
19061
|
-
}, "optionOf");
|
|
19062
|
-
var fieldPairsOf = /* @__PURE__ */ __name((typed) => typed.map((one) => {
|
|
19063
|
-
const at = one.indexOf("=");
|
|
19064
|
-
if (at <= 0 || one.slice(0, at).trim() === "")
|
|
19065
|
-
throw new CliError("validation_error", `--field takes <key>=<value>; got ${one}`, { param: "--field" });
|
|
19066
|
-
return [one.slice(0, at), one.slice(at + 1)];
|
|
19067
|
-
}), "fieldPairsOf");
|
|
19068
|
-
var crmCustomValues = /* @__PURE__ */ __name((fields, pairs) => {
|
|
19069
|
-
const values = /* @__PURE__ */ new Map();
|
|
19070
|
-
for (const [name, value] of pairs) {
|
|
19071
|
-
const field = fields.length ? fieldNamed(fields, name) : null;
|
|
19072
|
-
const code = field?.code ?? name.trim();
|
|
19073
|
-
if (!field && !FIELD_CODE.test(code))
|
|
19074
|
-
throw invalid(`${name} is not a field code`, "--field");
|
|
19075
|
-
const held = values.get(code) ?? { field, all: [] };
|
|
19076
|
-
held.all.push(value === "" ? null : field ? optionOf(field, value) : value);
|
|
19077
|
-
values.set(code, held);
|
|
19078
|
-
}
|
|
19079
|
-
return Object.fromEntries([...values].map(([code, { field, all }]) => {
|
|
19080
|
-
const given = all.filter((one) => one !== null);
|
|
19081
|
-
if (field?.multiple)
|
|
19082
|
-
return [code, given.length ? given : null];
|
|
19083
|
-
if (all.length > 1)
|
|
19084
|
-
throw new CliError("validation_error", `${field?.label ?? code} holds one value; give --field once`, {
|
|
19085
|
-
reason: "deal.field",
|
|
19086
|
-
param: "--field",
|
|
19087
|
-
field: code
|
|
19088
|
-
});
|
|
19089
|
-
return [code, all[0] ?? null];
|
|
19090
|
-
}));
|
|
19091
|
-
}, "crmCustomValues");
|
|
19092
|
-
var customOf = /* @__PURE__ */ __name(async (context2, kind, pairs) => pairs?.length ? crmCustomValues(await context2.store.crm.fields(context2.account, kind), pairs) : void 0, "customOf");
|
|
19093
|
-
var keysOf = /* @__PURE__ */ __name((context2, kind, verb, { stage, owner }) => {
|
|
19094
|
-
const extra = [];
|
|
19095
|
-
if (stage && verb !== "move")
|
|
19096
|
-
extra.push(keyOf2(kind, "move"));
|
|
19097
|
-
if (stage && stage.outcome !== "open")
|
|
19098
|
-
extra.push(keyOf2(kind, "close"));
|
|
19099
|
-
if (owner != null && owner !== context2.writes.self)
|
|
19100
|
-
extra.push(CRM_ASSIGN_OTHERS_KEY);
|
|
19101
|
-
return { key: keyOf2(kind, verb), extra: [...extra, ...context2.writes.alsoChecks?.(kind, verb) ?? []] };
|
|
19102
|
-
}, "keysOf");
|
|
19103
|
-
var guardOf = /* @__PURE__ */ __name((context2, extra) => {
|
|
19104
|
-
const settings = context2.writes.settings();
|
|
19105
|
-
const defaults = { ...DEFAULT_PERMISSIONS, ...CRM_WRITE_DEFAULTS, ...settings.permissionDefaults };
|
|
19106
|
-
return keyedGuard((ask2) => guardFor(context2.writes.app, { ...settings, sendsPerHour: Number.MAX_SAFE_INTEGER, permissionDefaults: defaults }, context2.writes.warn ?? (() => {
|
|
19107
|
-
}), context2.writes.env, ask2), context2.ask, (key) => levelFor(settings.permissions, key, defaults).level, extra);
|
|
19108
|
-
}, "guardOf");
|
|
19109
|
-
var written = /* @__PURE__ */ __name(async (context2, { key, extra }, operationId, act2) => {
|
|
19110
|
-
try {
|
|
19111
|
-
const done2 = await guardedWrite(guardOf(context2, extra), { chatId: null, kind: "edit", key, operationId }, async () => {
|
|
19112
|
-
try {
|
|
19113
|
-
return { item: await act2(), unread: null };
|
|
19114
|
-
} catch (error) {
|
|
19115
|
-
if (isCliError(error) && error.details.sent === true)
|
|
19116
|
-
return { item: null, unread: error };
|
|
19117
|
-
throw error;
|
|
19118
|
-
}
|
|
19119
|
-
});
|
|
19120
|
-
if (done2.unread)
|
|
19121
|
-
throw new CliError(done2.unread.code, `${done2.unread.message} \u2014 the CRM made the change; sync to store it, do not write it again`, { ...done2.unread.details, operation_id: operationId });
|
|
19122
|
-
return done2.item;
|
|
19123
|
-
} catch (error) {
|
|
19124
|
-
if (!isCliError(error) || error.code !== "outcome_unknown")
|
|
19125
|
-
throw error;
|
|
19126
|
-
const name = context2.names?.id ?? "--operation-id";
|
|
19127
|
-
throw new CliError("outcome_unknown", context2.writes.writer.capabilities.idempotent ? `${error.message} \u2014 repeat it with ${name} ${operationId}: the CRM answers a repeat from its record instead of doing it again` : `${error.message} \u2014 sync and look at the CRM before writing again: this CRM would do it a second time`, { ...error.details, operation_id: operationId });
|
|
19128
|
-
}
|
|
19129
|
-
}, "written");
|
|
19130
|
-
var kept = /* @__PURE__ */ __name(async (context2, kind, item2, operationId) => {
|
|
19131
|
-
const fail2 = /* @__PURE__ */ __name((why, details = {}) => new CliError("invalid_response", `the CRM wrote ${kind} ${item2.externalId}, but the local store did not keep it (${why}); sync to store it \u2014 do not write it again`, { ...details, operation_id: operationId, external_id: item2.externalId, sent: true }), "fail");
|
|
19132
|
-
try {
|
|
19133
|
-
let saved = await context2.store.crm.saveItems(context2.account, kind, [item2]);
|
|
19134
|
-
if (saved.skipped[0]?.reason === "crm.stage-unknown" && context2.source) {
|
|
19135
|
-
await context2.store.crm.savePipelines(context2.account, kind, await context2.source().pipelines(kind));
|
|
19136
|
-
saved = await context2.store.crm.saveItems(context2.account, kind, [item2]);
|
|
19137
|
-
}
|
|
19138
|
-
const [skipped] = saved.skipped;
|
|
19139
|
-
if (skipped)
|
|
19140
|
-
throw fail2(skipped.message, { reason: skipped.reason });
|
|
19141
|
-
const reference = await context2.store.crm.refOf(context2.account, kind, item2.externalId);
|
|
19142
|
-
if (reference === null)
|
|
19143
|
-
throw fail2("it is not found after the save");
|
|
19144
|
-
return await context2.store.deals.get(reference);
|
|
19145
|
-
} catch (error) {
|
|
19146
|
-
if (isCliError(error) && error.code === "invalid_response" && error.details.sent === true)
|
|
19147
|
-
throw error;
|
|
19148
|
-
throw fail2(error instanceof Error ? error.message : String(error), isCliError(error) ? error.details : {});
|
|
19149
|
-
}
|
|
19150
|
-
}, "kept");
|
|
19151
|
-
var createCrmItem = /* @__PURE__ */ __name(async (context2, kind, input, options2 = {}) => {
|
|
19152
|
-
const { writer } = context2.writes;
|
|
19153
|
-
supported(writer, kind, "create");
|
|
19154
|
-
if (input.title === void 0)
|
|
19155
|
-
throw invalid(`a new ${kind} needs --title`, "--title");
|
|
19156
|
-
const pipeline2 = await pipelineOf(context2, kind, input.pipeline);
|
|
19157
|
-
const { fields, stage } = fieldsOf({ ...input, pipeline: pipeline2.ref }, pipeline2, null);
|
|
19158
|
-
const custom = await customOf(context2, kind, input.custom);
|
|
19159
|
-
if (custom)
|
|
19160
|
-
fields.custom = custom;
|
|
19161
|
-
const operationId = operationOf(context2, options2.operationId);
|
|
19162
|
-
const item2 = await written(context2, keysOf(context2, kind, "create", { stage, owner: fields.owner }), operationId, () => writer.create(kind, fields, { operationId }));
|
|
19163
|
-
return { operationId, item: await kept(context2, kind, item2, operationId) };
|
|
19164
|
-
}, "createCrmItem");
|
|
19165
|
-
var updateCrmItem = /* @__PURE__ */ __name(async (context2, kind, reference, input, options2 = {}) => {
|
|
19166
|
-
const { writer } = context2.writes;
|
|
19167
|
-
supported(writer, kind, "update");
|
|
19168
|
-
const copy = await copyOf(context2, kind, reference);
|
|
19169
|
-
if (input.pipeline !== void 0 && input.stage === void 0)
|
|
19170
|
-
throw invalid("a new --pipeline needs the --stage it goes to there", "--stage");
|
|
19171
|
-
const pipeline2 = input.stage === void 0 ? void 0 : await pipelineOf(context2, kind, input.pipeline === void 0 ? copy.pipeline : input.pipeline);
|
|
19172
|
-
const { fields, stage } = fieldsOf(input, pipeline2, copy.currency);
|
|
19173
|
-
const custom = await customOf(context2, kind, input.custom);
|
|
19174
|
-
if (custom)
|
|
19175
|
-
fields.custom = custom;
|
|
19176
|
-
if (Object.keys(fields).length === 0)
|
|
19177
|
-
throw invalid("nothing to change: name a field");
|
|
19178
|
-
const operationId = operationOf(context2, options2.operationId);
|
|
19179
|
-
const item2 = await written(context2, keysOf(context2, kind, "update", { stage, owner: fields.owner }), operationId, () => writer.update(kind, copy.externalId, fields, { operationId }));
|
|
19180
|
-
return { operationId, item: await kept(context2, kind, item2, operationId) };
|
|
19181
|
-
}, "updateCrmItem");
|
|
19182
|
-
var moveCrmItem = /* @__PURE__ */ __name(async (context2, kind, reference, stageName, options2 = {}) => {
|
|
19183
|
-
const { writer } = context2.writes;
|
|
19184
|
-
supported(writer, kind, "move");
|
|
19185
|
-
const copy = await copyOf(context2, kind, reference);
|
|
19186
|
-
const stage = stageOf(await pipelineOf(context2, kind, copy.pipeline), stageName);
|
|
19187
|
-
const operationId = operationOf(context2, options2.operationId);
|
|
19188
|
-
const item2 = await written(context2, keysOf(context2, kind, "move", { stage }), operationId, () => writer.move(kind, copy.externalId, stage.externalId, { operationId }));
|
|
19189
|
-
return { operationId, item: await kept(context2, kind, item2, operationId) };
|
|
19190
|
-
}, "moveCrmItem");
|
|
19191
|
-
var closeCrmItem = /* @__PURE__ */ __name(async (context2, kind, reference, outcome2, options2 = {}) => {
|
|
19192
|
-
const { writer } = context2.writes;
|
|
19193
|
-
supported(writer, kind, "close");
|
|
19194
|
-
if (outcome2 !== "won" && outcome2 !== "lost")
|
|
19195
|
-
throw invalid("a close is won or lost");
|
|
19196
|
-
const copy = await copyOf(context2, kind, reference);
|
|
19197
|
-
const reason = options2.reason?.trim();
|
|
19198
|
-
if (reason !== void 0 && (reason === "" || reason.length > 2e3))
|
|
19199
|
-
throw invalid("--reason is 1 to 2000 characters", "--reason");
|
|
19200
|
-
const operationId = operationOf(context2, options2.operationId);
|
|
19201
|
-
const item2 = await written(context2, keysOf(context2, kind, "close", {}), operationId, () => writer.close(kind, copy.externalId, outcome2, { operationId, ...reason ? { reason } : {} }));
|
|
19202
|
-
return { operationId, item: await kept(context2, kind, item2, operationId) };
|
|
19203
|
-
}, "closeCrmItem");
|
|
19204
|
-
var removeCrmItem = /* @__PURE__ */ __name(async (context2, kind, reference, options2 = {}) => {
|
|
19205
|
-
const { writer } = context2.writes;
|
|
19206
|
-
supported(writer, kind, "remove");
|
|
19207
|
-
const copy = await copyOf(context2, kind, reference);
|
|
19208
|
-
const operationId = operationOf(context2, options2.operationId);
|
|
19209
|
-
await written(context2, keysOf(context2, kind, "remove", {}), operationId, () => writer.remove(kind, copy.externalId, { operationId }));
|
|
19210
|
-
const removed = await context2.store.crm.remove(context2.account, kind, [copy.externalId]);
|
|
19211
|
-
return { operationId, ref: copy.ref, removed };
|
|
19212
|
-
}, "removeCrmItem");
|
|
19213
|
-
var EMAIL = /^[^\s@]{1,64}@[^\s@]{1,255}$/u;
|
|
19214
|
-
var RECORD_ID = /^[\w.:-]{1,100}$/u;
|
|
19215
|
-
var PERSON_ONLY = ["firstName", "lastName", "position"];
|
|
19216
|
-
var recordInvalid = /* @__PURE__ */ __name((message, param) => new CliError("validation_error", message, { reason: "crm.record-field", ...param ? { param } : {} }), "recordInvalid");
|
|
19217
|
-
var cleared = /* @__PURE__ */ __name((value) => value === void 0 ? void 0 : value.trim() || null, "cleared");
|
|
19218
|
-
var listed2 = /* @__PURE__ */ __name((values, param, valid) => {
|
|
19219
|
-
if (values === void 0)
|
|
19220
|
-
return void 0;
|
|
19221
|
-
const all = values.map((one) => one.trim());
|
|
19222
|
-
if (all.length === 1 && all[0] === "")
|
|
19223
|
-
return [];
|
|
19224
|
-
for (const one of all)
|
|
19225
|
-
if (one === "" || one.length > 320 || valid && !valid.test(one))
|
|
19226
|
-
throw recordInvalid(`${param} got ${one}`, param);
|
|
19227
|
-
return all;
|
|
19228
|
-
}, "listed");
|
|
19229
|
-
var recordFieldsOf = /* @__PURE__ */ __name((kind, input) => {
|
|
19230
|
-
if (kind === "organization") {
|
|
19231
|
-
const given = PERSON_ONLY.find((one) => input[one] !== void 0);
|
|
19232
|
-
if (given)
|
|
19233
|
-
throw recordInvalid(`a company has no ${given}`);
|
|
19234
|
-
}
|
|
19235
|
-
const fields = {};
|
|
19236
|
-
if (input.name !== void 0) {
|
|
19237
|
-
if (!input.name.trim())
|
|
19238
|
-
throw recordInvalid("--name is never empty", "--name");
|
|
19239
|
-
fields.name = input.name.trim();
|
|
19240
|
-
}
|
|
19241
|
-
const parts = { firstName: cleared(input.firstName), lastName: cleared(input.lastName) };
|
|
19242
|
-
const position = cleared(input.position);
|
|
19243
|
-
if (parts.firstName !== void 0)
|
|
19244
|
-
fields.firstName = parts.firstName;
|
|
19245
|
-
if (parts.lastName !== void 0)
|
|
19246
|
-
fields.lastName = parts.lastName;
|
|
19247
|
-
if (position !== void 0)
|
|
19248
|
-
fields.position = position;
|
|
19249
|
-
const emails = listed2(input.emails, "--email", EMAIL);
|
|
19250
|
-
const phones = listed2(input.phones, "--phone")?.map((phone) => {
|
|
19251
|
-
const international = e164Of(phone, void 0);
|
|
19252
|
-
if (typeof international !== "string")
|
|
19253
|
-
throw recordInvalid(`--phone takes a number in international form, starting with +: not ${phone}`, "--phone");
|
|
19254
|
-
return international;
|
|
19172
|
+
if (!deps.readFiles)
|
|
19173
|
+
throw new MeetingError("configuration_error", "file reader is unavailable");
|
|
19174
|
+
const files = await deps.readFiles(folder);
|
|
19175
|
+
if (files.some((file) => file.meeting.accountId !== deps.accountId))
|
|
19176
|
+
throw new MeetingError("validation_error", "file account differs from selected account");
|
|
19177
|
+
print(await importFiles(files, deps.store, deps.now?.()), command);
|
|
19255
19178
|
});
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
|
|
19263
|
-
|
|
19264
|
-
|
|
19265
|
-
|
|
19266
|
-
},
|
|
19267
|
-
|
|
19268
|
-
|
|
19269
|
-
|
|
19270
|
-
|
|
19271
|
-
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
}
|
|
19277
|
-
|
|
19278
|
-
|
|
19279
|
-
|
|
19280
|
-
|
|
19281
|
-
|
|
19282
|
-
|
|
19283
|
-
|
|
19284
|
-
|
|
19285
|
-
|
|
19286
|
-
if (
|
|
19287
|
-
|
|
19288
|
-
|
|
19289
|
-
|
|
19290
|
-
}
|
|
19291
|
-
|
|
19292
|
-
|
|
19293
|
-
|
|
19179
|
+
output(annotate(group.command("repair"), {
|
|
19180
|
+
effects: LOCAL_WRITE,
|
|
19181
|
+
output: { entity: "meeting_repair" }
|
|
19182
|
+
}).description("preview filling in what older builds left out of stored transcripts (their language); --yes stores it")).option("--yes", "store the detected languages; otherwise only preview").action(async (opts, command) => {
|
|
19183
|
+
if (!deps.store.fillTranscriptLanguages)
|
|
19184
|
+
throw new MeetingError("configuration_error", "this store cannot fill transcript languages");
|
|
19185
|
+
print(await deps.store.fillTranscriptLanguages({
|
|
19186
|
+
accountId: deps.accountId,
|
|
19187
|
+
apply: opts.yes === true,
|
|
19188
|
+
now: deps.now?.() ?? Date.now()
|
|
19189
|
+
}), command);
|
|
19190
|
+
});
|
|
19191
|
+
if (deps.management)
|
|
19192
|
+
addMeetingManagementCommands(group, {
|
|
19193
|
+
management: deps.management,
|
|
19194
|
+
print,
|
|
19195
|
+
output,
|
|
19196
|
+
inRun: deps.inRun,
|
|
19197
|
+
...deps.askFirst ? { askFirst: deps.askFirst } : {},
|
|
19198
|
+
...deps.signal ? { signal: deps.signal } : {}
|
|
19199
|
+
});
|
|
19200
|
+
const eventList = queryWordsAfterOptions(annotate(program.command("events").description("the owner's stored events"), {
|
|
19201
|
+
effects: { remote: "none", local: "none" }
|
|
19202
|
+
}).command("list")).description("list stored events").argument("[query...]", "event id, origin or time fields that narrow the list").addHelpText("after", `
|
|
19203
|
+
${fieldsHelp(EVENT_QUERY, MEETING_QUERY_GUIDE)}`);
|
|
19204
|
+
annotate(eventList, { effects: LOCAL_READ, output: { entity: "event" }, query: EVENT_QUERY });
|
|
19205
|
+
output(eventList).action(async (words3, _opts, command) => {
|
|
19206
|
+
const query = words3.length ? parseLucene(words3.join(" "), { defaultField: "none", command: "events list" }) : void 0;
|
|
19207
|
+
if (query)
|
|
19208
|
+
validateQuery(query, EVENT_QUERY, { command: "events list" });
|
|
19209
|
+
if (query && !deps.store.queryEvents)
|
|
19210
|
+
throw new MeetingError("validation_error", "this store cannot filter events");
|
|
19211
|
+
const events = query ? await deps.store.queryEvents?.(query) : await deps.store.events();
|
|
19212
|
+
print(listed((events ?? []).map((one) => ({ ...eventItem(one), untrusted: [...EVENT_UNTRUSTED] }))), command);
|
|
19213
|
+
});
|
|
19214
|
+
}, "addMeetingCommandsDefinition");
|
|
19215
|
+
var addMeetingCommands = sharedCommand(addMeetingCommandsDefinition);
|
|
19216
|
+
|
|
19217
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/cli/list-query.js
|
|
19218
|
+
var LIST_QUERY_GUIDE = "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md";
|
|
19219
|
+
var QUERY_ARGUMENT = "field:value terms that narrow the list \u2014 the fields are below";
|
|
19220
|
+
var withQuery = /* @__PURE__ */ __name((command, registry) => {
|
|
19221
|
+
const query = defineQuery(registry);
|
|
19222
|
+
annotate(command, { query, output: { entity: registry.entity } });
|
|
19223
|
+
const shown = askable(query);
|
|
19224
|
+
queryWordsAfterOptions(command).argument("[query...]", shown.length > 0 ? QUERY_ARGUMENT : "field:value terms; this list filters by none yet");
|
|
19225
|
+
if (shown.length > 0)
|
|
19226
|
+
command.addHelpText("after", `
|
|
19227
|
+
${fieldsHelp({ ...query, fields: shown }, LIST_QUERY_GUIDE)}`);
|
|
19228
|
+
return command;
|
|
19229
|
+
}, "withQuery");
|
|
19230
|
+
var unfilteredQuery = /* @__PURE__ */ __name((entity, schema2) => ({
|
|
19231
|
+
entity,
|
|
19232
|
+
backend: "native",
|
|
19233
|
+
fields: queryFieldsOf(schema2, {})
|
|
19234
|
+
}), "unfilteredQuery");
|
|
19235
|
+
var commandPath = /* @__PURE__ */ __name((command) => {
|
|
19236
|
+
const words3 = [];
|
|
19237
|
+
for (let at = command; at?.parent; at = at.parent)
|
|
19238
|
+
words3.unshift(at.name());
|
|
19239
|
+
return words3.join(" ");
|
|
19240
|
+
}, "commandPath");
|
|
19241
|
+
var withTomorrow = /* @__PURE__ */ __name((query, registry, zone = timezoneOf(), now = Date.now()) => {
|
|
19242
|
+
const times = new Set(registry.fields.filter(({ type }) => type === "time").map(({ name }) => name));
|
|
19243
|
+
const date = /* @__PURE__ */ new Date(`${new Intl.DateTimeFormat("en-CA", { timeZone: zone }).format(now)}T00:00:00Z`);
|
|
19244
|
+
date.setUTCDate(date.getUTCDate() + 1);
|
|
19245
|
+
const tomorrow = date.toISOString().slice(0, 10);
|
|
19246
|
+
const day2 = /* @__PURE__ */ __name((value) => value.toLowerCase() === "tomorrow" ? tomorrow : value, "day");
|
|
19247
|
+
const map = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? times.has(node.field) ? { ...node, value: day2(node.value), ...node.upper === void 0 ? {} : { upper: day2(node.upper) } } : node : { ...node, clauses: node.clauses.map((clause) => ({ ...clause, node: map(clause.node) })) }, "map");
|
|
19248
|
+
return { ...query, root: map(query.root) };
|
|
19249
|
+
}, "withTomorrow");
|
|
19250
|
+
var listQuery = /* @__PURE__ */ __name((text3, registry, command, { defaultField = "none" } = {}) => {
|
|
19251
|
+
const context2 = { command, guide: LIST_QUERY_GUIDE };
|
|
19252
|
+
const signed = text3.replace(/(^|[\s(])([\p{L}_][\p{L}\p{N}_.]*:)\+([^\s()"]+)/gu, '$1$2"+$3"');
|
|
19253
|
+
const parsed = signed.trim() === "" ? void 0 : parseLucene(signed, { defaultField, ...context2 });
|
|
19254
|
+
const typed = parsed && withTomorrow(parsed, registry);
|
|
19255
|
+
if (typed)
|
|
19256
|
+
validateQuery(typed, registry, context2);
|
|
19257
|
+
const named3 = typed ? fieldsNamed(typed) : /* @__PURE__ */ new Set();
|
|
19258
|
+
const defaults = (registry.defaults ?? []).filter((term) => !named3.has(term.replace(/^-/, "").split(/[:<>=]/)[0] ?? "")).map((term) => parseLucene(term, { defaultField: "none", ...context2 }).root);
|
|
19259
|
+
const roots = [...typed ? [typed.root] : [], ...defaults];
|
|
19260
|
+
if (roots.length === 0)
|
|
19261
|
+
return void 0;
|
|
19262
|
+
if (roots.length === 1 && typed)
|
|
19263
|
+
return typed;
|
|
19264
|
+
return {
|
|
19265
|
+
version: 1,
|
|
19266
|
+
language: "lucene-v1",
|
|
19267
|
+
root: {
|
|
19268
|
+
kind: "boolean",
|
|
19269
|
+
clauses: roots.map((node) => ({ occur: "must", node })),
|
|
19270
|
+
span: { start: 0, end: text3.length }
|
|
19271
|
+
}
|
|
19272
|
+
};
|
|
19273
|
+
}, "listQuery");
|
|
19274
|
+
var typedQuery = /* @__PURE__ */ __name((words3) => typeof words3 === "string" ? words3 : (words3 ?? []).join(" "), "typedQuery");
|
|
19275
|
+
var EVERY = Number.MAX_SAFE_INTEGER - 1;
|
|
19276
|
+
var pageOf = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { limit: EVERY, offset: 0 } : { limit, offset: (page - 1) * limit }, "pageOf");
|
|
19277
|
+
var pagedList = /* @__PURE__ */ __name((command, { limit, page, all }, { items, hasMore, ...rest }) => listOf(command, {
|
|
19278
|
+
...rest,
|
|
19279
|
+
items,
|
|
19280
|
+
limit: all ? Math.max(1, items.length) : limit,
|
|
19281
|
+
has_more: all ? false : hasMore,
|
|
19282
|
+
page
|
|
19283
|
+
}), "pagedList");
|
|
19284
|
+
var askable = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "askable");
|
|
19285
|
+
var nativeTerms = /* @__PURE__ */ __name((ast, command) => new Map([...nativeTermLists(ast, command)].map(([field, [node]]) => [field, node])), "nativeTerms");
|
|
19286
|
+
var nativeTermLists = /* @__PURE__ */ __name((ast, command, repeatable = [], negatable = []) => {
|
|
19287
|
+
const terms = /* @__PURE__ */ new Map();
|
|
19288
|
+
if (!ast)
|
|
19289
|
+
return terms;
|
|
19290
|
+
const context2 = { command, guide: LIST_QUERY_GUIDE };
|
|
19291
|
+
const add = /* @__PURE__ */ __name((node) => {
|
|
19292
|
+
if (node.kind === "boolean") {
|
|
19293
|
+
for (const clause of node.clauses) {
|
|
19294
|
+
const excluded = clause.occur === "must_not" && clause.node.kind === "predicate" && negatable.includes(clause.node.field);
|
|
19295
|
+
if (excluded && clause.node.kind === "predicate") {
|
|
19296
|
+
const key = `-${clause.node.field}`;
|
|
19297
|
+
terms.set(key, [...terms.get(key) ?? [], clause.node]);
|
|
19298
|
+
continue;
|
|
19299
|
+
}
|
|
19300
|
+
if (clause.occur !== "must")
|
|
19301
|
+
queryError("query.unsupported-placement", clause.node.span, negatable.length ? `this list takes only field:value terms joined by AND, and -field:value for ${negatable.join(", ")}` : "this list takes only field:value terms joined by AND", context2);
|
|
19302
|
+
add(clause.node);
|
|
19303
|
+
}
|
|
19304
|
+
return;
|
|
19305
|
+
}
|
|
19306
|
+
const held = terms.get(node.field);
|
|
19307
|
+
if (held && !repeatable.includes(node.field))
|
|
19308
|
+
queryError("query.unsupported-placement", node.span, `${node.field} only once here`, context2);
|
|
19309
|
+
terms.set(node.field, [...held ?? [], node]);
|
|
19310
|
+
}, "add");
|
|
19311
|
+
add(ast.root);
|
|
19312
|
+
return terms;
|
|
19313
|
+
}, "nativeTermLists");
|
|
19314
|
+
var queryTerms = /* @__PURE__ */ __name((words3, registry, command, ranged = []) => {
|
|
19315
|
+
const terms = /* @__PURE__ */ new Map();
|
|
19316
|
+
for (const [field, node] of nativeTerms(listQuery(typedQuery(words3), registry, command), command)) {
|
|
19317
|
+
if (ranged.includes(field))
|
|
19318
|
+
continue;
|
|
19319
|
+
if (node.operator !== "term" && node.operator !== "phrase")
|
|
19320
|
+
queryError("query.unsupported-placement", node.span, `${field} takes one whole value here`, {
|
|
19321
|
+
command,
|
|
19322
|
+
guide: LIST_QUERY_GUIDE
|
|
19323
|
+
});
|
|
19324
|
+
const enumerated = registry.fields.find(({ name }) => name === field)?.type === "enum";
|
|
19325
|
+
terms.set(field, enumerated ? node.value.toLowerCase() : node.value);
|
|
19294
19326
|
}
|
|
19295
|
-
|
|
19327
|
+
return terms;
|
|
19328
|
+
}, "queryTerms");
|
|
19329
|
+
var timeBounds = /* @__PURE__ */ __name((term, zone = timezoneOf(), now) => {
|
|
19330
|
+
if (!term)
|
|
19331
|
+
return {};
|
|
19332
|
+
const upper = term.operator === "range" ? term.upper ?? "*" : term.value;
|
|
19333
|
+
const range3 = dateRange(term.value, upper, term.operator === "range" ? term.lower_inclusive !== false : true, term.operator === "range" ? term.upper_inclusive !== false : true, zone, term.span, now);
|
|
19334
|
+
const until = range3.upper === void 0 ? void 0 : range3.upper - (range3.upper_inclusive ? 0 : 1);
|
|
19296
19335
|
return {
|
|
19297
|
-
|
|
19298
|
-
|
|
19299
|
-
|
|
19300
|
-
|
|
19336
|
+
...range3.lower === void 0 ? {} : { since: range3.lower },
|
|
19337
|
+
...until === void 0 ? {} : { until },
|
|
19338
|
+
meta: {
|
|
19339
|
+
timezone: zone,
|
|
19340
|
+
window: {
|
|
19341
|
+
...range3.lower === void 0 ? {} : { since: new Date(range3.lower).toISOString() },
|
|
19342
|
+
...until === void 0 ? {} : { until: new Date(until).toISOString() }
|
|
19343
|
+
}
|
|
19344
|
+
}
|
|
19301
19345
|
};
|
|
19302
|
-
}, "
|
|
19303
|
-
var
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
|
|
19310
|
-
|
|
19311
|
-
|
|
19312
|
-
|
|
19313
|
-
|
|
19314
|
-
const operationId = operationOf(context2, options2.operationId);
|
|
19315
|
-
return writeRecord(context2, kind, "create", fields, operationId, () => writer.create(kind, fields, { operationId }));
|
|
19316
|
-
}, "createCrmRecord");
|
|
19317
|
-
var updateCrmRecord = /* @__PURE__ */ __name(async (context2, kind, externalId, input, options2 = {}) => {
|
|
19318
|
-
const { writer } = context2.writes;
|
|
19319
|
-
supported(writer, kind, "update");
|
|
19320
|
-
if (!RECORD_ID.test(externalId))
|
|
19321
|
-
throw new CliError("validation_error", `name the ${kind} by the CRM's id, as a list prints it`, {
|
|
19322
|
-
reason: "ref.malformed"
|
|
19323
|
-
});
|
|
19324
|
-
const fields = recordFieldsOf(kind, input);
|
|
19325
|
-
const custom = await customOf(context2, kind, input.custom);
|
|
19326
|
-
if (custom)
|
|
19327
|
-
fields.custom = custom;
|
|
19328
|
-
if (Object.keys(fields).length === 0)
|
|
19329
|
-
throw recordInvalid("nothing to change: name a field");
|
|
19330
|
-
const operationId = operationOf(context2, options2.operationId);
|
|
19331
|
-
return writeRecord(context2, kind, "update", fields, operationId, () => writer.update(kind, externalId, fields, { operationId }));
|
|
19332
|
-
}, "updateCrmRecord");
|
|
19346
|
+
}, "timeBounds");
|
|
19347
|
+
var searchText = /* @__PURE__ */ __name((term) => term === void 0 ? void 0 : term.value.replace(/^\*+|\*+$/g, ""), "searchText");
|
|
19348
|
+
var nativeField = /* @__PURE__ */ __name((field) => ({ ...field, native: true }), "nativeField");
|
|
19349
|
+
var termField = /* @__PURE__ */ __name((name, type, example, more = {}) => nativeField({
|
|
19350
|
+
name,
|
|
19351
|
+
type,
|
|
19352
|
+
operators: OPERATORS_BY_TYPE[type].filter((operator) => operator === "term" || operator === "phrase"),
|
|
19353
|
+
example,
|
|
19354
|
+
...more
|
|
19355
|
+
}), "termField");
|
|
19356
|
+
var queryHelp = /* @__PURE__ */ __name((registry) => `
|
|
19357
|
+
${fieldsHelp(registry, LIST_QUERY_GUIDE)}`, "queryHelp");
|
|
19333
19358
|
|
|
19334
19359
|
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/query.js
|
|
19335
19360
|
var valueFor = /* @__PURE__ */ __name((kind, raw, name) => {
|
|
@@ -40856,7 +40881,12 @@ export {
|
|
|
40856
40881
|
sendGuard,
|
|
40857
40882
|
guardFor,
|
|
40858
40883
|
keyedGuard,
|
|
40884
|
+
CRM_ASSIGN_OTHERS_KEY,
|
|
40885
|
+
CRM_WRITE_KEYS,
|
|
40886
|
+
crmAlsoChecks,
|
|
40887
|
+
CRM_WRITE_DEFAULTS,
|
|
40859
40888
|
pipelineOf,
|
|
40889
|
+
foldFieldName,
|
|
40860
40890
|
fieldPairsOf,
|
|
40861
40891
|
createCrmItem,
|
|
40862
40892
|
updateCrmItem,
|