@wirecat/cli-core 0.753.0 → 1.0.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 +239 -0
- package/README.md +9 -6
- package/THIRD_PARTY_NOTICES +4 -0
- package/dist/analysis/settings.d.ts +3 -1
- package/dist/analysis/settings.js +2 -1
- package/dist/attachments/extract.d.ts +1 -1
- package/dist/attachments/extract.js +1 -1
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/background/deliver.d.ts +3 -0
- package/dist/background/deliver.js +3 -0
- package/dist/background/lock.d.ts +1 -1
- package/dist/background/lock.js +1 -1
- package/dist/background/schedules.d.ts +13 -3
- package/dist/background/schedules.js +13 -3
- package/dist/background/when.d.ts +19 -5
- package/dist/background/when.js +17 -5
- package/dist/calendar/cli/answers.d.ts +1 -0
- package/dist/calendar/cli/answers.js +1 -0
- package/dist/calendar/cli/index.js +3 -1
- package/dist/calendar/feeds.d.ts +2 -0
- package/dist/calendar/feeds.js +10 -1
- package/dist/calendar/source.d.ts +5 -0
- package/dist/calendar/sync.d.ts +7 -1
- package/dist/calendar/sync.js +37 -7
- package/dist/calendar/testing/memory.js +7 -2
- package/dist/calendar/testing/sync-contract.js +2 -1
- package/dist/cli/account-rename.d.ts +3 -0
- package/dist/cli/account-rename.js +2 -1
- package/dist/cli/after-dashes.d.ts +1 -0
- package/dist/cli/after-dashes.js +1 -0
- package/dist/cli/agent-evaluation.d.ts +8 -1
- package/dist/cli/agent-evaluation.js +4 -1
- package/dist/cli/app-doctor-command.d.ts +1 -0
- package/dist/cli/app-doctor-command.js +1 -0
- package/dist/cli/ask-before-write.d.ts +1 -0
- package/dist/cli/ask-before-write.js +1 -0
- package/dist/cli/author.d.ts +1 -1
- package/dist/cli/author.js +1 -1
- package/dist/cli/base-stages-command.d.ts +2 -0
- package/dist/cli/base-stages-command.js +1 -0
- package/dist/cli/bot/api-http.d.ts +9 -3
- package/dist/cli/bot/api-http.js +7 -3
- package/dist/cli/bot/api-input.d.ts +8 -2
- package/dist/cli/bot/api-input.js +9 -3
- package/dist/cli/bot/api-rpc.d.ts +3 -1
- package/dist/cli/bot/api-rpc.js +2 -1
- package/dist/cli/bot/api.d.ts +1 -1
- package/dist/cli/bot/api.js +7 -1
- package/dist/cli/bot/context.d.ts +3 -2
- package/dist/cli/bot/context.js +1 -1
- package/dist/cli/bot/copy.d.ts +1 -0
- package/dist/cli/bot/messages.d.ts +5 -2
- package/dist/cli/bot/messages.js +5 -2
- package/dist/cli/bot/port.d.ts +10 -6
- package/dist/cli/bot/port.js +1 -1
- package/dist/cli/bot/registry.d.ts +6 -3
- package/dist/cli/bot/registry.js +6 -3
- package/dist/cli/bot/updates.d.ts +2 -1
- package/dist/cli/bot/updates.js +2 -1
- package/dist/cli/call-stats-command.d.ts +3 -0
- package/dist/cli/call-stats-command.js +1 -0
- package/dist/cli/command-contract.d.ts +3 -0
- package/dist/cli/command-contract.js +2 -0
- package/dist/cli/command-runs.d.ts +3 -1
- package/dist/cli/command-runs.js +2 -1
- package/dist/cli/commander-internals.d.ts +16 -0
- package/dist/cli/commander-internals.js +17 -0
- package/dist/cli/commands-command.d.ts +1 -0
- package/dist/cli/commands-command.js +3 -1
- package/dist/cli/compact.d.ts +13 -8
- package/dist/cli/compact.js +9 -6
- package/dist/cli/config-command.d.ts +3 -3
- package/dist/cli/config-command.js +4 -4
- package/dist/cli/config-issues.d.ts +7 -3
- package/dist/cli/config-issues.js +7 -3
- package/dist/cli/config-keys.d.ts +4 -1
- package/dist/cli/config-keys.js +4 -1
- package/dist/cli/context.d.ts +6 -2
- package/dist/cli/context.js +5 -1
- package/dist/cli/contract-evidence.d.ts +1 -0
- package/dist/cli/contract-evidence.js +1 -0
- package/dist/cli/csv.d.ts +3 -2
- package/dist/cli/csv.js +3 -2
- package/dist/cli/default-config.d.ts +2 -0
- package/dist/cli/default-config.js +2 -0
- package/dist/cli/doctor-reports-command.d.ts +5 -1
- package/dist/cli/doctor-reports-command.js +4 -1
- package/dist/cli/documents/catalog.js +2 -1
- package/dist/cli/documents/file-conflicts.js +2 -1
- package/dist/cli/documents/file-edit.js +5 -4
- package/dist/cli/documents/file-mirrors.js +4 -3
- package/dist/cli/documents/file-update.js +2 -1
- package/dist/cli/documents/folders.js +2 -1
- package/dist/cli/documents/words.d.ts +1 -1
- package/dist/cli/early-refusal.d.ts +4 -4
- package/dist/cli/early-refusal.js +4 -4
- package/dist/cli/effects.d.ts +41 -11
- package/dist/cli/effects.js +48 -13
- package/dist/cli/entry.d.ts +4 -1
- package/dist/cli/entry.js +4 -1
- package/dist/cli/envelope.d.ts +14 -4
- package/dist/cli/envelope.js +14 -4
- package/dist/cli/execution.d.ts +1 -0
- package/dist/cli/execution.js +1 -0
- package/dist/cli/findings-input.d.ts +10 -2
- package/dist/cli/findings-input.js +10 -2
- package/dist/cli/first-run.d.ts +9 -2
- package/dist/cli/first-run.js +7 -1
- package/dist/cli/group-lock.d.ts +6 -0
- package/dist/cli/group-lock.js +5 -0
- package/dist/cli/guide.d.ts +5 -2
- package/dist/cli/guide.js +8 -4
- package/dist/cli/help/command-help.d.ts +12 -4
- package/dist/cli/help/command-help.js +13 -6
- package/dist/cli/help/first-screen.d.ts +2 -0
- package/dist/cli/help/first-screen.js +2 -0
- package/dist/cli/help/sections.d.ts +1 -0
- package/dist/cli/help/sections.js +1 -0
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +2 -1
- package/dist/cli/input-policy.d.ts +3 -0
- package/dist/cli/input-policy.js +3 -0
- package/dist/cli/json-fields.d.ts +1 -0
- package/dist/cli/json-fields.js +1 -0
- package/dist/cli/list-query.d.ts +11 -5
- package/dist/cli/list-query.js +11 -5
- package/dist/cli/listings.d.ts +13 -5
- package/dist/cli/listings.js +12 -5
- package/dist/cli/local-times.d.ts +3 -2
- package/dist/cli/local-times.js +2 -1
- package/dist/cli/mcp-server-command.d.ts +4 -1
- package/dist/cli/mcp-server-command.js +2 -0
- package/dist/cli/meeting-batch.d.ts +2 -1
- package/dist/cli/meeting-batch.js +2 -1
- package/dist/cli/meeting-evidence-answer.d.ts +2 -2
- package/dist/cli/meeting-evidence-answer.js +2 -2
- package/dist/cli/meeting-meaning-command.d.ts +5 -0
- package/dist/cli/meeting-meaning-command.js +2 -0
- package/dist/cli/meeting-passage-text.d.ts +1 -0
- package/dist/cli/meeting-passage-text.js +1 -0
- package/dist/cli/meeting-preparation-answer.d.ts +1 -0
- package/dist/cli/meeting-preparation-answer.js +1 -0
- package/dist/cli/meeting-preparation-read.d.ts +2 -0
- package/dist/cli/meeting-preparation-read.js +2 -0
- package/dist/cli/meeting-project-candidates-read.d.ts +1 -0
- package/dist/cli/meeting-project-candidates-read.js +1 -0
- package/dist/cli/meeting-results.d.ts +4 -1
- package/dist/cli/meeting-results.js +4 -1
- package/dist/cli/meeting-series-inventory-read.d.ts +2 -0
- package/dist/cli/meeting-series-inventory-read.js +1 -0
- package/dist/cli/meeting-tags-command.d.ts +2 -0
- package/dist/cli/meeting-tags-command.js +1 -0
- package/dist/cli/messenger/admin-folders-command.js +2 -1
- package/dist/cli/messenger/admin-moderation-command.d.ts +1 -1
- package/dist/cli/messenger/admin-moderation-command.js +1 -1
- package/dist/cli/messenger/ask.d.ts +1 -1
- package/dist/cli/messenger/ask.js +1 -1
- package/dist/cli/messenger/context.d.ts +2 -1
- package/dist/cli/messenger/context.js +1 -0
- package/dist/cli/messenger/doctor-command.d.ts +2 -1
- package/dist/cli/messenger/doctor-command.js +2 -1
- package/dist/cli/messenger/inbox.d.ts +2 -2
- package/dist/cli/messenger/inbox.js +2 -2
- package/dist/cli/messenger/lacks.d.ts +1 -0
- package/dist/cli/messenger/lacks.js +5 -3
- package/dist/cli/messenger/mcp-command.d.ts +8 -3
- package/dist/cli/messenger/mcp-command.js +6 -2
- package/dist/cli/messenger/message-items.d.ts +3 -1
- package/dist/cli/messenger/message-items.js +1 -0
- package/dist/cli/messenger/messages-delete-command.d.ts +1 -1
- package/dist/cli/messenger/messages-delete-command.js +1 -1
- package/dist/cli/messenger/report.d.ts +4 -1
- package/dist/cli/messenger/report.js +2 -0
- package/dist/cli/messenger/search-answers.d.ts +10 -4
- package/dist/cli/messenger/search-answers.js +6 -2
- package/dist/cli/messenger/searches-command.d.ts +4 -1
- package/dist/cli/messenger/searches-command.js +4 -1
- package/dist/cli/messenger/serve-command.d.ts +1 -1
- package/dist/cli/messenger/serve-command.js +1 -1
- package/dist/cli/messenger/serve-members.d.ts +4 -1
- package/dist/cli/messenger/serve-members.js +3 -1
- package/dist/cli/messenger/serve-outdated.d.ts +8 -3
- package/dist/cli/messenger/serve-outdated.js +8 -3
- package/dist/cli/messenger/serve-relay.d.ts +1 -1
- package/dist/cli/messenger/serve-relay.js +1 -1
- package/dist/cli/messenger/serve-stems.d.ts +4 -0
- package/dist/cli/messenger/serve-stems.js +3 -0
- package/dist/cli/messenger/server-command.d.ts +1 -1
- package/dist/cli/messenger/server-command.js +1 -1
- package/dist/cli/messenger/store-maintenance-command.d.ts +1 -0
- package/dist/cli/messenger/store-maintenance-command.js +9 -4
- package/dist/cli/messenger/stored.d.ts +2 -0
- package/dist/cli/messenger/stored.js +1 -0
- package/dist/cli/messenger/tasks-command.d.ts +1 -0
- package/dist/cli/messenger/tasks-command.js +1 -0
- package/dist/cli/model-catalogue-command.d.ts +1 -0
- package/dist/cli/model-catalogue-command.js +1 -0
- package/dist/cli/oauth-session.d.ts +14 -4
- package/dist/cli/oauth-session.js +9 -2
- package/dist/cli/option-hints.js +3 -4
- package/dist/cli/paging.d.ts +1 -0
- package/dist/cli/paging.js +1 -0
- package/dist/cli/path-options.d.ts +37 -0
- package/dist/cli/path-options.js +85 -0
- package/dist/cli/permission-keys.d.ts +10 -4
- package/dist/cli/permission-keys.js +9 -3
- package/dist/cli/profile.d.ts +5 -1
- package/dist/cli/profile.js +5 -1
- package/dist/cli/program.js +3 -0
- package/dist/cli/project-evidence.d.ts +9 -1
- package/dist/cli/project-evidence.js +8 -1
- package/dist/cli/project-status-rows.d.ts +2 -1
- package/dist/cli/project-status-rows.js +2 -1
- package/dist/cli/project-status.d.ts +12 -4
- package/dist/cli/project-status.js +10 -4
- package/dist/cli/provider-refs.d.ts +1 -1
- package/dist/cli/provider-refs.js +1 -1
- package/dist/cli/relay-route.js +5 -14
- package/dist/cli/result-fields.d.ts +2 -0
- package/dist/cli/result-fields.js +2 -0
- package/dist/cli/schedule/harnesses.d.ts +10 -5
- package/dist/cli/schedule/harnesses.js +9 -5
- package/dist/cli/schedule/schedule-command.d.ts +16 -6
- package/dist/cli/schedule/schedule-command.js +11 -4
- package/dist/cli/search-left-out.d.ts +5 -1
- package/dist/cli/search-left-out.js +3 -1
- package/dist/cli/service-api-call.d.ts +1 -1
- package/dist/cli/service-api-manifest.d.ts +9 -2
- package/dist/cli/service-api-manifest.js +5 -1
- package/dist/cli/service-api.d.ts +5 -2
- package/dist/cli/service-api.js +7 -2
- package/dist/cli/settings.d.ts +9 -3
- package/dist/cli/settings.js +7 -2
- package/dist/cli/setup-answers.d.ts +3 -0
- package/dist/cli/setup-answers.js +1 -0
- package/dist/cli/shadowed-options.d.ts +1 -1
- package/dist/cli/shadowed-options.js +1 -1
- package/dist/cli/shared-command-exports.d.ts +22 -0
- package/dist/cli/shared-command-exports.js +22 -0
- package/dist/cli/steps.d.ts +5 -1
- package/dist/cli/steps.js +5 -1
- package/dist/cli/store-info.d.ts +2 -0
- package/dist/cli/store-info.js +1 -0
- package/dist/cli/store-recover.d.ts +9 -3
- package/dist/cli/store-recover.js +7 -3
- package/dist/cli/store-settings.d.ts +7 -2
- package/dist/cli/store-settings.js +7 -2
- package/dist/cli/templates-command.d.ts +1 -0
- package/dist/cli/unknown-profile.d.ts +1 -1
- package/dist/cli/unknown-profile.js +1 -1
- package/dist/content/cli/index.js +3 -1
- package/dist/content/sync.d.ts +2 -0
- package/dist/content/sync.js +8 -3
- package/dist/content/testing/sync-contract.js +6 -2
- package/dist/content/writer.d.ts +1 -1
- package/dist/content/writer.js +1 -1
- package/dist/context/evidence.d.ts +4 -0
- package/dist/crm/cli/files.d.ts +1 -1
- package/dist/crm/cli/files.js +3 -2
- package/dist/crm/cli/index.d.ts +1 -1
- package/dist/crm/cli/index.js +5 -4
- package/dist/crm/cli/records.d.ts +1 -1
- package/dist/crm/cli/records.js +1 -1
- package/dist/crm/digest.d.ts +1 -1
- package/dist/crm/foreign-contacts.d.ts +2 -2
- package/dist/crm/foreign-contacts.js +2 -2
- package/dist/crm/manifest/map.d.ts +5 -2
- package/dist/crm/manifest/map.js +14 -2
- package/dist/crm/manifest/paths.d.ts +1 -1
- package/dist/crm/source.d.ts +2 -2
- package/dist/crm/sync.d.ts +6 -2
- package/dist/crm/sync.js +16 -6
- package/dist/crm/testing/manifest-fake.d.ts +2 -1
- package/dist/crm/testing/manifest-fake.js +1 -1
- package/dist/crm/testing/sync-contract.js +7 -2
- package/dist/crm/viewer.d.ts +2 -2
- package/dist/crm/viewer.js +2 -2
- package/dist/crm/writes.d.ts +2 -2
- package/dist/crm/writes.js +1 -1
- package/dist/domain/addresses.d.ts +7 -3
- package/dist/domain/addresses.js +7 -3
- package/dist/domain/business.d.ts +21 -4
- package/dist/domain/business.js +11 -4
- package/dist/domain/categories.d.ts +1 -1
- package/dist/domain/categories.js +1 -1
- package/dist/domain/config-repair.d.ts +1 -1
- package/dist/domain/config-repair.js +1 -1
- package/dist/domain/counters.d.ts +4 -0
- package/dist/domain/counters.js +2 -0
- package/dist/domain/crm.d.ts +18 -7
- package/dist/domain/crm.js +11 -4
- package/dist/domain/deals.d.ts +6 -3
- package/dist/domain/deals.js +4 -3
- package/dist/domain/display-names.d.ts +3 -1
- package/dist/domain/display-names.js +2 -0
- package/dist/domain/finance.d.ts +8 -2
- package/dist/domain/finance.js +4 -2
- package/dist/domain/formatting.d.ts +1 -0
- package/dist/domain/knowledge.d.ts +6 -1
- package/dist/domain/knowledge.js +6 -1
- package/dist/domain/links.d.ts +14 -2
- package/dist/domain/links.js +11 -2
- package/dist/domain/locator.d.ts +4 -1
- package/dist/domain/locator.js +3 -1
- package/dist/domain/markdown.d.ts +1 -0
- package/dist/domain/markdown.js +1 -0
- package/dist/domain/models.d.ts +38 -15
- package/dist/domain/models.js +6 -3
- package/dist/domain/money.d.ts +14 -4
- package/dist/domain/money.js +10 -3
- package/dist/domain/orders.d.ts +4 -1
- package/dist/domain/orders.js +2 -1
- package/dist/domain/organization-sectors.d.ts +10 -0
- package/dist/domain/organization-sectors.generated.d.ts +11 -0
- package/dist/domain/organization-sectors.generated.js +14 -0
- package/dist/domain/organization-sectors.js +9 -0
- package/dist/domain/person-kinds.d.ts +4 -2
- package/dist/domain/person-kinds.js +1 -0
- package/dist/domain/phones.d.ts +2 -0
- package/dist/domain/phones.js +1 -0
- package/dist/domain/polls.d.ts +1 -0
- package/dist/domain/polls.js +1 -0
- package/dist/domain/providers.d.ts +22 -7
- package/dist/domain/providers.js +22 -7
- package/dist/domain/rankings-graph.d.ts +2 -0
- package/dist/domain/rankings-options.d.ts +5 -0
- package/dist/domain/rankings-options.js +1 -0
- package/dist/domain/record-types.d.ts +5 -1
- package/dist/domain/record-types.js +1 -0
- package/dist/domain/records-table.d.ts +18 -3
- package/dist/domain/records-table.js +11 -2
- package/dist/domain/records.d.ts +18 -2
- package/dist/domain/records.js +8 -1
- package/dist/domain/ref-summaries.d.ts +22 -5
- package/dist/domain/ref-summaries.js +9 -2
- package/dist/domain/references.d.ts +4 -2
- package/dist/domain/references.js +3 -2
- package/dist/domain/relation-role-labels.d.ts +5 -1
- package/dist/domain/relation-role-labels.js +4 -1
- package/dist/domain/relations.d.ts +32 -8
- package/dist/domain/relations.js +28 -8
- package/dist/domain/send-time.d.ts +1 -2
- package/dist/domain/send-time.js +1 -2
- package/dist/domain/tag-consolidation.d.ts +5 -0
- package/dist/domain/tag-redirects.d.ts +4 -1
- package/dist/domain/tag-redirects.js +1 -1
- package/dist/domain/tags.d.ts +2 -0
- package/dist/domain/tags.js +1 -0
- package/dist/domain/vcard.d.ts +4 -1
- package/dist/domain/vcard.js +2 -1
- package/dist/entities/business-context.d.ts +10 -4
- package/dist/entities/business-context.js +10 -4
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/knowledge-lists.d.ts +4 -0
- package/dist/entities/knowledge-lists.js +5 -0
- package/dist/entities/list-results.d.ts +1 -0
- package/dist/entities/list-results.js +1 -0
- package/dist/entities/listings.d.ts +12 -5
- package/dist/entities/listings.js +12 -5
- package/dist/entities/note.d.ts +1 -0
- package/dist/entities/note.js +1 -0
- package/dist/entities/store-records.d.ts +1 -0
- package/dist/entities/store-records.js +1 -0
- package/dist/errors/failures.d.ts +3 -1
- package/dist/errors/failures.js +3 -1
- package/dist/errors/reasons.d.ts +1 -0
- package/dist/errors/reasons.js +17 -41
- package/dist/errors/store-reasons.d.ts +5 -0
- package/dist/errors/store-reasons.js +62 -0
- package/dist/http/link-fetch.d.ts +1 -0
- package/dist/http/link-fetch.js +1 -0
- package/dist/http/public-url.d.ts +6 -2
- package/dist/http/public-url.js +6 -2
- package/dist/kit/contract.d.ts +1 -1
- package/dist/kit/contract.js +1 -1
- package/dist/kit/fake.d.ts +2 -1
- package/dist/kit/fake.js +1 -0
- package/dist/kit/run-scope.js +2 -1
- package/dist/kit/search-recipes.d.ts +2 -0
- package/dist/kit/search-recipes.js +1 -0
- package/dist/kit/seed.d.ts +3 -2
- package/dist/kit/seed.js +3 -2
- package/dist/mail/findings.d.ts +1 -1
- package/dist/mail/findings.js +1 -1
- package/dist/mail/score.d.ts +2 -0
- package/dist/mail/score.js +9 -2
- package/dist/mail/sync.js +18 -9
- package/dist/mcp/agent.d.ts +4 -1
- package/dist/mcp/agent.js +2 -1
- package/dist/mcp/all-profiles.d.ts +12 -4
- package/dist/mcp/all-profiles.js +10 -3
- package/dist/mcp/bot/instructions.d.ts +4 -1
- package/dist/mcp/bot/instructions.js +4 -1
- package/dist/mcp/caller.d.ts +1 -0
- package/dist/mcp/caller.js +1 -0
- package/dist/mcp/http/oauth.d.ts +2 -1
- package/dist/mcp/http/oauth.js +2 -1
- package/dist/mcp/http/serve.d.ts +4 -1
- package/dist/mcp/http/serve.js +3 -1
- package/dist/mcp/http/state.d.ts +1 -1
- package/dist/mcp/http/state.js +1 -1
- package/dist/mcp/meeting-preparation.d.ts +5 -1
- package/dist/mcp/meeting-preparation.js +5 -1
- package/dist/mcp/meeting-project-candidates.d.ts +2 -0
- package/dist/mcp/meeting-project-candidates.js +2 -0
- package/dist/mcp/meeting-series-inventory.d.ts +2 -0
- package/dist/mcp/meeting-series-inventory.js +2 -0
- package/dist/mcp/prompts.d.ts +1 -0
- package/dist/mcp/prompts.js +1 -0
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/session.d.ts +2 -2
- package/dist/mcp/session.js +2 -2
- package/dist/mcp/surface.d.ts +3 -2
- package/dist/mcp/surface.js +2 -1
- package/dist/meetings/cli/query-options.js +3 -2
- package/dist/meetings/event-store.d.ts +7 -2
- package/dist/meetings/findings-rules.d.ts +2 -0
- package/dist/meetings/findings.d.ts +5 -0
- package/dist/meetings/mcp/agent-text.d.ts +12 -4
- package/dist/meetings/mcp/agent-text.js +12 -4
- package/dist/meetings/mcp/index.d.ts +24 -24
- package/dist/meetings/payment.d.ts +15 -3
- package/dist/meetings/payment.js +14 -3
- package/dist/meetings/read-store.d.ts +8 -0
- package/dist/meetings/reference.d.ts +3 -0
- package/dist/meetings/reference.js +3 -0
- package/dist/meetings/result-items.d.ts +1 -0
- package/dist/meetings/result-items.js +1 -0
- package/dist/meetings/transcript-store.d.ts +0 -1
- package/dist/moderation/check.d.ts +3 -1
- package/dist/moderation/check.js +2 -0
- package/dist/moderation/rules.d.ts +5 -2
- package/dist/moderation/rules.js +5 -3
- package/dist/ports/app.d.ts +1 -0
- package/dist/ports/app.js +1 -0
- package/dist/ports/messenger.d.ts +55 -27
- package/dist/ports/traits.d.ts +4 -1
- package/dist/ports/wirecat-tools.d.ts +1 -1
- package/dist/ports/wirecat-tools.js +1 -1
- package/dist/readers/engine.d.ts +2 -2
- package/dist/readers/engine.js +2 -2
- package/dist/render/messages.d.ts +7 -1
- package/dist/render/messages.js +6 -1
- package/dist/replies/dry-run.d.ts +1 -0
- package/dist/replies/dry-run.js +1 -0
- package/dist/replies/rendering.d.ts +2 -0
- package/dist/replies/rendering.js +1 -0
- package/dist/replies/rules.d.ts +1 -2
- package/dist/replies/rules.js +1 -2
- package/dist/replies/serve.d.ts +8 -2
- package/dist/replies/serve.js +6 -1
- package/dist/replies/state.d.ts +1 -0
- package/dist/replies/state.js +1 -0
- package/dist/resolve.d.ts +5 -1
- package/dist/resolve.js +5 -1
- package/dist/runs/events.d.ts +3 -2
- package/dist/runs/events.js +2 -1
- package/dist/runs/log-events.d.ts +4 -1
- package/dist/runs/log-events.js +4 -1
- package/dist/runs/provider-log.d.ts +9 -1
- package/dist/runs/provider-log.js +8 -1
- package/dist/runs/recording.d.ts +9 -1
- package/dist/runs/recording.js +7 -1
- package/dist/runs/run-context.d.ts +1 -0
- package/dist/runs/run-context.js +1 -0
- package/dist/runs/run.d.ts +1 -0
- package/dist/runs/run.js +1 -0
- package/dist/runs/scope.d.ts +1 -0
- package/dist/runs/scope.js +1 -0
- package/dist/search/languages.d.ts +4 -1
- package/dist/search/languages.js +4 -1
- package/dist/search/question-plan.d.ts +3 -3
- package/dist/search/question-plan.js +3 -3
- package/dist/search/service-query.d.ts +7 -2
- package/dist/search/service-query.js +2 -0
- package/dist/sends/buttons.d.ts +7 -3
- package/dist/sends/buttons.js +6 -3
- package/dist/sends/flood.d.ts +3 -1
- package/dist/sends/flood.js +3 -1
- package/dist/sends/guard.d.ts +1 -0
- package/dist/sends/guard.js +1 -0
- package/dist/sends/guarded.d.ts +4 -1
- package/dist/sends/guarded.js +4 -1
- package/dist/sends/journal.d.ts +2 -2
- package/dist/sends/pace.d.ts +6 -1
- package/dist/sends/pace.js +5 -1
- package/dist/sends/permissions.d.ts +14 -9
- package/dist/sends/permissions.js +13 -8
- package/dist/sends/polls.d.ts +6 -3
- package/dist/sends/polls.js +6 -3
- package/dist/sends/recipients.d.ts +1 -0
- package/dist/sends/recipients.js +1 -0
- package/dist/sends/send-as.d.ts +1 -1
- package/dist/sends/send-as.js +1 -1
- package/dist/sends/upload.d.ts +6 -2
- package/dist/sends/upload.js +6 -2
- package/dist/services/business-context.d.ts +2 -2
- package/dist/services/business-context.js +1 -1
- package/dist/services/deal-context.d.ts +1 -1
- package/dist/services/documents/ports.d.ts +0 -2
- package/dist/services/embeddings.d.ts +3 -3
- package/dist/services/inbox.d.ts +6 -2
- package/dist/services/inbox.js +5 -1
- package/dist/services/index.d.ts +0 -1
- package/dist/services/index.js +0 -1
- package/dist/services/metadata.d.ts +1 -1
- package/dist/services/moderation.d.ts +1 -1
- package/dist/services/moment.d.ts +1 -0
- package/dist/services/moment.js +1 -0
- package/dist/services/organization-context.d.ts +1 -1
- package/dist/services/people.d.ts +2 -2
- package/dist/services/people.js +1 -1
- package/dist/services/person-business.d.ts +1 -1
- package/dist/services/questions.d.ts +1 -0
- package/dist/services/questions.js +1 -0
- package/dist/services/search-all-rank.d.ts +44 -0
- package/dist/services/search-all-rank.js +112 -0
- package/dist/services/search-all-tracker.d.ts +58 -0
- package/dist/services/search-all-tracker.js +155 -0
- package/dist/services/search-all.d.ts +2 -9
- package/dist/services/search-all.js +19 -200
- package/dist/services/task-rules.d.ts +1 -0
- package/dist/services/task-rules.js +1 -0
- package/dist/services/tasks.d.ts +2 -0
- package/dist/services/tasks.js +2 -0
- package/dist/services/tracker-meaning.js +1 -1
- package/dist/setup/document.d.ts +20 -4
- package/dist/setup/document.js +20 -4
- package/dist/setup/plain.d.ts +1 -0
- package/dist/setup/plain.js +1 -0
- package/dist/speech/hearing.d.ts +1 -1
- package/dist/speech/hearing.js +1 -1
- package/dist/speech/models.d.ts +1 -1
- package/dist/sqlite-runtime.d.ts +2 -0
- package/dist/sqlite-runtime.js +2 -0
- package/dist/store/account-store.d.ts +3 -2
- package/dist/store/accounts.d.ts +1 -0
- package/dist/store/areas.d.ts +41 -0
- package/dist/store/areas.js +17 -0
- package/dist/store/attachments.d.ts +2 -0
- package/dist/store/conversations.d.ts +1 -0
- package/dist/store/counters.d.ts +2 -0
- package/dist/store/damage.d.ts +4 -1
- package/dist/store/damage.js +2 -1
- package/dist/store/decision-requests.d.ts +10 -3
- package/dist/store/decision-requests.js +9 -3
- package/dist/store/decisions.d.ts +5 -1
- package/dist/store/decisions.js +4 -1
- package/dist/store/document-transfer/index.d.ts +2 -0
- package/dist/store/document-transfer/index.js +2 -0
- package/dist/store/document-transfer/model.d.ts +3 -0
- package/dist/store/driver.d.ts +2 -0
- package/dist/store/driver.js +1 -0
- package/dist/store/evidence-findings.d.ts +10 -2
- package/dist/store/evidence-findings.js +2 -0
- package/dist/store/health.d.ts +4 -1
- package/dist/store/health.js +2 -1
- package/dist/store/identity-links.d.ts +13 -4
- package/dist/store/identity-links.js +4 -1
- package/dist/store/identity-splits.d.ts +2 -1
- package/dist/store/identity-splits.js +1 -0
- package/dist/store/index.d.ts +2 -1
- package/dist/store/knowledge-query.d.ts +3 -0
- package/dist/store/knowledge-query.js +3 -0
- package/dist/store/mail-findings.d.ts +4 -1
- package/dist/store/mail-findings.js +1 -0
- package/dist/store/marks.d.ts +20 -3
- package/dist/store/marks.js +12 -1
- package/dist/store/meeting-findings.d.ts +2 -0
- package/dist/store/mentions.d.ts +2 -0
- package/dist/store/message-store.d.ts +219 -0
- package/dist/store/message-store.js +1 -0
- package/dist/store/messages.d.ts +1 -0
- package/dist/store/migrations.d.ts +8 -0
- package/dist/store/migrations.js +59 -6
- package/dist/store/open.d.ts +1 -1
- package/dist/store/open.js +1 -1
- package/dist/store/people.d.ts +27 -5
- package/dist/store/people.js +15 -1
- package/dist/store/project-transfer/manifest.d.ts +3 -1
- package/dist/store/project-transfer/manifest.js +3 -1
- package/dist/store/project-transfer/plan.d.ts +3 -1
- package/dist/store/project-transfer/plan.js +1 -1
- package/dist/store/project-transfer/preview.d.ts +2 -0
- package/dist/store/project-transfer/preview.js +1 -0
- package/dist/store/project-transfer/schema.d.ts +1 -0
- package/dist/store/project-transfer/snapshot-model.d.ts +4 -0
- package/dist/store/project-transfer/snapshot-model.js +3 -0
- package/dist/store/project-transfer/snapshot-plan.d.ts +2 -1
- package/dist/store/project-transfer/snapshot-plan.js +1 -1
- package/dist/store/project-transfer/snapshot.d.ts +3 -1
- package/dist/store/project-transfer/snapshot.js +1 -1
- package/dist/store/project-transfer/store.d.ts +4 -1
- package/dist/store/providers.d.ts +1 -0
- package/dist/store/providers.js +1 -0
- package/dist/store/public.d.ts +40 -0
- package/dist/store/public.js +30 -0
- package/dist/store/queries.d.ts +1 -1
- package/dist/store/repair.d.ts +2 -2
- package/dist/store/repair.js +2 -2
- package/dist/store/roster.d.ts +1 -0
- package/dist/store/search-index.d.ts +1 -0
- package/dist/store/searches.d.ts +1 -0
- package/dist/store/source-review.d.ts +13 -6
- package/dist/store/source-review.js +2 -1
- package/dist/store/sqlite/calendar.js +7 -2
- package/dist/store/sqlite/completeness.d.ts +1 -1
- package/dist/store/sqlite/completeness.js +1 -1
- package/dist/store/sqlite/conversations.d.ts +1 -1
- package/dist/store/sqlite/conversations.js +1 -1
- package/dist/store/sqlite/copy-viewer.d.ts +1 -1
- package/dist/store/sqlite/crm-activities.d.ts +1 -1
- package/dist/store/sqlite/crm-activity-chunks.d.ts +3 -2
- package/dist/store/sqlite/crm-activity-chunks.js +3 -2
- package/dist/store/sqlite/crm-changes.d.ts +1 -1
- package/dist/store/sqlite/crm-files.d.ts +1 -1
- package/dist/store/sqlite/crm-settings.d.ts +1 -1
- package/dist/store/sqlite/crm-settings.js +1 -1
- package/dist/store/sqlite/crm.d.ts +2 -2
- package/dist/store/sqlite/domain-organizations.d.ts +33 -0
- package/dist/store/sqlite/domain-organizations.js +230 -0
- package/dist/store/sqlite/drizzle/core.d.ts +1 -1
- package/dist/store/sqlite/drizzle/core.js +36 -0
- package/dist/store/sqlite/drizzle/core.js.map +4 -4
- package/dist/store/sqlite/identity-link-rows.d.ts +1 -1
- package/dist/store/sqlite/identity-link-rows.js +1 -1
- package/dist/store/sqlite/knowledge.d.ts +2 -9
- package/dist/store/sqlite/manifest.js +107 -0
- package/dist/store/sqlite/meeting-documents.js +0 -6
- package/dist/store/sqlite/messages.d.ts +1 -1
- package/dist/store/sqlite/messages.js +1 -1
- package/dist/store/sqlite/migrations.generated.js +673 -0
- package/dist/store/sqlite/name-traces.d.ts +1 -1
- package/dist/store/sqlite/name-traces.js +1 -1
- package/dist/store/sqlite/organization-categories.d.ts +1 -1
- package/dist/store/sqlite/organization-categories.js +1 -1
- package/dist/store/sqlite/organizations.d.ts +12 -1
- package/dist/store/sqlite/organizations.js +9 -1
- package/dist/store/sqlite/people-list.d.ts +6 -1
- package/dist/store/sqlite/people-list.js +66 -14
- package/dist/store/sqlite/person-links.d.ts +2 -2
- package/dist/store/sqlite/person-links.js +3 -3
- package/dist/store/sqlite/person-match-scan.d.ts +5 -5
- package/dist/store/sqlite/person-match-scan.js +28 -18
- package/dist/store/sqlite/pipeline-period.d.ts +1 -1
- package/dist/store/sqlite/pipeline-period.js +1 -1
- package/dist/store/sqlite/rebuild.d.ts +52 -0
- package/dist/store/sqlite/rebuild.js +176 -0
- package/dist/store/sqlite/relation-list.d.ts +1 -1
- package/dist/store/sqlite/rollback-copy.d.ts +7 -3
- package/dist/store/sqlite/rollback-copy.js +43 -6
- package/dist/store/sqlite/schema/canonical-tags.js +1 -1
- package/dist/store/sqlite/schema/decision-requests.js +1 -1
- package/dist/store/sqlite/schema/document-changes.js +1 -1
- package/dist/store/sqlite/schema/link-revisions.js +6 -3
- package/dist/store/sqlite/schema/links.js +3 -2
- package/dist/store/sqlite/schema/sender-bots.d.ts +288 -0
- package/dist/store/sqlite/schema/sender-bots.js +22 -0
- package/dist/store/sqlite/schema/tag-consolidations.js +5 -2
- package/dist/store/sqlite/schema/templates.js +1 -1
- package/dist/store/sqlite/schema.d.ts +1 -0
- package/dist/store/sqlite/schema.js +245 -108
- package/dist/store/sqlite/sender-bots.d.ts +43 -0
- package/dist/store/sqlite/sender-bots.js +189 -0
- package/dist/store/sqlite/sender-signals.d.ts +5 -2
- package/dist/store/sqlite/sender-signals.js +6 -6
- package/dist/store/sqlite/tracker.d.ts +11 -9
- package/dist/store/sqlite/tracker.js +27 -12
- package/dist/store/sqlite/vectors.d.ts +1 -1
- package/dist/store/sqlite/vectors.js +1 -1
- package/dist/store/sqlite/version-73.d.ts +12 -0
- package/dist/store/sqlite/version-73.js +114 -0
- package/dist/store/sqlite/work-tasks.js +2 -0
- package/dist/store/sqlite-warning.d.ts +1 -1
- package/dist/store/sqlite-warning.js +1 -1
- package/dist/store/store.d.ts +2 -176
- package/dist/store/store.js +1 -1
- package/dist/store/sync.d.ts +1 -0
- package/dist/store/types.d.ts +5 -3
- package/dist/store/vectors.d.ts +2 -0
- package/dist/tasks/model.d.ts +7 -1
- package/dist/tasks/model.js +6 -1
- package/dist/tasks/priority.d.ts +11 -2
- package/dist/tasks/priority.js +10 -2
- package/dist/terminal/qr.d.ts +1 -0
- package/dist/terminal/qr.js +1 -0
- package/dist/tracker/cli/index.d.ts +1 -1
- package/dist/tracker/cli/index.js +86 -25
- package/dist/tracker/manifest/manifest.d.ts +1 -1
- package/dist/tracker/manifest/manifest.js +1 -1
- package/dist/tracker/sync.d.ts +2 -0
- package/dist/tracker/sync.js +55 -25
- package/dist/tracker/testing/manifest-fake.d.ts +2 -1
- package/dist/tracker/writes.d.ts +28 -0
- package/dist/tracker/writes.js +141 -19
- package/dist/update/index.d.ts +5 -1
- package/dist/update/index.js +4 -1
- package/package.json +29 -9
- package/parity.json +4 -1
- package/dist/services/search-all-deprecated.d.ts +0 -40
- package/dist/services/search-all-deprecated.js +0 -10
|
@@ -13,7 +13,7 @@ export declare const CRM_SCOPES: readonly ["mine", "all"];
|
|
|
13
13
|
/** `activities`: whether a sync also reads the activities and tasks on the deals and leads it keeps; off by default. */
|
|
14
14
|
export declare const CRM_ACTIVITIES: readonly ["on", "off"];
|
|
15
15
|
/**
|
|
16
|
-
* What `files sync` and `files download` may take
|
|
16
|
+
* What `files sync` and `files download` may take: a run's files, a prefetched file's and a run's
|
|
17
17
|
* megabytes, a run's minutes, how many days back a run looks, and the account's folder's megabytes. A value outside
|
|
18
18
|
* its range is refused, never clamped.
|
|
19
19
|
*/
|
|
@@ -9,7 +9,7 @@ export const CRM_SCOPES = ["mine", "all"];
|
|
|
9
9
|
/** `activities`: whether a sync also reads the activities and tasks on the deals and leads it keeps; off by default. */
|
|
10
10
|
export const CRM_ACTIVITIES = ["on", "off"];
|
|
11
11
|
/**
|
|
12
|
-
* What `files sync` and `files download` may take
|
|
12
|
+
* What `files sync` and `files download` may take: a run's files, a prefetched file's and a run's
|
|
13
13
|
* megabytes, a run's minutes, how many days back a run looks, and the account's folder's megabytes. A value outside
|
|
14
14
|
* its range is refused, never clamped.
|
|
15
15
|
*/
|
|
@@ -33,7 +33,7 @@ export interface CrmSaved {
|
|
|
33
33
|
droppedPending?: number;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* A CRM account's copies in the store, written as the CRM has them: nothing waits for review
|
|
36
|
+
* A CRM account's copies in the store, written as the CRM has them: nothing waits for review, and
|
|
37
37
|
* nothing is ever matched by name (WC-DATA-6). Rows the CRM no longer has are marked deleted, never removed
|
|
38
38
|
* (WC-DATA-7). Every write is one transaction per call.
|
|
39
39
|
*/
|
|
@@ -136,7 +136,7 @@ export interface CrmCopies extends CrmReads, CrmActivityWrites {
|
|
|
136
136
|
}): Promise<CrmContactsRemoved>;
|
|
137
137
|
/**
|
|
138
138
|
* Removes one contact from the copy, as `removeContacts` removes those outside the scope: a write made it another
|
|
139
|
-
* user's client, which the copy does not keep
|
|
139
|
+
* user's client, which the copy does not keep. Answers what went.
|
|
140
140
|
*/
|
|
141
141
|
removeContact(key: AccountKey, externalId: string): Promise<CrmContactsRemoved>;
|
|
142
142
|
/** How many of the kind the account holds, not deleted; every contact it ever saved. */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CacheDatabase } from "../driver.js";
|
|
2
|
+
/**
|
|
3
|
+
* Newsletter hosts and mail services that send for many customers. Their domain names none of the senders, so it never
|
|
4
|
+
* makes an organization; the bounce and signing domains are here for mail whose `From` carries them.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SENDING_PLATFORMS: ReadonlySet<string>;
|
|
7
|
+
/** How a rule's hold on an address is marked in `organization_identities.method`. */
|
|
8
|
+
export declare const BY_DOMAIN = "domain";
|
|
9
|
+
/** A rejected `proposed_actions` row of this kind keeps a rule from making an organization for its domain again. */
|
|
10
|
+
export declare const REFUSED_DOMAIN = "organization-domain";
|
|
11
|
+
/** The registrable domain whose organization an address joins; none for free, throwaway and platform mail. */
|
|
12
|
+
export declare const companyDomainOf: (address: string) => string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* A person as the kind pass leaves them: `holds` for a bot or a shared mailbox, whose addresses the organization owns;
|
|
15
|
+
* never for one the owner kept as a person.
|
|
16
|
+
*/
|
|
17
|
+
export interface Sorted {
|
|
18
|
+
id: number;
|
|
19
|
+
displayName: string | null;
|
|
20
|
+
holds: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Plan step 5: a bot or a shared mailbox at a company domain joins that domain's organization, made when none holds
|
|
24
|
+
* it; a human there becomes a `member-of` it, never merged. Free mail, throwaway mail and sending platforms make none.
|
|
25
|
+
* An organization holding a domain of the built-in Wikidata list gets its `metadata.sector`.
|
|
26
|
+
* The owner's word holds: a membership the owner removed and a domain whose organization the owner erased are not made
|
|
27
|
+
* again. The caller holds the write lock.
|
|
28
|
+
*/
|
|
29
|
+
export declare const groupByDomain: (database: CacheDatabase, people: readonly Sorted[], at: number) => void;
|
|
30
|
+
/** The owner erased an organization: no rule makes one for the company domains it held again. */
|
|
31
|
+
export declare const refuseDomainsOf: (database: CacheDatabase, organization: number, at: number) => void;
|
|
32
|
+
/** The owner moved these identities to a person: the holds a rule gave them go, so they read as a person's again. */
|
|
33
|
+
export declare const releaseDomainHolds: (database: CacheDatabase, identities: readonly number[]) => void;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { getDomainWithoutSuffix } from "tldts";
|
|
2
|
+
import { isReadable } from "../../domain/display-names.js";
|
|
3
|
+
import { SECTORS, sectorOfDomain } from "../../domain/organization-sectors.js";
|
|
4
|
+
import { isCompanyName } from "../../domain/person-kinds.js";
|
|
5
|
+
import { FREE_MAIL, isDisposableDomain, registrableOf } from "../../mail/score.js";
|
|
6
|
+
import { fold } from "../normalize.js";
|
|
7
|
+
import { actorOfOrigin } from "./actors.js";
|
|
8
|
+
import { linkKind } from "./link-kinds.js";
|
|
9
|
+
/**
|
|
10
|
+
* Newsletter hosts and mail services that send for many customers. Their domain names none of the senders, so it never
|
|
11
|
+
* makes an organization; the bounce and signing domains are here for mail whose `From` carries them.
|
|
12
|
+
*/
|
|
13
|
+
export const SENDING_PLATFORMS = new Set([
|
|
14
|
+
"substack.com",
|
|
15
|
+
"beehiiv.com",
|
|
16
|
+
"ghost.io",
|
|
17
|
+
"buttondown.email",
|
|
18
|
+
"buttondown.com",
|
|
19
|
+
"mailchimpapp.net",
|
|
20
|
+
"mcsv.net",
|
|
21
|
+
"mcdlv.net",
|
|
22
|
+
"rsgsv.net",
|
|
23
|
+
"list-manage.com",
|
|
24
|
+
"mandrillapp.com",
|
|
25
|
+
"sendgrid.net",
|
|
26
|
+
"amazonses.com",
|
|
27
|
+
"mailgun.org",
|
|
28
|
+
"mailgun.net",
|
|
29
|
+
"postmarkapp.com",
|
|
30
|
+
"mtasv.net",
|
|
31
|
+
"sparkpostmail.com",
|
|
32
|
+
"convertkit-mail.com",
|
|
33
|
+
"mlsend.com",
|
|
34
|
+
"sendinblue.com",
|
|
35
|
+
"brevosend.com",
|
|
36
|
+
]);
|
|
37
|
+
/** How a rule's hold on an address is marked in `organization_identities.method`. */
|
|
38
|
+
export const BY_DOMAIN = "domain";
|
|
39
|
+
/** A rejected `proposed_actions` row of this kind keeps a rule from making an organization for its domain again. */
|
|
40
|
+
export const REFUSED_DOMAIN = "organization-domain";
|
|
41
|
+
/** The registrable domain whose organization an address joins; none for free, throwaway and platform mail. */
|
|
42
|
+
export const companyDomainOf = (address) => {
|
|
43
|
+
if (!address.includes("@"))
|
|
44
|
+
return undefined;
|
|
45
|
+
const domain = registrableOf(address);
|
|
46
|
+
return domain.includes(".") && !FREE_MAIL.has(domain) && !SENDING_PLATFORMS.has(domain) && !isDisposableDomain(domain)
|
|
47
|
+
? domain
|
|
48
|
+
: undefined;
|
|
49
|
+
};
|
|
50
|
+
const nameFor = (shown, domain) => {
|
|
51
|
+
const label = getDomainWithoutSuffix(domain);
|
|
52
|
+
return shown !== null &&
|
|
53
|
+
isReadable(shown) &&
|
|
54
|
+
(isCompanyName(shown) || (label !== null && fold(shown).trim() === fold(label)))
|
|
55
|
+
? shown.trim()
|
|
56
|
+
: domain;
|
|
57
|
+
};
|
|
58
|
+
const mailOf = (database, people) => {
|
|
59
|
+
const found = new Map();
|
|
60
|
+
for (const row of database
|
|
61
|
+
.prepare("SELECT l.person_id AS person, i.id, lower(i.external_id) AS address FROM identity_links l " +
|
|
62
|
+
"JOIN identities i ON i.id = l.identity_id WHERE i.provider = 'email' " +
|
|
63
|
+
"AND l.person_id IN (SELECT value FROM json_each(?)) ORDER BY i.id")
|
|
64
|
+
.all(JSON.stringify(people))) {
|
|
65
|
+
const domain = companyDomainOf(String(row.address));
|
|
66
|
+
if (domain === undefined)
|
|
67
|
+
continue;
|
|
68
|
+
const person = Number(row.person);
|
|
69
|
+
found.set(person, [...(found.get(person) ?? []), { identity: Number(row.id), domain }]);
|
|
70
|
+
}
|
|
71
|
+
return found;
|
|
72
|
+
};
|
|
73
|
+
/** Every organization by the company domains of the addresses it holds, and which identities are held at all. */
|
|
74
|
+
const holdersOf = (database) => {
|
|
75
|
+
const byDomain = new Map();
|
|
76
|
+
const held = new Map();
|
|
77
|
+
for (const row of database
|
|
78
|
+
.prepare("SELECT oi.identity_id, oi.organization_id, lower(i.external_id) AS address FROM organization_identities oi " +
|
|
79
|
+
"JOIN organizations o ON o.id = oi.organization_id JOIN identities i ON i.id = oi.identity_id " +
|
|
80
|
+
"WHERE o.deleted_at IS NULL AND i.provider = 'email' ORDER BY oi.id")
|
|
81
|
+
.all()) {
|
|
82
|
+
const organization = Number(row.organization_id);
|
|
83
|
+
if (!held.has(Number(row.identity_id)))
|
|
84
|
+
held.set(Number(row.identity_id), organization);
|
|
85
|
+
const domain = companyDomainOf(String(row.address));
|
|
86
|
+
if (domain !== undefined)
|
|
87
|
+
byDomain.set(domain, (byDomain.get(domain) ?? new Set()).add(organization));
|
|
88
|
+
}
|
|
89
|
+
return { byDomain, held };
|
|
90
|
+
};
|
|
91
|
+
const refusedDomains = (database) => new Set(database
|
|
92
|
+
.prepare("SELECT json_extract(payload, '$.domain') AS domain FROM proposed_actions WHERE kind = ? AND status = 'rejected'")
|
|
93
|
+
.all(REFUSED_DOMAIN)
|
|
94
|
+
.map((row) => String(row.domain)));
|
|
95
|
+
/** Person → organization pairs the owner removed: a rule never links them again. */
|
|
96
|
+
const removedMemberships = (database) => new Set(database
|
|
97
|
+
.prepare("SELECT target_id, json_extract(payload, '$.to') AS target FROM proposed_actions WHERE kind = 'relationship' " +
|
|
98
|
+
"AND status = 'rejected' AND target_type = 'person' AND json_extract(payload, '$.kind') = 'member-of' " +
|
|
99
|
+
"AND json_extract(payload, '$.to') LIKE 'organization:%'")
|
|
100
|
+
.all()
|
|
101
|
+
.map((row) => `${row.target_id}>${row.target}`));
|
|
102
|
+
/** Humans the kind pass did not see who write from one of `domains`: a new organization takes them as members too. */
|
|
103
|
+
const othersAt = (database, domains, seen) => {
|
|
104
|
+
const found = new Map();
|
|
105
|
+
for (const row of database
|
|
106
|
+
.prepare("SELECT l.person_id AS person, i.id, lower(i.external_id) AS address FROM identity_links l " +
|
|
107
|
+
"JOIN identities i ON i.id = l.identity_id JOIN persons p ON p.id = l.person_id " +
|
|
108
|
+
"WHERE i.provider = 'email' AND p.owner = 0 AND p.kind IS NOT NULL AND p.kind NOT IN ('test', 'merged') " +
|
|
109
|
+
"AND NOT EXISTS (SELECT 1 FROM sender_bots b WHERE b.person_id = p.id) " +
|
|
110
|
+
"AND NOT EXISTS (SELECT 1 FROM organization_identities oi WHERE oi.identity_id = i.id) ORDER BY i.id")
|
|
111
|
+
.all()) {
|
|
112
|
+
const person = Number(row.person);
|
|
113
|
+
if (seen.has(person))
|
|
114
|
+
continue;
|
|
115
|
+
const domain = companyDomainOf(String(row.address));
|
|
116
|
+
if (domain === undefined || !domains.has(domain))
|
|
117
|
+
continue;
|
|
118
|
+
found.set(person, [...(found.get(person) ?? []), { identity: Number(row.id), domain }]);
|
|
119
|
+
}
|
|
120
|
+
return found;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Plan step 5: a bot or a shared mailbox at a company domain joins that domain's organization, made when none holds
|
|
124
|
+
* it; a human there becomes a `member-of` it, never merged. Free mail, throwaway mail and sending platforms make none.
|
|
125
|
+
* An organization holding a domain of the built-in Wikidata list gets its `metadata.sector`.
|
|
126
|
+
* The owner's word holds: a membership the owner removed and a domain whose organization the owner erased are not made
|
|
127
|
+
* again. The caller holds the write lock.
|
|
128
|
+
*/
|
|
129
|
+
export const groupByDomain = (database, people, at) => {
|
|
130
|
+
const mail = mailOf(database, people.map(({ id }) => id));
|
|
131
|
+
if (mail.size === 0)
|
|
132
|
+
return;
|
|
133
|
+
const { byDomain, held } = holdersOf(database);
|
|
134
|
+
const refused = refusedDomains(database);
|
|
135
|
+
const created = new Set();
|
|
136
|
+
const create = database.prepare("INSERT INTO organizations (kind, name, scope, created_at, updated_at) VALUES ('company', ?, 'personal', ?, ?) " +
|
|
137
|
+
"RETURNING id");
|
|
138
|
+
const hold = database.prepare("INSERT INTO organization_identities (identity_id, organization_id, method, author, created_at, updated_at) " +
|
|
139
|
+
`VALUES (?, ?, '${BY_DOMAIN}', 'rules', ?, ?) ON CONFLICT (identity_id, organization_id) DO NOTHING`);
|
|
140
|
+
const sends = database.prepare("UPDATE sender_bots SET organization_id = ?, updated_at = ? WHERE person_id = ? AND organization_id IS NULL");
|
|
141
|
+
const holder = (domain) => {
|
|
142
|
+
const found = byDomain.get(domain);
|
|
143
|
+
return found?.size === 1 ? [...found][0] : undefined;
|
|
144
|
+
};
|
|
145
|
+
for (const person of people) {
|
|
146
|
+
if (!person.holds)
|
|
147
|
+
continue;
|
|
148
|
+
for (const { identity, domain } of mail.get(person.id) ?? []) {
|
|
149
|
+
let organization = held.get(identity);
|
|
150
|
+
if (organization === undefined) {
|
|
151
|
+
if ((byDomain.get(domain)?.size ?? 0) > 1)
|
|
152
|
+
continue;
|
|
153
|
+
organization = holder(domain);
|
|
154
|
+
if (organization === undefined) {
|
|
155
|
+
if (refused.has(domain))
|
|
156
|
+
continue;
|
|
157
|
+
organization = Number(create.get(nameFor(person.displayName, domain), at, at)?.id);
|
|
158
|
+
byDomain.set(domain, new Set([organization]));
|
|
159
|
+
created.add(domain);
|
|
160
|
+
}
|
|
161
|
+
hold.run(identity, organization, at, at);
|
|
162
|
+
held.set(identity, organization);
|
|
163
|
+
}
|
|
164
|
+
sends.run(organization, at, person.id);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const removed = removedMemberships(database);
|
|
168
|
+
const member = database.prepare("INSERT INTO links (from_type, from_id, to_type, to_id, kind, source, confirmed, author, evidence, metadata, " +
|
|
169
|
+
`created_at, updated_at) SELECT 'person', ?, 'organization', ?, ${linkKind("member-of")}, 'owner', 1, 'rule', ?, ` +
|
|
170
|
+
`'{"derived":"mail-domain"}', ?, ? ` +
|
|
171
|
+
"WHERE NOT EXISTS (SELECT 1 FROM links WHERE from_type = 'person' AND from_id = ? AND to_type = 'organization' " +
|
|
172
|
+
`AND to_id = ? AND kind = ${linkKind("member-of")})`);
|
|
173
|
+
const join = (person, addresses) => {
|
|
174
|
+
for (const domain of new Set(addresses.map((one) => one.domain))) {
|
|
175
|
+
const organization = holder(domain);
|
|
176
|
+
if (organization === undefined || removed.has(`${person}>organization:${organization}`))
|
|
177
|
+
continue;
|
|
178
|
+
member.run(person, organization, `writes from ${domain}`, at, at, person, organization);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const seen = new Set(people.map(({ id }) => id));
|
|
182
|
+
for (const person of people)
|
|
183
|
+
if (!person.holds)
|
|
184
|
+
join(person.id, mail.get(person.id) ?? []);
|
|
185
|
+
if (created.size > 0)
|
|
186
|
+
for (const [person, addresses] of othersAt(database, created, seen))
|
|
187
|
+
join(person, addresses);
|
|
188
|
+
setSectors(database, byDomain, at);
|
|
189
|
+
};
|
|
190
|
+
/** Each organization holding a company domain takes that domain's sector, the first in `SECTORS` order if several. */
|
|
191
|
+
const setSectors = (database, byDomain, at) => {
|
|
192
|
+
const found = new Map();
|
|
193
|
+
for (const [domain, organizations] of byDomain) {
|
|
194
|
+
const sector = sectorOfDomain(domain);
|
|
195
|
+
if (sector === undefined)
|
|
196
|
+
continue;
|
|
197
|
+
const rank = SECTORS.indexOf(sector);
|
|
198
|
+
for (const organization of organizations)
|
|
199
|
+
if (rank < (found.get(organization) ?? SECTORS.length))
|
|
200
|
+
found.set(organization, rank);
|
|
201
|
+
}
|
|
202
|
+
const set = database.prepare("UPDATE organizations SET metadata = json_set(coalesce(metadata, '{}'), '$.sector', ?), updated_at = ? " +
|
|
203
|
+
"WHERE id = ? AND deleted_at IS NULL AND json_extract(metadata, '$.sector') IS NOT ?");
|
|
204
|
+
for (const [organization, rank] of found)
|
|
205
|
+
set.run(SECTORS[rank] ?? null, at, organization, SECTORS[rank] ?? null);
|
|
206
|
+
};
|
|
207
|
+
/** The owner erased an organization: no rule makes one for the company domains it held again. */
|
|
208
|
+
export const refuseDomainsOf = (database, organization, at) => {
|
|
209
|
+
const domains = new Set(database
|
|
210
|
+
.prepare("SELECT lower(i.external_id) AS address FROM organization_identities oi JOIN identities i ON i.id = oi.identity_id " +
|
|
211
|
+
"WHERE oi.organization_id = ? AND i.provider = 'email'")
|
|
212
|
+
.all(organization)
|
|
213
|
+
.flatMap((row) => companyDomainOf(String(row.address)) ?? []));
|
|
214
|
+
if (domains.size === 0)
|
|
215
|
+
return;
|
|
216
|
+
const rule = actorOfOrigin(database, "rule");
|
|
217
|
+
const owner = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
|
|
218
|
+
const refuse = database.prepare("INSERT INTO proposed_actions (kind, payload, reason, status, proposed_by_type, proposed_by_id, decided_by_type, " +
|
|
219
|
+
"decided_by_id, decided_at, created_at, updated_at) VALUES (?, ?, ?, 'rejected', ?, ?, ?, ?, ?, ?, ?)");
|
|
220
|
+
const already = refusedDomains(database);
|
|
221
|
+
for (const domain of [...domains].filter((one) => !already.has(one)))
|
|
222
|
+
refuse.run(REFUSED_DOMAIN, JSON.stringify({ domain }), `the owner erased organization:${organization}`, rule.type, rule.id, owner === undefined ? null : "person", owner === undefined ? null : Number(owner.id), owner === undefined ? null : at, at, at);
|
|
223
|
+
};
|
|
224
|
+
/** The owner moved these identities to a person: the holds a rule gave them go, so they read as a person's again. */
|
|
225
|
+
export const releaseDomainHolds = (database, identities) => {
|
|
226
|
+
database
|
|
227
|
+
.prepare(`DELETE FROM organization_identities WHERE method = '${BY_DOMAIN}' AND author = 'rules' ` +
|
|
228
|
+
"AND identity_id IN (SELECT value FROM json_each(?))")
|
|
229
|
+
.run(JSON.stringify(identities));
|
|
230
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lte, ne, notInArray, or, type Placeholder, type SQL, sql, } from "drizzle-orm";
|
|
2
|
-
export { type AnySQLiteColumn, alias, blob, index, integer, primaryKey, real, type SQLiteAsyncDatabase, sqliteTable, text, unique, uniqueIndex, } from "drizzle-orm/sqlite-core";
|
|
2
|
+
export { type AnySQLiteColumn, alias, blob, check, index, integer, primaryKey, real, type SQLiteAsyncDatabase, sqliteTable, text, unique, uniqueIndex, } from "drizzle-orm/sqlite-core";
|
|
@@ -25,6 +25,41 @@ import {
|
|
|
25
25
|
text
|
|
26
26
|
} from "./shared-5XR7K42U.js";
|
|
27
27
|
|
|
28
|
+
// node_modules/.pnpm/drizzle-orm@1.0.0-rc.5_@opentelemetry+api@1.10.0_@types+pg@8.23.1_mysql2@3.24.6_@types+_2744d70e8ef51f490b8a561cf31abd26/node_modules/drizzle-orm/sqlite-core/checks.js
|
|
29
|
+
var CheckBuilder = class {
|
|
30
|
+
name;
|
|
31
|
+
value;
|
|
32
|
+
static [entityKind] = "SQLiteCheckBuilder";
|
|
33
|
+
static [Symbol.hasInstance](value) {
|
|
34
|
+
return is(value, this);
|
|
35
|
+
}
|
|
36
|
+
brand;
|
|
37
|
+
constructor(name2, value) {
|
|
38
|
+
this.name = name2;
|
|
39
|
+
this.value = value;
|
|
40
|
+
}
|
|
41
|
+
build(table) {
|
|
42
|
+
return new Check(table, this);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var Check = class {
|
|
46
|
+
table;
|
|
47
|
+
static [entityKind] = "SQLiteCheck";
|
|
48
|
+
static [Symbol.hasInstance](value) {
|
|
49
|
+
return is(value, this);
|
|
50
|
+
}
|
|
51
|
+
name;
|
|
52
|
+
value;
|
|
53
|
+
constructor(table, builder) {
|
|
54
|
+
this.table = table;
|
|
55
|
+
this.name = builder.name;
|
|
56
|
+
this.value = builder.value;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
function check(name2, value) {
|
|
60
|
+
return new CheckBuilder(name2, value);
|
|
61
|
+
}
|
|
62
|
+
|
|
28
63
|
// node_modules/.pnpm/drizzle-orm@1.0.0-rc.5_@opentelemetry+api@1.10.0_@types+pg@8.23.1_mysql2@3.24.6_@types+_2744d70e8ef51f490b8a561cf31abd26/node_modules/drizzle-orm/sqlite-core/indexes.js
|
|
29
64
|
var IndexBuilderOn = class {
|
|
30
65
|
name;
|
|
@@ -200,6 +235,7 @@ export {
|
|
|
200
235
|
and,
|
|
201
236
|
asc,
|
|
202
237
|
blob,
|
|
238
|
+
check,
|
|
203
239
|
desc,
|
|
204
240
|
eq,
|
|
205
241
|
gt,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.5_@opentelemetry+api@1.10.0_@types+pg@8.23.1_mysql2@3.24.6_@types+_2744d70e8ef51f490b8a561cf31abd26/node_modules/src/sqlite-core/indexes.ts", "../../../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.5_@opentelemetry+api@1.10.0_@types+pg@8.23.1_mysql2@3.24.6_@types+_2744d70e8ef51f490b8a561cf31abd26/node_modules/src/sqlite-core/primary-keys.ts", "../../../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.5_@opentelemetry+api@1.10.0_@types+pg@8.23.1_mysql2@3.24.6_@types+_2744d70e8ef51f490b8a561cf31abd26/node_modules/src/sqlite-core/unique-constraint.ts", "../../../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.5_@opentelemetry+api@1.10.0_@types+pg@8.23.1_mysql2@3.24.6_@types+_2744d70e8ef51f490b8a561cf31abd26/node_modules/src/sqlite-core/alias.ts"],
|
|
4
|
-
"sourcesContent": ["import { entityKind, is } from '~/entity.ts';\nimport type { SQL } from '~/sql/sql.ts';\nimport type { SQLiteColumn } from './columns/index.ts';\nimport type { SQLiteTable } from './table.ts';\n\nexport interface IndexConfig {\n\tname: string;\n\tcolumns: IndexColumn[];\n\tunique: boolean;\n\twhere: SQL | undefined;\n}\n\nexport type IndexColumn = SQLiteColumn | SQL;\n\nexport class IndexBuilderOn {\n\tstatic readonly [entityKind]: string = 'SQLiteIndexBuilderOn';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\tconstructor(private name: string, private unique: boolean) {}\n\n\ton(...columns: [IndexColumn, ...IndexColumn[]]): IndexBuilder {\n\t\treturn new IndexBuilder(this.name, columns, this.unique);\n\t}\n}\n\nexport class IndexBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteIndexBuilder';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\tdeclare _: {\n\t\tbrand: 'SQLiteIndexBuilder';\n\t};\n\n\t/** @internal */\n\tconfig: IndexConfig;\n\n\tconstructor(name: string, columns: IndexColumn[], unique: boolean) {\n\t\tthis.config = {\n\t\t\tname,\n\t\t\tcolumns,\n\t\t\tunique,\n\t\t\twhere: undefined,\n\t\t};\n\t}\n\n\t/**\n\t * Condition for partial index.\n\t */\n\twhere(condition: SQL): this {\n\t\tthis.config.where = condition;\n\t\treturn this;\n\t}\n\n\t/** @internal */\n\tbuild(table: SQLiteTable): Index {\n\t\treturn new Index(this.config, table);\n\t}\n}\n\nexport class Index {\n\tstatic readonly [entityKind]: string = 'SQLiteIndex';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\tdeclare _: {\n\t\tbrand: 'SQLiteIndex';\n\t};\n\n\treadonly config: IndexConfig & { table: SQLiteTable };\n\treadonly isNameExplicit: boolean;\n\n\tconstructor(config: IndexConfig, table: SQLiteTable) {\n\t\tthis.config = { ...config, table };\n\t\tthis.isNameExplicit = !!config.name;\n\t}\n}\n\nexport function index(name: string): IndexBuilderOn {\n\treturn new IndexBuilderOn(name, false);\n}\n\nexport function uniqueIndex(name: string): IndexBuilderOn {\n\treturn new IndexBuilderOn(name, true);\n}\n", "import { entityKind, is } from '~/entity.ts';\nimport type { AnySQLiteColumn, SQLiteColumn } from './columns/index.ts';\nimport { SQLiteTable } from './table.ts';\n\nexport function primaryKey<\n\tTTableName extends string,\n\tTColumn extends AnySQLiteColumn<{ tableName: TTableName }>,\n\tTColumns extends AnySQLiteColumn<{ tableName: TTableName }>[],\n>(config: { name?: string; columns: [TColumn, ...TColumns] }): PrimaryKeyBuilder;\n/**\n * @deprecated: Please use primaryKey({ columns: [] }) instead of this function\n * @param columns\n */\nexport function primaryKey<\n\tTTableName extends string,\n\tTColumns extends AnySQLiteColumn<{ tableName: TTableName }>[],\n>(...columns: TColumns): PrimaryKeyBuilder;\nexport function primaryKey(...config: any) {\n\tif (config[0].columns) {\n\t\treturn new PrimaryKeyBuilder(config[0].columns, config[0].name);\n\t}\n\treturn new PrimaryKeyBuilder(config);\n}\nexport class PrimaryKeyBuilder {\n\tstatic readonly [entityKind]: string = 'SQLitePrimaryKeyBuilder';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\tdeclare _: {\n\t\tbrand: 'SQLitePrimaryKeyBuilder';\n\t};\n\n\t/** @internal */\n\tcolumns: SQLiteColumn[];\n\n\t/** @internal */\n\tname?: string;\n\n\tconstructor(\n\t\tcolumns: SQLiteColumn[],\n\t\tname?: string,\n\t) {\n\t\tthis.columns = columns;\n\t\tthis.name = name;\n\t}\n\n\t/** @internal */\n\tbuild(table: SQLiteTable): PrimaryKey {\n\t\treturn new PrimaryKey(table, this.columns, this.name);\n\t}\n}\n\nexport class PrimaryKey {\n\tstatic readonly [entityKind]: string = 'SQLitePrimaryKey';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\treadonly columns: SQLiteColumn[];\n\treadonly name?: string;\n\treadonly isNameExplicit: boolean;\n\n\tconstructor(readonly table: SQLiteTable, columns: SQLiteColumn[], name?: string) {\n\t\tthis.columns = columns;\n\t\tthis.name = name;\n\t\tthis.isNameExplicit = !!name;\n\t}\n\n\tgetName(): string {\n\t\treturn this.name\n\t\t\t?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column) => column.name).join('_')}_pk`;\n\t}\n}\n", "import { entityKind, is } from '~/entity.ts';\nimport { TableName } from '~/table.utils.ts';\nimport type { SQLiteColumn } from './columns/common.ts';\nimport type { SQLiteTable } from './table.ts';\n\nexport function uniqueKeyName(table: SQLiteTable, columns: string[]) {\n\treturn `${table[TableName]}_${columns.join('_')}_unique`;\n}\n\nexport function unique(name?: string): UniqueOnConstraintBuilder {\n\treturn new UniqueOnConstraintBuilder(name);\n}\n\nexport class UniqueConstraintBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteUniqueConstraintBuilder';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\t/** @internal */\n\tcolumns: SQLiteColumn[];\n\n\tconstructor(\n\t\tcolumns: SQLiteColumn[],\n\t\tprivate name?: string,\n\t) {\n\t\tthis.columns = columns;\n\t}\n\n\t/** @internal */\n\tbuild(table: SQLiteTable): UniqueConstraint {\n\t\treturn new UniqueConstraint(table, this.columns, this.name);\n\t}\n}\n\nexport class UniqueOnConstraintBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteUniqueOnConstraintBuilder';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\t/** @internal */\n\tname?: string;\n\n\tconstructor(\n\t\tname?: string,\n\t) {\n\t\tthis.name = name;\n\t}\n\n\ton(...columns: [SQLiteColumn, ...SQLiteColumn[]]) {\n\t\treturn new UniqueConstraintBuilder(columns, this.name);\n\t}\n}\n\nexport class UniqueConstraint {\n\tstatic readonly [entityKind]: string = 'SQLiteUniqueConstraint';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\treadonly columns: SQLiteColumn[];\n\treadonly name: string;\n\treadonly isNameExplicit: boolean;\n\n\tconstructor(readonly table: SQLiteTable, columns: SQLiteColumn[], name?: string) {\n\t\tthis.columns = columns;\n\t\tthis.isNameExplicit = !!name;\n\t\tthis.name = name ?? uniqueKeyName(this.table, this.columns.map((column) => column.name));\n\t}\n\n\tgetName() {\n\t\treturn this.name;\n\t}\n}\n", "import { TableAliasProxyHandler } from '~/alias.ts';\nimport type { BuildAliasTable } from './query-builders/select.types.ts';\n\nimport type { SQLiteTable } from './table.ts';\nimport type { SQLiteViewBase } from './view-base.ts';\n\nexport function alias<TTable extends SQLiteTable | SQLiteViewBase, TAlias extends string>(\n\ttable: TTable,\n\talias: TAlias,\n): BuildAliasTable<TTable, TAlias> {\n\treturn new Proxy(table, new TableAliasProxyHandler(alias, false)) as any;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
6
|
-
"names": ["name", "unique", "name", "name", "alias"]
|
|
3
|
+
"sources": ["../../../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.5_@opentelemetry+api@1.10.0_@types+pg@8.23.1_mysql2@3.24.6_@types+_2744d70e8ef51f490b8a561cf31abd26/node_modules/src/sqlite-core/checks.ts", "../../../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.5_@opentelemetry+api@1.10.0_@types+pg@8.23.1_mysql2@3.24.6_@types+_2744d70e8ef51f490b8a561cf31abd26/node_modules/src/sqlite-core/indexes.ts", "../../../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.5_@opentelemetry+api@1.10.0_@types+pg@8.23.1_mysql2@3.24.6_@types+_2744d70e8ef51f490b8a561cf31abd26/node_modules/src/sqlite-core/primary-keys.ts", "../../../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.5_@opentelemetry+api@1.10.0_@types+pg@8.23.1_mysql2@3.24.6_@types+_2744d70e8ef51f490b8a561cf31abd26/node_modules/src/sqlite-core/unique-constraint.ts", "../../../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.5_@opentelemetry+api@1.10.0_@types+pg@8.23.1_mysql2@3.24.6_@types+_2744d70e8ef51f490b8a561cf31abd26/node_modules/src/sqlite-core/alias.ts"],
|
|
4
|
+
"sourcesContent": ["import { entityKind, is } from '~/entity.ts';\nimport type { SQL } from '~/sql/sql.ts';\nimport type { SQLiteTable } from './table.ts';\n\nexport class CheckBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteCheckBuilder';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\tprotected brand!: 'SQLiteConstraintBuilder';\n\n\tconstructor(public name: string, public value: SQL) {}\n\n\tbuild(table: SQLiteTable): Check {\n\t\treturn new Check(table, this);\n\t}\n}\n\nexport class Check {\n\tstatic readonly [entityKind]: string = 'SQLiteCheck';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\tdeclare _: {\n\t\tbrand: 'SQLiteCheck';\n\t};\n\n\treadonly name: string;\n\treadonly value: SQL;\n\n\tconstructor(public table: SQLiteTable, builder: CheckBuilder) {\n\t\tthis.name = builder.name;\n\t\tthis.value = builder.value;\n\t}\n}\n\nexport function check(name: string, value: SQL): CheckBuilder {\n\treturn new CheckBuilder(name, value);\n}\n", "import { entityKind, is } from '~/entity.ts';\nimport type { SQL } from '~/sql/sql.ts';\nimport type { SQLiteColumn } from './columns/index.ts';\nimport type { SQLiteTable } from './table.ts';\n\nexport interface IndexConfig {\n\tname: string;\n\tcolumns: IndexColumn[];\n\tunique: boolean;\n\twhere: SQL | undefined;\n}\n\nexport type IndexColumn = SQLiteColumn | SQL;\n\nexport class IndexBuilderOn {\n\tstatic readonly [entityKind]: string = 'SQLiteIndexBuilderOn';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\tconstructor(private name: string, private unique: boolean) {}\n\n\ton(...columns: [IndexColumn, ...IndexColumn[]]): IndexBuilder {\n\t\treturn new IndexBuilder(this.name, columns, this.unique);\n\t}\n}\n\nexport class IndexBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteIndexBuilder';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\tdeclare _: {\n\t\tbrand: 'SQLiteIndexBuilder';\n\t};\n\n\t/** @internal */\n\tconfig: IndexConfig;\n\n\tconstructor(name: string, columns: IndexColumn[], unique: boolean) {\n\t\tthis.config = {\n\t\t\tname,\n\t\t\tcolumns,\n\t\t\tunique,\n\t\t\twhere: undefined,\n\t\t};\n\t}\n\n\t/**\n\t * Condition for partial index.\n\t */\n\twhere(condition: SQL): this {\n\t\tthis.config.where = condition;\n\t\treturn this;\n\t}\n\n\t/** @internal */\n\tbuild(table: SQLiteTable): Index {\n\t\treturn new Index(this.config, table);\n\t}\n}\n\nexport class Index {\n\tstatic readonly [entityKind]: string = 'SQLiteIndex';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\tdeclare _: {\n\t\tbrand: 'SQLiteIndex';\n\t};\n\n\treadonly config: IndexConfig & { table: SQLiteTable };\n\treadonly isNameExplicit: boolean;\n\n\tconstructor(config: IndexConfig, table: SQLiteTable) {\n\t\tthis.config = { ...config, table };\n\t\tthis.isNameExplicit = !!config.name;\n\t}\n}\n\nexport function index(name: string): IndexBuilderOn {\n\treturn new IndexBuilderOn(name, false);\n}\n\nexport function uniqueIndex(name: string): IndexBuilderOn {\n\treturn new IndexBuilderOn(name, true);\n}\n", "import { entityKind, is } from '~/entity.ts';\nimport type { AnySQLiteColumn, SQLiteColumn } from './columns/index.ts';\nimport { SQLiteTable } from './table.ts';\n\nexport function primaryKey<\n\tTTableName extends string,\n\tTColumn extends AnySQLiteColumn<{ tableName: TTableName }>,\n\tTColumns extends AnySQLiteColumn<{ tableName: TTableName }>[],\n>(config: { name?: string; columns: [TColumn, ...TColumns] }): PrimaryKeyBuilder;\n/**\n * @deprecated: Please use primaryKey({ columns: [] }) instead of this function\n * @param columns\n */\nexport function primaryKey<\n\tTTableName extends string,\n\tTColumns extends AnySQLiteColumn<{ tableName: TTableName }>[],\n>(...columns: TColumns): PrimaryKeyBuilder;\nexport function primaryKey(...config: any) {\n\tif (config[0].columns) {\n\t\treturn new PrimaryKeyBuilder(config[0].columns, config[0].name);\n\t}\n\treturn new PrimaryKeyBuilder(config);\n}\nexport class PrimaryKeyBuilder {\n\tstatic readonly [entityKind]: string = 'SQLitePrimaryKeyBuilder';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\tdeclare _: {\n\t\tbrand: 'SQLitePrimaryKeyBuilder';\n\t};\n\n\t/** @internal */\n\tcolumns: SQLiteColumn[];\n\n\t/** @internal */\n\tname?: string;\n\n\tconstructor(\n\t\tcolumns: SQLiteColumn[],\n\t\tname?: string,\n\t) {\n\t\tthis.columns = columns;\n\t\tthis.name = name;\n\t}\n\n\t/** @internal */\n\tbuild(table: SQLiteTable): PrimaryKey {\n\t\treturn new PrimaryKey(table, this.columns, this.name);\n\t}\n}\n\nexport class PrimaryKey {\n\tstatic readonly [entityKind]: string = 'SQLitePrimaryKey';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\treadonly columns: SQLiteColumn[];\n\treadonly name?: string;\n\treadonly isNameExplicit: boolean;\n\n\tconstructor(readonly table: SQLiteTable, columns: SQLiteColumn[], name?: string) {\n\t\tthis.columns = columns;\n\t\tthis.name = name;\n\t\tthis.isNameExplicit = !!name;\n\t}\n\n\tgetName(): string {\n\t\treturn this.name\n\t\t\t?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column) => column.name).join('_')}_pk`;\n\t}\n}\n", "import { entityKind, is } from '~/entity.ts';\nimport { TableName } from '~/table.utils.ts';\nimport type { SQLiteColumn } from './columns/common.ts';\nimport type { SQLiteTable } from './table.ts';\n\nexport function uniqueKeyName(table: SQLiteTable, columns: string[]) {\n\treturn `${table[TableName]}_${columns.join('_')}_unique`;\n}\n\nexport function unique(name?: string): UniqueOnConstraintBuilder {\n\treturn new UniqueOnConstraintBuilder(name);\n}\n\nexport class UniqueConstraintBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteUniqueConstraintBuilder';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\t/** @internal */\n\tcolumns: SQLiteColumn[];\n\n\tconstructor(\n\t\tcolumns: SQLiteColumn[],\n\t\tprivate name?: string,\n\t) {\n\t\tthis.columns = columns;\n\t}\n\n\t/** @internal */\n\tbuild(table: SQLiteTable): UniqueConstraint {\n\t\treturn new UniqueConstraint(table, this.columns, this.name);\n\t}\n}\n\nexport class UniqueOnConstraintBuilder {\n\tstatic readonly [entityKind]: string = 'SQLiteUniqueOnConstraintBuilder';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\t/** @internal */\n\tname?: string;\n\n\tconstructor(\n\t\tname?: string,\n\t) {\n\t\tthis.name = name;\n\t}\n\n\ton(...columns: [SQLiteColumn, ...SQLiteColumn[]]) {\n\t\treturn new UniqueConstraintBuilder(columns, this.name);\n\t}\n}\n\nexport class UniqueConstraint {\n\tstatic readonly [entityKind]: string = 'SQLiteUniqueConstraint';\n\tstatic [Symbol.hasInstance](value: unknown): boolean {\n\t\treturn is(value, this);\n\t}\n\n\treadonly columns: SQLiteColumn[];\n\treadonly name: string;\n\treadonly isNameExplicit: boolean;\n\n\tconstructor(readonly table: SQLiteTable, columns: SQLiteColumn[], name?: string) {\n\t\tthis.columns = columns;\n\t\tthis.isNameExplicit = !!name;\n\t\tthis.name = name ?? uniqueKeyName(this.table, this.columns.map((column) => column.name));\n\t}\n\n\tgetName() {\n\t\treturn this.name;\n\t}\n}\n", "import { TableAliasProxyHandler } from '~/alias.ts';\nimport type { BuildAliasTable } from './query-builders/select.types.ts';\n\nimport type { SQLiteTable } from './table.ts';\nimport type { SQLiteViewBase } from './view-base.ts';\n\nexport function alias<TTable extends SQLiteTable | SQLiteViewBase, TAlias extends string>(\n\ttable: TTable,\n\talias: TAlias,\n): BuildAliasTable<TTable, TAlias> {\n\treturn new Proxy(table, new TableAliasProxyHandler(alias, false)) as any;\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["name", "name", "unique", "name", "name", "alias"]
|
|
7
7
|
}
|
|
@@ -25,7 +25,7 @@ export declare const linkRows: (database: CacheDatabase, statuses?: readonly str
|
|
|
25
25
|
}) => LinkRow[];
|
|
26
26
|
/**
|
|
27
27
|
* What a proposal rests on: its signal and the two identities it names, in either order. The owner's rejection
|
|
28
|
-
* holds against this evidence only
|
|
28
|
+
* holds against this evidence only; a new signal or identity for the same people proposes them again.
|
|
29
29
|
*/
|
|
30
30
|
export declare const evidenceKeyOf: ({ signal, identity, with: other, }: Pick<IdentityLinkPayload, "signal" | "identity" | "with">) => string;
|
|
31
31
|
/** The evidence the owner rejected for linking these two people, by any proposal that names them now. */
|
|
@@ -40,7 +40,7 @@ export const linkRows = (database, statuses = ["proposed", "rejected"], page) =>
|
|
|
40
40
|
});
|
|
41
41
|
/**
|
|
42
42
|
* What a proposal rests on: its signal and the two identities it names, in either order. The owner's rejection
|
|
43
|
-
* holds against this evidence only
|
|
43
|
+
* holds against this evidence only; a new signal or identity for the same people proposes them again.
|
|
44
44
|
*/
|
|
45
45
|
export const evidenceKeyOf = ({ signal, identity, with: other, }) => `${signal} ${[identity, other ?? ""].sort().join(" ")}`;
|
|
46
46
|
/** The evidence the owner rejected for linking these two people, by any proposal that names them now. */
|
|
@@ -6,7 +6,7 @@ import { type MeetingProjectsStore } from "./meeting-projects.js";
|
|
|
6
6
|
import type { Author } from "./memories.js";
|
|
7
7
|
import { type Link } from "./notes.js";
|
|
8
8
|
import type { StoreContext } from "./open.js";
|
|
9
|
-
import { type OrganizationsStore } from "./organizations.js";
|
|
9
|
+
import { type Organization, type OrganizationsStore } from "./organizations.js";
|
|
10
10
|
import type { ProposedAction } from "./proposed-actions.js";
|
|
11
11
|
import { type KnowledgeRelation, type LinkDecision, type RelateInput, type RelationUpdate, type Scored } from "./relation-proposals.js";
|
|
12
12
|
import { type RelationReads } from "./relation-reads.js";
|
|
@@ -74,14 +74,7 @@ export interface Annotation {
|
|
|
74
74
|
export declare const ORGANIZATION_KINDS: readonly ["company", "team", "family", "community"];
|
|
75
75
|
export declare const PROJECT_TYPES: readonly ["work", "client", "personal", "oss", "other"];
|
|
76
76
|
export declare const SCOPES: readonly ["personal", "work"];
|
|
77
|
-
export
|
|
78
|
-
id: string;
|
|
79
|
-
ref: string;
|
|
80
|
-
kind: (typeof ORGANIZATION_KINDS)[number];
|
|
81
|
-
name: string;
|
|
82
|
-
scope: (typeof SCOPES)[number];
|
|
83
|
-
createdAt: string;
|
|
84
|
-
}
|
|
77
|
+
export type { Organization } from "./organizations.js";
|
|
85
78
|
export interface Project {
|
|
86
79
|
id: string;
|
|
87
80
|
ref: string;
|
|
@@ -30,6 +30,110 @@ const V31_TABLES = [
|
|
|
30
30
|
];
|
|
31
31
|
/** Version 56 rewrites CRM links and folds duplicates, which an older build would write again. */
|
|
32
32
|
const V56_TABLES = ["links", "proposed_actions"];
|
|
33
|
+
/** Version 73 makes every base table with an integer `id` AUTOINCREMENT, by copying it: all of them change. */
|
|
34
|
+
const V73_TABLES = [
|
|
35
|
+
"accounts",
|
|
36
|
+
"agent_actions",
|
|
37
|
+
"attachments",
|
|
38
|
+
"bot_updates",
|
|
39
|
+
"bots",
|
|
40
|
+
"calendar_entries",
|
|
41
|
+
"catalog_items",
|
|
42
|
+
"chats",
|
|
43
|
+
"content_authors",
|
|
44
|
+
"content_metrics",
|
|
45
|
+
"content_posts",
|
|
46
|
+
"content_terms",
|
|
47
|
+
"contracts",
|
|
48
|
+
"crm_fields",
|
|
49
|
+
"deals",
|
|
50
|
+
"decisions",
|
|
51
|
+
"document_revisions",
|
|
52
|
+
"documents",
|
|
53
|
+
"email_threads",
|
|
54
|
+
"emails",
|
|
55
|
+
"facts",
|
|
56
|
+
"files",
|
|
57
|
+
"financial_accounts",
|
|
58
|
+
"financial_transactions",
|
|
59
|
+
"identities",
|
|
60
|
+
"identity_revisions",
|
|
61
|
+
"invoice_lines",
|
|
62
|
+
"invoices",
|
|
63
|
+
"leads",
|
|
64
|
+
"link_reviews",
|
|
65
|
+
"link_revisions",
|
|
66
|
+
"links",
|
|
67
|
+
"mail_rules",
|
|
68
|
+
"meeting_chat_messages",
|
|
69
|
+
"meeting_participants",
|
|
70
|
+
"meeting_series",
|
|
71
|
+
"meeting_summaries",
|
|
72
|
+
"meeting_transcript_rows",
|
|
73
|
+
"meeting_transcripts",
|
|
74
|
+
"meetings",
|
|
75
|
+
"memories",
|
|
76
|
+
"messages",
|
|
77
|
+
"notes",
|
|
78
|
+
"order_lines",
|
|
79
|
+
"orders",
|
|
80
|
+
"organizations",
|
|
81
|
+
"payments",
|
|
82
|
+
"poll_votes",
|
|
83
|
+
"projects",
|
|
84
|
+
"proposed_actions",
|
|
85
|
+
"records",
|
|
86
|
+
"searches",
|
|
87
|
+
"subscription_prices",
|
|
88
|
+
"subscriptions",
|
|
89
|
+
"syncs",
|
|
90
|
+
"tag_consolidations",
|
|
91
|
+
"taggings",
|
|
92
|
+
"task_events",
|
|
93
|
+
"task_pairs",
|
|
94
|
+
"tasks",
|
|
95
|
+
"tracker_items",
|
|
96
|
+
"aliases",
|
|
97
|
+
"calendar_entry_participants",
|
|
98
|
+
"calendar_entry_revisions",
|
|
99
|
+
"calendars",
|
|
100
|
+
"canonical_tags",
|
|
101
|
+
"chat_events",
|
|
102
|
+
"chat_revision_source",
|
|
103
|
+
"chat_revisions",
|
|
104
|
+
"content_channels",
|
|
105
|
+
"content_post_revisions",
|
|
106
|
+
"conversations",
|
|
107
|
+
"crm_files",
|
|
108
|
+
"decision_requests",
|
|
109
|
+
"document_changes",
|
|
110
|
+
"email_recipients",
|
|
111
|
+
"entity_link_events",
|
|
112
|
+
"event_series",
|
|
113
|
+
"events",
|
|
114
|
+
"fact_removals",
|
|
115
|
+
"identity_link_events",
|
|
116
|
+
"mailboxes",
|
|
117
|
+
"member_observations",
|
|
118
|
+
"member_stays",
|
|
119
|
+
"message_links",
|
|
120
|
+
"message_reactions",
|
|
121
|
+
"message_revisions",
|
|
122
|
+
"message_transcripts",
|
|
123
|
+
"note_revisions",
|
|
124
|
+
"organization_identities",
|
|
125
|
+
"payment_allocations",
|
|
126
|
+
"persons",
|
|
127
|
+
"pipeline_stage_changes",
|
|
128
|
+
"pipeline_stages",
|
|
129
|
+
"pipelines",
|
|
130
|
+
"places",
|
|
131
|
+
"record_relations",
|
|
132
|
+
"reminders",
|
|
133
|
+
"task_assignments",
|
|
134
|
+
"templates_history",
|
|
135
|
+
"transaction_splits",
|
|
136
|
+
];
|
|
33
137
|
/** One migration creates the whole schema; every later one is added as the next version. */
|
|
34
138
|
export const MANIFEST = [
|
|
35
139
|
{ name: "20261010184427_initial", version: 1, minCompatible: 1 },
|
|
@@ -142,6 +246,9 @@ export const MANIFEST = [
|
|
|
142
246
|
{ name: "20261118230214_version-71-content-words", version: 71, minCompatible: 56 },
|
|
143
247
|
{ name: "20261123022342_version-72-document-history", version: 72, minCompatible: 56 },
|
|
144
248
|
{ name: "20261123022347_version-72-document-changes-trigger", version: 72, minCompatible: 56 },
|
|
249
|
+
{ name: "20261123230507_version-73-autoincrement", version: 73, minCompatible: 73, tables: V73_TABLES },
|
|
250
|
+
{ name: "20261125025700_version-74-sender-bots", version: 74, minCompatible: 73 },
|
|
251
|
+
{ name: "20261125025709_version-74-sender-bot-triggers", version: 74, minCompatible: 73 },
|
|
145
252
|
];
|
|
146
253
|
export const generatedMigrations = (manifest = MANIFEST, generated = GENERATED) => {
|
|
147
254
|
const migrations = [];
|
|
@@ -97,12 +97,6 @@ export const meetingTranscriptDocumentsOver = ({ database }) => {
|
|
|
97
97
|
return found;
|
|
98
98
|
});
|
|
99
99
|
return {
|
|
100
|
-
async transcriptMeetings(documentIds) {
|
|
101
|
-
if (!documentIds.length)
|
|
102
|
-
return new Map();
|
|
103
|
-
const found = await meetingsOf(documentIds, [TRANSCRIPT_ROLE]);
|
|
104
|
-
return new Map([...found].map(([document, { meetingId }]) => [document, meetingId]));
|
|
105
|
-
},
|
|
106
100
|
async documentMeetings(documentIds) {
|
|
107
101
|
return documentIds.length ? meetingsOf(documentIds, MEETING_DOCUMENT_ROLES) : new Map();
|
|
108
102
|
},
|
|
@@ -13,7 +13,7 @@ export declare const upsertMessage: (context: StoreContext, key: AccountKey, acc
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const countUnread: ({ database }: StoreContext, chatKey: number, message: Message) => void;
|
|
15
15
|
/**
|
|
16
|
-
* The owner's ruling
|
|
16
|
+
* The owner's ruling: a deleted message keeps its row, so a later sync cannot bring it
|
|
17
17
|
* back, and leaves no text — not in the row, the search copy, the edit history, a transcript or a vector.
|
|
18
18
|
*/
|
|
19
19
|
export declare const tombstone: (context: StoreContext, pk: number) => number;
|
|
@@ -277,7 +277,7 @@ export const countUnread = ({ database }, chatKey, message) => {
|
|
|
277
277
|
.run(chatKey, Date.parse(message.timestamp));
|
|
278
278
|
};
|
|
279
279
|
/**
|
|
280
|
-
* The owner's ruling
|
|
280
|
+
* The owner's ruling: a deleted message keeps its row, so a later sync cannot bring it
|
|
281
281
|
* back, and leaves no text — not in the row, the search copy, the edit history, a transcript or a vector.
|
|
282
282
|
*/
|
|
283
283
|
export const tombstone = (context, pk) => {
|