@wirecat/cli-core 0.590.0 → 0.591.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 +58 -0
- package/dist/background/schedules.d.ts +15 -1
- package/dist/background/schedules.js +16 -5
- package/dist/cli/messenger/flooded.d.ts +1 -1
- package/dist/cli/messenger/flooded.js +3 -26
- package/dist/cli/messenger/search-command.d.ts +3 -2
- package/dist/cli/messenger/search-command.js +7 -5
- package/dist/cli/messenger/store-maintenance-command.d.ts +1 -1
- package/dist/cli/schedule/schedule-command.js +23 -12
- package/dist/crm/cli/index.d.ts +57 -0
- package/dist/crm/cli/index.js +300 -0
- package/dist/crm/cli/search-all.d.ts +12 -0
- package/dist/crm/cli/search-all.js +63 -0
- package/dist/crm/index.d.ts +2 -0
- package/dist/crm/index.js +1 -0
- package/dist/crm/source.d.ts +43 -0
- package/dist/crm/source.js +1 -0
- package/dist/crm/sync.d.ts +121 -0
- package/dist/crm/sync.js +291 -0
- package/dist/crm/testing/index.d.ts +3 -0
- package/dist/crm/testing/index.js +3 -0
- package/dist/crm/testing/source-contract.d.ts +17 -0
- package/dist/crm/testing/source-contract.js +137 -0
- package/dist/crm/testing/source.d.ts +33 -0
- package/dist/crm/testing/source.js +126 -0
- package/dist/crm/testing/sync-contract.d.ts +13 -0
- package/dist/crm/testing/sync-contract.js +178 -0
- package/dist/domain/crm.d.ts +82 -0
- package/dist/domain/crm.js +3 -0
- package/dist/entities/deal.d.ts +159 -0
- package/dist/entities/deal.js +86 -0
- package/dist/entities/index.d.ts +143 -0
- package/dist/entities/index.js +5 -0
- package/dist/entities/list-results.d.ts +4 -0
- package/dist/entities/list-results.js +8 -1
- package/dist/errors/reasons.js +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/sends/index.d.ts +1 -1
- package/dist/sends/index.js +1 -1
- package/dist/sends/pace.d.ts +18 -0
- package/dist/sends/pace.js +40 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/dist/store/index.d.ts +2 -1
- package/dist/store/index.js +1 -0
- package/dist/store/sqlite/crm.d.ts +48 -0
- package/dist/store/sqlite/crm.js +318 -0
- package/dist/store/sqlite/deals.d.ts +10 -0
- package/dist/store/sqlite/deals.js +33 -15
- package/dist/store/store.d.ts +3 -0
- package/dist/store/store.js +5 -0
- package/package.json +13 -1
- package/parity.json +16 -0
package/dist/entities/index.d.ts
CHANGED
|
@@ -235,6 +235,147 @@ export declare const ENTITIES: {
|
|
|
235
235
|
readonly updated_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
236
236
|
readonly cursor_age_ms: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
237
237
|
}, undefined>;
|
|
238
|
+
readonly deal: v.StrictObjectSchema<{
|
|
239
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
240
|
+
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
241
|
+
readonly kind: v.PicklistSchema<["deal", "lead"], undefined>;
|
|
242
|
+
readonly title: v.StringSchema<undefined>;
|
|
243
|
+
readonly summary: v.StringSchema<undefined>;
|
|
244
|
+
readonly pipeline: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
245
|
+
readonly pipeline_name: v.StringSchema<undefined>;
|
|
246
|
+
readonly stage: v.StringSchema<undefined>;
|
|
247
|
+
readonly status: v.PicklistSchema<["open", "won", "lost"], undefined>;
|
|
248
|
+
readonly organization: v.NullableSchema<v.StrictObjectSchema<{
|
|
249
|
+
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
250
|
+
readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
251
|
+
readonly owner: v.BooleanSchema<undefined>;
|
|
252
|
+
}, undefined>, undefined>;
|
|
253
|
+
readonly currency: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
254
|
+
readonly amount: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
255
|
+
readonly close_date: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
256
|
+
readonly closed_date: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
257
|
+
readonly closed_reason: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
258
|
+
readonly rank: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
259
|
+
readonly deal: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
260
|
+
readonly account: v.NullableSchema<v.StrictObjectSchema<{
|
|
261
|
+
readonly provider: v.StringSchema<undefined>;
|
|
262
|
+
readonly account: v.StringSchema<undefined>;
|
|
263
|
+
}, undefined>, undefined>;
|
|
264
|
+
readonly external_id: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
265
|
+
readonly people: v.ArraySchema<v.StrictObjectSchema<{
|
|
266
|
+
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
267
|
+
readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
268
|
+
readonly owner: v.BooleanSchema<undefined>;
|
|
269
|
+
readonly role: v.PicklistSchema<["owner", "contact", "decision-maker"], undefined>;
|
|
270
|
+
}, undefined>, undefined>;
|
|
271
|
+
readonly author: v.StrictObjectSchema<{
|
|
272
|
+
readonly type: v.PicklistSchema<["person", "bot"], undefined>;
|
|
273
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
274
|
+
readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
275
|
+
readonly kind: v.NullableSchema<v.PicklistSchema<["agent", "rule"], undefined>, undefined>;
|
|
276
|
+
}, undefined>;
|
|
277
|
+
readonly model: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
278
|
+
readonly source: v.StringSchema<undefined>;
|
|
279
|
+
readonly reason: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
280
|
+
readonly evidence: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
281
|
+
readonly project: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
282
|
+
readonly project_name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
283
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
284
|
+
readonly updated_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
285
|
+
readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
286
|
+
}, undefined>;
|
|
287
|
+
readonly lead: v.StrictObjectSchema<{
|
|
288
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
289
|
+
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
290
|
+
readonly kind: v.PicklistSchema<["deal", "lead"], undefined>;
|
|
291
|
+
readonly title: v.StringSchema<undefined>;
|
|
292
|
+
readonly summary: v.StringSchema<undefined>;
|
|
293
|
+
readonly pipeline: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
294
|
+
readonly pipeline_name: v.StringSchema<undefined>;
|
|
295
|
+
readonly stage: v.StringSchema<undefined>;
|
|
296
|
+
readonly status: v.PicklistSchema<["open", "won", "lost"], undefined>;
|
|
297
|
+
readonly organization: v.NullableSchema<v.StrictObjectSchema<{
|
|
298
|
+
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
299
|
+
readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
300
|
+
readonly owner: v.BooleanSchema<undefined>;
|
|
301
|
+
}, undefined>, undefined>;
|
|
302
|
+
readonly currency: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
303
|
+
readonly amount: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
304
|
+
readonly close_date: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
305
|
+
readonly closed_date: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
306
|
+
readonly closed_reason: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
307
|
+
readonly rank: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
308
|
+
readonly deal: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
309
|
+
readonly account: v.NullableSchema<v.StrictObjectSchema<{
|
|
310
|
+
readonly provider: v.StringSchema<undefined>;
|
|
311
|
+
readonly account: v.StringSchema<undefined>;
|
|
312
|
+
}, undefined>, undefined>;
|
|
313
|
+
readonly external_id: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
314
|
+
readonly people: v.ArraySchema<v.StrictObjectSchema<{
|
|
315
|
+
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
316
|
+
readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
317
|
+
readonly owner: v.BooleanSchema<undefined>;
|
|
318
|
+
readonly role: v.PicklistSchema<["owner", "contact", "decision-maker"], undefined>;
|
|
319
|
+
}, undefined>, undefined>;
|
|
320
|
+
readonly author: v.StrictObjectSchema<{
|
|
321
|
+
readonly type: v.PicklistSchema<["person", "bot"], undefined>;
|
|
322
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
323
|
+
readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
324
|
+
readonly kind: v.NullableSchema<v.PicklistSchema<["agent", "rule"], undefined>, undefined>;
|
|
325
|
+
}, undefined>;
|
|
326
|
+
readonly model: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
327
|
+
readonly source: v.StringSchema<undefined>;
|
|
328
|
+
readonly reason: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
329
|
+
readonly evidence: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
330
|
+
readonly project: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
331
|
+
readonly project_name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
332
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
333
|
+
readonly updated_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
334
|
+
readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
335
|
+
}, undefined>;
|
|
336
|
+
readonly pipeline: v.StrictObjectSchema<{
|
|
337
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
338
|
+
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
339
|
+
readonly name: v.StringSchema<undefined>;
|
|
340
|
+
readonly kind: v.PicklistSchema<["deal", "lead"], undefined>;
|
|
341
|
+
readonly account: v.NullableSchema<v.StrictObjectSchema<{
|
|
342
|
+
readonly provider: v.StringSchema<undefined>;
|
|
343
|
+
readonly account: v.StringSchema<undefined>;
|
|
344
|
+
}, undefined>, undefined>;
|
|
345
|
+
readonly external_id: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
346
|
+
readonly stages: v.ArraySchema<v.StrictObjectSchema<{
|
|
347
|
+
readonly name: v.StringSchema<undefined>;
|
|
348
|
+
readonly position: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
349
|
+
readonly outcome: v.PicklistSchema<["open", "won", "lost"], undefined>;
|
|
350
|
+
readonly external_id: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
351
|
+
readonly open: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
352
|
+
readonly reached: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
353
|
+
readonly conversion: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
354
|
+
}, undefined>, undefined>;
|
|
355
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
356
|
+
readonly totals: v.OptionalSchema<v.StrictObjectSchema<{
|
|
357
|
+
readonly items: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
358
|
+
readonly open: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
359
|
+
readonly won: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
360
|
+
readonly lost: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
361
|
+
readonly win_rate: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
362
|
+
}, undefined>, undefined>;
|
|
363
|
+
readonly since: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>, undefined>;
|
|
364
|
+
readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
365
|
+
}, undefined>;
|
|
366
|
+
readonly stage: v.StrictObjectSchema<{
|
|
367
|
+
readonly name: v.StringSchema<undefined>;
|
|
368
|
+
readonly position: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
369
|
+
readonly outcome: v.PicklistSchema<["open", "won", "lost"], undefined>;
|
|
370
|
+
readonly external_id: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
371
|
+
readonly open: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
372
|
+
readonly reached: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
373
|
+
readonly conversion: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
374
|
+
readonly pipeline: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
375
|
+
readonly pipeline_name: v.StringSchema<undefined>;
|
|
376
|
+
readonly kind: v.PicklistSchema<["deal", "lead"], undefined>;
|
|
377
|
+
readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
378
|
+
}, undefined>;
|
|
238
379
|
readonly message: v.StrictObjectSchema<{
|
|
239
380
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
240
381
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -3970,6 +4111,7 @@ export declare const ENTITIES: {
|
|
|
3970
4111
|
readonly name: v.StringSchema<undefined>;
|
|
3971
4112
|
readonly kind: v.PicklistSchema<["command", "agent"], undefined>;
|
|
3972
4113
|
readonly when: v.StringSchema<undefined>;
|
|
4114
|
+
readonly notify: v.OptionalSchema<v.PicklistSchema<["always", "failures", "never"], undefined>, undefined>;
|
|
3973
4115
|
readonly last: v.NullableSchema<v.StrictObjectSchema<{
|
|
3974
4116
|
readonly at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
3975
4117
|
readonly exit_code: v.NumberSchema<undefined>;
|
|
@@ -3983,6 +4125,7 @@ export declare const ENTITIES: {
|
|
|
3983
4125
|
readonly skipped: v.OptionalSchema<v.StrictObjectSchema<{
|
|
3984
4126
|
readonly at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
3985
4127
|
readonly why: v.StringSchema<undefined>;
|
|
4128
|
+
readonly reason: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
3986
4129
|
}, undefined>, undefined>;
|
|
3987
4130
|
}, undefined>, undefined>;
|
|
3988
4131
|
readonly spent_today_usd: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
package/dist/entities/index.js
CHANGED
|
@@ -29,6 +29,7 @@ import { conversation } from "./conversation.js";
|
|
|
29
29
|
import { conversationPreparation } from "./conversation-preparation.js";
|
|
30
30
|
import { conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationReadiness, } from "./conversation-results.js";
|
|
31
31
|
import { counterRefresh, counters } from "./counters.js";
|
|
32
|
+
import { deal, lead, pipeline, stage } from "./deal.js";
|
|
32
33
|
import { document } from "./document.js";
|
|
33
34
|
import { documentLink } from "./document-link.js";
|
|
34
35
|
import { evidence } from "./evidence.js";
|
|
@@ -100,6 +101,10 @@ import { topic } from "./topic.js";
|
|
|
100
101
|
export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatCoverage, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mailCounts, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reaction, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, responseTimes, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, storeTable, tagChange, tagging, task, taskAnalysis, taskAnalysisMark, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, topic, topicIcon, trackedChat, trackedChatHistory, waitingChats, watchedMessage, watchItem, };
|
|
101
102
|
export const ENTITIES = {
|
|
102
103
|
sync_progress: syncProgress,
|
|
104
|
+
deal,
|
|
105
|
+
lead,
|
|
106
|
+
pipeline,
|
|
107
|
+
stage,
|
|
103
108
|
...MEETING_RESULT_ENTITIES,
|
|
104
109
|
message,
|
|
105
110
|
message_context: messageContext,
|
|
@@ -48,6 +48,8 @@ export declare const scheduledJob: v.StrictObjectSchema<{
|
|
|
48
48
|
readonly name: v.StringSchema<undefined>;
|
|
49
49
|
readonly kind: v.PicklistSchema<["command", "agent"], undefined>;
|
|
50
50
|
readonly when: v.StringSchema<undefined>;
|
|
51
|
+
/** When a finished run shows a desktop notice: `always`, `failures` or `never`; the default is shown, not left out. */
|
|
52
|
+
readonly notify: v.OptionalSchema<v.PicklistSchema<["always", "failures", "never"], undefined>, undefined>;
|
|
51
53
|
readonly last: v.NullableSchema<v.StrictObjectSchema<{
|
|
52
54
|
readonly at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
53
55
|
readonly exit_code: v.NumberSchema<undefined>;
|
|
@@ -62,6 +64,8 @@ export declare const scheduledJob: v.StrictObjectSchema<{
|
|
|
62
64
|
readonly skipped: v.OptionalSchema<v.StrictObjectSchema<{
|
|
63
65
|
readonly at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
|
|
64
66
|
readonly why: v.StringSchema<undefined>;
|
|
67
|
+
/** A dotted id for `why`, so a client can translate it: `cost.day-cap`, `mail.none-new`, `mail.below-threshold`. */
|
|
68
|
+
readonly reason: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
65
69
|
}, undefined>, undefined>;
|
|
66
70
|
}, undefined>, undefined>;
|
|
67
71
|
/** Agent schedules: what today's runs cost, in US dollars. */
|
|
@@ -32,6 +32,8 @@ export const scheduledJob = v.strictObject({
|
|
|
32
32
|
name: text,
|
|
33
33
|
kind: v.picklist(["command", "agent"]),
|
|
34
34
|
when: text,
|
|
35
|
+
/** When a finished run shows a desktop notice: `always`, `failures` or `never`; the default is shown, not left out. */
|
|
36
|
+
notify: v.optional(v.picklist(["always", "failures", "never"])),
|
|
35
37
|
last: v.nullable(v.strictObject({
|
|
36
38
|
at: time,
|
|
37
39
|
exit_code: v.number(),
|
|
@@ -43,7 +45,12 @@ export const scheduledJob = v.strictObject({
|
|
|
43
45
|
failures: v.optional(v.number()),
|
|
44
46
|
cost_usd: v.optional(v.number()),
|
|
45
47
|
/** The last time a run did not start, and why: the day's cost cap, or too little new mail. */
|
|
46
|
-
skipped: v.optional(v.strictObject({
|
|
48
|
+
skipped: v.optional(v.strictObject({
|
|
49
|
+
at: time,
|
|
50
|
+
why: text,
|
|
51
|
+
/** A dotted id for `why`, so a client can translate it: `cost.day-cap`, `mail.none-new`, `mail.below-threshold`. */
|
|
52
|
+
reason: v.optional(v.pipe(text, v.regex(/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)+$/))),
|
|
53
|
+
})),
|
|
47
54
|
})),
|
|
48
55
|
/** Agent schedules: what today's runs cost, in US dollars. */
|
|
49
56
|
spent_today_usd: v.optional(v.number()),
|
package/dist/errors/reasons.js
CHANGED
|
@@ -204,6 +204,7 @@ const OTHERS = [
|
|
|
204
204
|
validation("money.currency", "the currency is not one the store keeps money in"),
|
|
205
205
|
validation("money.quantity", "the quantity is not a decimal above 0"),
|
|
206
206
|
validation("deal.closed", "a deleted deal or lead does not move or close"),
|
|
207
|
+
validation("deal.copy", "a CRM's copy changes in the CRM; its next sync brings the change here"),
|
|
207
208
|
validation("deal.field", "a field of the deal or lead is not valid"),
|
|
208
209
|
validation("deal.ref", "the reference names no deal or lead"),
|
|
209
210
|
validation("deal.stage", "no stage of that name, or a stage name more than one pipeline has"),
|
|
@@ -211,6 +212,10 @@ const OTHERS = [
|
|
|
211
212
|
validation("pipeline.duplicate", "a pipeline of that name and kind is already stored"),
|
|
212
213
|
validation("pipeline.field", "a pipeline needs a name and at least one stage, each named once"),
|
|
213
214
|
["pipeline.not-found", "not_found", "no stored pipeline has that name or reference"],
|
|
215
|
+
validation("crm.stage-unknown", "a CRM item stands in a stage the store does not hold; it was not kept"),
|
|
216
|
+
validation("crm.pipeline-clash", "a CRM pipeline has the id of a stored pipeline of the other kind; it was not kept"),
|
|
217
|
+
validation("crm.item-invalid", "a CRM item has a field the store refuses, such as a currency it does not keep"),
|
|
218
|
+
validation("crm.unlisted-held", "a list of every id would mark most of a kind deleted; nothing was, until --rescan"),
|
|
214
219
|
validation("order.duplicate", "the shop's order with this number is already stored; change its status instead"),
|
|
215
220
|
validation("order.proposed", "the shop's order with this number already waits for the owner in a findings batch"),
|
|
216
221
|
validation("order.field", "a field of the order is not valid"),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { bareCheck, type CheckWords, checkWords } from "./domain/checks.js";
|
|
2
2
|
export type { CounterField, CounterObservation, CounterObservations, CounterState } from "./domain/counters.js";
|
|
3
3
|
export { COUNTER_FIELDS, counterValue, observedCounters } from "./domain/counters.js";
|
|
4
|
+
export { CRM_KINDS, type CrmItem, type CrmKind, type CrmOrganization, type CrmPerson, type CrmPipeline, type CrmRecords, type CrmStage, isItemKind, } from "./domain/crm.js";
|
|
4
5
|
export { DEAL_KINDS, DEAL_ROLES, DEAL_STATUSES, type DealKind, type DealRole, type DealStatus, STAGE_OUTCOMES, type StageOutcome, } from "./domain/deals.js";
|
|
5
6
|
export { FINANCE_REVIEWS, type FinanceReview, INVOICE_DIRECTIONS, INVOICE_STATUSES, type InvoiceDirection, type InvoiceStatus, MONEY_DIRECTIONS, type MoneyDirection, } from "./domain/finance.js";
|
|
6
7
|
export { type FormattedText, type HtmlFormatting, type MarkdownFormatting, type TextSpan, validateFormattedText, } from "./domain/formatting.js";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { bareCheck, checkWords } from "./domain/checks.js";
|
|
2
2
|
export { COUNTER_FIELDS, counterValue, observedCounters } from "./domain/counters.js";
|
|
3
|
+
export { CRM_KINDS, isItemKind, } from "./domain/crm.js";
|
|
3
4
|
export { DEAL_KINDS, DEAL_ROLES, DEAL_STATUSES, STAGE_OUTCOMES, } from "./domain/deals.js";
|
|
4
5
|
export { FINANCE_REVIEWS, INVOICE_DIRECTIONS, INVOICE_STATUSES, MONEY_DIRECTIONS, } from "./domain/finance.js";
|
|
5
6
|
export { validateFormattedText, } from "./domain/formatting.js";
|
package/dist/sends/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { type Asker, type GuardRequest, guardFor, type SendGuard, type SendGuard
|
|
|
4
4
|
export { currentOperation, guardedWrite, type Operated } from "./guarded.js";
|
|
5
5
|
export { type AccountAction, type ChatAction, type SendEntry, SendJournal, type SendKind, type SendOutcome, sendsPathFor, } from "./journal.js";
|
|
6
6
|
export { type KeyedGuard, keyedGuard } from "./keyed-guard.js";
|
|
7
|
-
export { DEFAULT_PACE, type PaceRate, Pacer, pacePathFor } from "./pace.js";
|
|
7
|
+
export { DEFAULT_PACE, type PaceRate, Pacer, pacePathFor, type TurnOptions, waitForTurn } from "./pace.js";
|
|
8
8
|
export { assertOverridesTighten, CEILING_KEY, COMMAND_PATH_KEY, DEFAULT_PERMISSIONS, keyForCommand, keyForWrite, LEVELS, type Level, layerPermissions, levelFor, type PermissionKey, permissionOverrides, readKeysForCommand, skipFlagFor, WRITE_KEYS, } from "./permissions.js";
|
|
9
9
|
export { type Recipient, RecipientList, recipientsPathFor } from "./recipients.js";
|
|
10
10
|
export { newOperationId, newSendId } from "./send-id.js";
|
package/dist/sends/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { guardFor, sendGuard, sharedJournal, } from "./guard.js";
|
|
|
3
3
|
export { currentOperation, guardedWrite } from "./guarded.js";
|
|
4
4
|
export { SendJournal, sendsPathFor, } from "./journal.js";
|
|
5
5
|
export { keyedGuard } from "./keyed-guard.js";
|
|
6
|
-
export { DEFAULT_PACE, Pacer, pacePathFor } from "./pace.js";
|
|
6
|
+
export { DEFAULT_PACE, Pacer, pacePathFor, waitForTurn } from "./pace.js";
|
|
7
7
|
export { assertOverridesTighten, CEILING_KEY, COMMAND_PATH_KEY, DEFAULT_PERMISSIONS, keyForCommand, keyForWrite, LEVELS, layerPermissions, levelFor, permissionOverrides, readKeysForCommand, skipFlagFor, WRITE_KEYS, } from "./permissions.js";
|
|
8
8
|
export { RecipientList, recipientsPathFor } from "./recipients.js";
|
|
9
9
|
export { newOperationId, newSendId } from "./send-id.js";
|
package/dist/sends/pace.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AppIdentity } from "../ports/app.js";
|
|
2
|
+
import type { Warn } from "../runs/events.js";
|
|
2
3
|
/** How fast one profile may ask its messenger, counted across every process using it. */
|
|
3
4
|
export interface PaceRate {
|
|
4
5
|
/** 0 turns pacing off. */
|
|
@@ -30,3 +31,20 @@ export declare class Pacer {
|
|
|
30
31
|
private read;
|
|
31
32
|
private write;
|
|
32
33
|
}
|
|
34
|
+
export interface TurnOptions {
|
|
35
|
+
/** The provider, as a person calls it: `Telegram`, `Bitrix24`. */
|
|
36
|
+
name: string;
|
|
37
|
+
/** The call waiting, as a warning names it. */
|
|
38
|
+
operation: string;
|
|
39
|
+
/** Says so when the wait is long enough to notice, and when the pace file could not be read. */
|
|
40
|
+
warn?: Warn;
|
|
41
|
+
/** Waits; a timer when absent. A test or a cancellable run passes its own. */
|
|
42
|
+
sleep?: (ms: number) => Promise<void>;
|
|
43
|
+
now?: () => number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Waits for this call's turn in the profile's pace, the same wait for every provider: a short one silently, a long
|
|
47
|
+
* one with a warning, and one longer than a run would wait is refused as `rate_limited`, nothing sent. A pace file
|
|
48
|
+
* that cannot be read lets the call go: pacing is a courtesy to the provider, not a lock.
|
|
49
|
+
*/
|
|
50
|
+
export declare const waitForTurn: (pacer: Pacer, options: TurnOptions) => Promise<void>;
|
package/dist/sends/pace.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { resolvePaths } from "@wirecat/cli-base";
|
|
3
|
+
import { CliError, resolvePaths } from "@wirecat/cli-base";
|
|
4
4
|
import { withFileLockAsync } from "./file-lock.js";
|
|
5
5
|
/** One call a second after a burst of 20: what a single `messages sync` already did with its 1 s page pause. */
|
|
6
6
|
export const DEFAULT_PACE = { perMinute: 60, burst: 20 };
|
|
@@ -62,3 +62,42 @@ export class Pacer {
|
|
|
62
62
|
renameSync(temporary, this.path);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
/** Shorter waits pass unannounced; a person at a terminal would not notice them. */
|
|
66
|
+
const ANNOUNCE_WAIT_MS = 5_000;
|
|
67
|
+
/** Longer than this the pace refuses instead of waiting, as a run already ends at a wait this long. */
|
|
68
|
+
const LONGEST_PACE_WAIT_MS = 5 * 60_000;
|
|
69
|
+
/**
|
|
70
|
+
* Waits for this call's turn in the profile's pace, the same wait for every provider: a short one silently, a long
|
|
71
|
+
* one with a warning, and one longer than a run would wait is refused as `rate_limited`, nothing sent. A pace file
|
|
72
|
+
* that cannot be read lets the call go: pacing is a courtesy to the provider, not a lock.
|
|
73
|
+
*/
|
|
74
|
+
export const waitForTurn = async (pacer, options) => {
|
|
75
|
+
const { name, operation, warn } = options;
|
|
76
|
+
const now = options.now ?? Date.now;
|
|
77
|
+
let at = now();
|
|
78
|
+
try {
|
|
79
|
+
at = await pacer.reserve();
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
warn?.(`could not remember ${name}'s wait (${error instanceof Error ? error.message : String(error)})`, {
|
|
83
|
+
event: "warning",
|
|
84
|
+
code: "wait_not_remembered",
|
|
85
|
+
operation,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const waitMs = at - now();
|
|
89
|
+
if (waitMs <= 0)
|
|
90
|
+
return;
|
|
91
|
+
if (waitMs > LONGEST_PACE_WAIT_MS)
|
|
92
|
+
throw new CliError("rate_limited", `${name} asked this profile to wait, ${Math.ceil(waitMs / 1000)} s are left — nothing was sent to ${name}`, { retry_after_ms: waitMs, retry_at: new Date(at).toISOString(), remembered: true });
|
|
93
|
+
if (waitMs >= ANNOUNCE_WAIT_MS) {
|
|
94
|
+
const seconds = Math.ceil(waitMs / 1000);
|
|
95
|
+
warn?.(`waiting ${seconds} s to keep this profile's pace with ${name}`, {
|
|
96
|
+
event: "warning",
|
|
97
|
+
code: "pace_wait",
|
|
98
|
+
operation,
|
|
99
|
+
counts: { seconds },
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
await (options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))))(waitMs);
|
|
103
|
+
};
|
package/dist/services/index.d.ts
CHANGED
|
@@ -185,6 +185,7 @@ export type { QueryMetadata, SearchCoverage } from "./messages-search.js";
|
|
|
185
185
|
export { metadataService } from "./metadata.js";
|
|
186
186
|
export { embedEvents, embedMail, embedNotes, type FoundNote, type LinkedRecord, type NotesEmbedded, type NotesEmbedOptions, type NotesFound, type NotesFoundOf, type NotesQuery, type NotesSearchRequest, nearestNotes, RANK_WITHIN, searchNotes, searchNotesOf, searchNotesQuery, storeQuery, } from "./notes-search.js";
|
|
187
187
|
export { type PackageUpgradeOutcome, type PackageUpgradePorts, type PackageUpgradeResult, type ServerRestarts, upgradePackage, } from "./package-upgrade.js";
|
|
188
|
+
export { patiently } from "./patience.js";
|
|
188
189
|
export { type PersonMeetingContext, type PersonMeetingContextItem, type PersonMeetingContextOptions, type PersonMeetingReadStore, personMeetingContext, } from "./person-meeting-context.js";
|
|
189
190
|
export { privatePeopleService } from "./private-people.js";
|
|
190
191
|
export { approveAsTask, type ProposalTaskStore, proposalSource } from "./proposal-tasks.js";
|
package/dist/services/index.js
CHANGED
|
@@ -143,6 +143,7 @@ export { meaningLane } from "./messages-meaning.js";
|
|
|
143
143
|
export { metadataService } from "./metadata.js";
|
|
144
144
|
export { embedEvents, embedMail, embedNotes, nearestNotes, RANK_WITHIN, searchNotes, searchNotesOf, searchNotesQuery, storeQuery, } from "./notes-search.js";
|
|
145
145
|
export { upgradePackage, } from "./package-upgrade.js";
|
|
146
|
+
export { patiently } from "./patience.js";
|
|
146
147
|
export { personMeetingContext, } from "./person-meeting-context.js";
|
|
147
148
|
export { privatePeopleService } from "./private-people.js";
|
|
148
149
|
export { approveAsTask, proposalSource } from "./proposal-tasks.js";
|
package/dist/store/index.d.ts
CHANGED
|
@@ -34,7 +34,8 @@ export type { BotUpdate, BotUpdateStore } from "./sqlite/bot-updates.js";
|
|
|
34
34
|
export type { CatalogActor, CatalogEntry, CatalogInput, CatalogQuery, CatalogStore } from "./sqlite/catalog.js";
|
|
35
35
|
export { CATALOG_QUERY } from "./sqlite/catalog.js";
|
|
36
36
|
export type { ChatMetadata } from "./sqlite/chats.js";
|
|
37
|
-
export
|
|
37
|
+
export { type CrmCopies, type CrmSaved, type CrmSkipped, crmIdentityId } from "./sqlite/crm.js";
|
|
38
|
+
export type { Deal, DealFilter, DealInput, DealPerson, DealScope, DealsStore, FunnelStage, Pipeline, PipelineInput, PipelineReport, PipelineStage, } from "./sqlite/deals.js";
|
|
38
39
|
export type { Email, EmailAddress, EmailAttachment, EmailFacts, EmailFilter, EmailInput, EmailInThread, EmailLocationInput, EmailRecipient, EmailRef, EmailThread, EmailVectorHit, FolderEmail, Mailbox, MailboxInput, MailFilter, MailStore, PartialEmail, SenderScore, ThreadDetails, ThreadSave, } from "./sqlite/emails.js";
|
|
39
40
|
export { EVENT_FIELDS, type EventChunkToEmbed, type EventHit, type EventQuery, type EventSearch, type NearestEvent, } from "./sqlite/event-search.js";
|
|
40
41
|
export type { EvidenceSource } from "./sqlite/evidence-sources.js";
|
package/dist/store/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export { planProjectAnnotationSnapshot } from "./project-transfer/snapshot-plan.
|
|
|
20
20
|
export { resetAttachmentWords } from "./sqlite/attachment-texts.js";
|
|
21
21
|
export { backfillNormalized, pendingNormalization } from "./sqlite/backfill.js";
|
|
22
22
|
export { CATALOG_QUERY } from "./sqlite/catalog.js";
|
|
23
|
+
export { crmIdentityId } from "./sqlite/crm.js";
|
|
23
24
|
export { EVENT_FIELDS, } from "./sqlite/event-search.js";
|
|
24
25
|
export { IMPORTED_DOCUMENT_QUERY } from "./sqlite/imported-documents.js";
|
|
25
26
|
export { ORGANIZATION_KINDS, PROJECT_TYPES, SCOPES } from "./sqlite/knowledge.js";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CrmItem, CrmKind, CrmOrganization, CrmPerson, CrmPipeline } from "../../domain/crm.js";
|
|
2
|
+
import { type DealKind } from "../../domain/deals.js";
|
|
3
|
+
import type { AccountPeople } from "../people.js";
|
|
4
|
+
import type { AccountKey } from "../types.js";
|
|
5
|
+
import type { StoreContext } from "./open.js";
|
|
6
|
+
/** What the store could not keep, and why: an item whose stage is not stored or whose field it refuses, or a pipeline. */
|
|
7
|
+
export interface CrmSkipped {
|
|
8
|
+
externalId: string;
|
|
9
|
+
reason: "crm.stage-unknown" | "crm.item-invalid" | "crm.pipeline-clash";
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CrmSaved {
|
|
13
|
+
saved: number;
|
|
14
|
+
skipped: CrmSkipped[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A CRM account's copies in the store, written as the CRM has them: nothing waits for review (NEED-2271 A), and
|
|
18
|
+
* nothing is ever matched by name (WC-DATA-6). Rows the CRM no longer has are marked deleted, never removed
|
|
19
|
+
* (WC-DATA-7). Every write is one transaction per call.
|
|
20
|
+
*/
|
|
21
|
+
export interface CrmCopies {
|
|
22
|
+
/** One kind's pipelines and their stages, by the CRM's ids. A stage the CRM dropped stays: deals may stand in it. */
|
|
23
|
+
savePipelines(key: AccountKey, kind: DealKind, pipelines: CrmPipeline[]): Promise<CrmSaved>;
|
|
24
|
+
/** Deals or leads; one whose stage is not stored, or whose fields the store refuses, is skipped and named. */
|
|
25
|
+
saveItems(key: AccountKey, kind: DealKind, items: CrmItem[]): Promise<CrmSaved>;
|
|
26
|
+
/** Contacts, as identities of the account's provider; a contact joins a person only by its exact email. */
|
|
27
|
+
savePeople(key: AccountKey, people: CrmPerson[]): Promise<CrmSaved>;
|
|
28
|
+
/** Companies, each an organization of its own made on first sight, kept apart from any of the same name. */
|
|
29
|
+
saveOrganizations(key: AccountKey, organizations: CrmOrganization[]): Promise<CrmSaved>;
|
|
30
|
+
/** Marks deleted what the CRM said it deleted. Contacts stay: an identity has no deleted mark. Answers how many. */
|
|
31
|
+
remove(key: AccountKey, kind: CrmKind, externalIds: string[]): Promise<number>;
|
|
32
|
+
/**
|
|
33
|
+
* After a complete list of the kind's ids: marks deleted every stored one the list lacks that the CRM has not
|
|
34
|
+
* changed since `before` (epoch ms), so a row made while the list was read is never taken for a deleted one.
|
|
35
|
+
* `dryRun` only counts them.
|
|
36
|
+
*/
|
|
37
|
+
removeUnlisted(key: AccountKey, kind: CrmKind, listed: string[], before: number, options?: {
|
|
38
|
+
dryRun?: boolean;
|
|
39
|
+
}): Promise<number>;
|
|
40
|
+
/** How many of the kind the account holds, not deleted; every contact it ever saved. */
|
|
41
|
+
count(key: AccountKey, kind: CrmKind): Promise<number>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A contact's identity id: identities are unique per provider, and two portals of one CRM both have a contact 5.
|
|
45
|
+
* `contact:` references percent-encode it, so the `/` stays one part.
|
|
46
|
+
*/
|
|
47
|
+
export declare const crmIdentityId: (key: AccountKey, externalId: string, type?: "contact" | "user") => string;
|
|
48
|
+
export declare const crmCopiesOver: (context: StoreContext, people: AccountPeople) => CrmCopies;
|