@wirecat/cli-core 0.605.0 → 0.607.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 +284 -1
- package/dist/calendar/index.d.ts +1 -0
- package/dist/calendar/index.js +1 -0
- package/dist/calendar/reads.js +5 -0
- package/dist/cli/app-mcp-command.d.ts +6 -2
- package/dist/cli/app-mcp-command.js +11 -2
- package/dist/cli/csv.d.ts +10 -0
- package/dist/cli/csv.js +22 -0
- package/dist/cli/early-refusal.d.ts +10 -0
- package/dist/cli/early-refusal.js +19 -0
- package/dist/cli/index.d.ts +4 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/profile-token.d.ts +29 -0
- package/dist/cli/profile-token.js +65 -0
- package/dist/cli/program.js +4 -2
- package/dist/cli/store-settings.js +38 -4
- package/dist/crm/cli/csv.d.ts +23 -0
- package/dist/crm/cli/csv.js +135 -0
- package/dist/crm/cli/index.d.ts +1 -1
- package/dist/crm/cli/index.js +36 -22
- package/dist/crm/cli/pipeline-view.d.ts +3 -0
- package/dist/crm/cli/pipeline-view.js +36 -0
- package/dist/crm/index.d.ts +2 -2
- package/dist/crm/index.js +1 -1
- package/dist/crm/source.d.ts +35 -5
- package/dist/crm/sync.d.ts +15 -7
- package/dist/crm/sync.js +169 -11
- package/dist/crm/writes.d.ts +6 -4
- package/dist/crm/writes.js +17 -13
- package/dist/documents.d.ts +2 -0
- package/dist/documents.js +2 -0
- package/dist/domain/business.d.ts +79 -0
- package/dist/domain/business.js +42 -0
- package/dist/domain/crm.d.ts +41 -2
- package/dist/domain/deals.d.ts +5 -2
- package/dist/domain/deals.js +5 -2
- package/dist/domain/finance.d.ts +2 -0
- package/dist/domain/finance.js +2 -2
- package/dist/domain/google-documents.d.ts +2 -0
- package/dist/domain/google-documents.js +3 -1
- package/dist/domain/money.d.ts +2 -0
- package/dist/domain/money.js +11 -3
- package/dist/domain/providers.d.ts +36 -1
- package/dist/domain/providers.js +69 -7
- package/dist/domain/record-fields.d.ts +42 -0
- package/dist/domain/record-fields.js +122 -0
- package/dist/domain/record-types.d.ts +489 -16
- package/dist/domain/record-types.js +374 -7
- package/dist/domain/records.d.ts +96 -5
- package/dist/domain/records.js +178 -32
- package/dist/domain/ref-summaries.js +5 -0
- package/dist/domain/references.d.ts +1 -1
- package/dist/domain/references.js +5 -0
- package/dist/domain/relations.d.ts +125 -0
- package/dist/domain/relations.js +107 -0
- package/dist/domain/vcard.d.ts +25 -0
- package/dist/domain/vcard.js +267 -0
- package/dist/entities/deal.d.ts +16 -2
- package/dist/entities/deal.js +5 -1
- package/dist/entities/index.d.ts +29 -13
- package/dist/entities/relationship.d.ts +8 -2
- package/dist/entities/relationship.js +8 -2
- package/dist/entities/task-results.d.ts +10 -10
- package/dist/errors/reasons.js +73 -2
- package/dist/fetch/addresses.d.ts +5 -0
- package/dist/fetch/addresses.js +76 -0
- package/dist/fetch/page.d.ts +64 -0
- package/dist/fetch/page.js +256 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +6 -3
- package/dist/mail/cli/review.js +20 -6
- package/dist/mail/index.d.ts +1 -1
- package/dist/mail/marks.d.ts +10 -5
- package/dist/mail/marks.js +16 -8
- package/dist/mail/review.d.ts +5 -0
- package/dist/meetings/calendar-text.d.ts +1 -1
- package/dist/meetings/calendar-text.js +4 -0
- package/dist/meetings/event-store.d.ts +2 -2
- package/dist/search/account-list.d.ts +4 -0
- package/dist/search/account-list.js +19 -8
- package/dist/search/query.js +2 -2
- package/dist/services/events-search.js +2 -2
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/ingest.d.ts +56 -8
- package/dist/services/ingest.js +95 -61
- package/dist/services/link-scorers/scan.js +2 -1
- package/dist/services/link-scorers/shared.js +2 -1
- package/dist/services/messages-search.js +3 -2
- package/dist/services/metadata.d.ts +1 -1
- package/dist/services/notes-search.js +1 -0
- package/dist/services/project-status/index.js +2 -1
- package/dist/services/proposals/kinds/contracts.d.ts +4 -0
- package/dist/services/proposals/kinds/contracts.js +9 -0
- package/dist/services/proposals/kinds/finance.d.ts +4 -0
- package/dist/services/proposals/kinds/finance.js +14 -35
- package/dist/services/proposals/kinds/orders.js +7 -30
- package/dist/services/proposals/kinds/shared.d.ts +27 -1
- package/dist/services/proposals/kinds/shared.js +34 -0
- package/dist/services/proposals/kinds/source-review.d.ts +4 -0
- package/dist/services/proposals/kinds/source-review.js +45 -0
- package/dist/services/proposals/kinds/subscriptions.d.ts +9 -0
- package/dist/services/proposals/kinds/subscriptions.js +24 -0
- package/dist/services/proposals/kinds/transactions.d.ts +4 -0
- package/dist/services/proposals/kinds/transactions.js +10 -0
- package/dist/services/proposals/registry.js +9 -0
- package/dist/services/search-all-meetings.js +2 -2
- package/dist/services/search-all.js +4 -3
- package/dist/services/search-kind.js +3 -3
- package/dist/services/stored-project-gathering.js +4 -3
- package/dist/store/decisions.js +5 -1
- package/dist/store/exports.d.ts +1 -0
- package/dist/store/exports.js +1 -0
- package/dist/store/index.d.ts +20 -4
- package/dist/store/index.js +4 -0
- package/dist/store/people.js +1 -1
- package/dist/store/project-transfer/request.d.ts +4 -1
- package/dist/store/project-transfer/schema.d.ts +9 -2
- package/dist/store/project-transfer/schema.js +4 -0
- package/dist/store/project-transfer/snapshot-model.d.ts +8 -2
- package/dist/store/source-review.d.ts +64 -0
- package/dist/store/source-review.js +7 -0
- package/dist/store/sqlite/accounts.d.ts +1 -1
- package/dist/store/sqlite/accounts.js +24 -1
- package/dist/store/sqlite/added-sources.d.ts +82 -0
- package/dist/store/sqlite/added-sources.js +237 -0
- package/dist/store/sqlite/business-contracts.d.ts +90 -0
- package/dist/store/sqlite/business-contracts.js +182 -0
- package/dist/store/sqlite/calendar-events.js +7 -3
- package/dist/store/sqlite/calendar-forget.js +3 -0
- package/dist/store/sqlite/calendar.d.ts +21 -1
- package/dist/store/sqlite/calendar.js +27 -7
- package/dist/store/sqlite/chat-rekey.js +7 -0
- package/dist/store/sqlite/chats.d.ts +3 -1
- package/dist/store/sqlite/chats.js +15 -1
- package/dist/store/sqlite/crm-rows.d.ts +44 -0
- package/dist/store/sqlite/crm-rows.js +195 -0
- package/dist/store/sqlite/crm-settings.d.ts +28 -0
- package/dist/store/sqlite/crm-settings.js +80 -0
- package/dist/store/sqlite/crm.d.ts +42 -11
- package/dist/store/sqlite/crm.js +402 -196
- package/dist/store/sqlite/deals.d.ts +4 -8
- package/dist/store/sqlite/deals.js +8 -5
- package/dist/store/sqlite/document-transfer/snapshot.js +2 -2
- package/dist/store/sqlite/emails.js +2 -0
- package/dist/store/sqlite/entity-types.d.ts +14 -9
- package/dist/store/sqlite/entity-types.js +4 -10
- package/dist/store/sqlite/evidence-signature.d.ts +114 -0
- package/dist/store/sqlite/evidence-signature.js +349 -0
- package/dist/store/sqlite/evidence-sources.d.ts +2 -1
- package/dist/store/sqlite/evidence-sources.js +7 -3
- package/dist/store/sqlite/facts.d.ts +7 -2
- package/dist/store/sqlite/facts.js +21 -5
- package/dist/store/sqlite/finance.d.ts +18 -105
- package/dist/store/sqlite/finance.js +100 -219
- package/dist/store/sqlite/involvement-queue.js +4 -3
- package/dist/store/sqlite/knowledge.d.ts +14 -4
- package/dist/store/sqlite/knowledge.js +108 -102
- package/dist/store/sqlite/labelled.d.ts +3 -0
- package/dist/store/sqlite/labelled.js +11 -0
- package/dist/store/sqlite/link-kinds.d.ts +4 -3
- package/dist/store/sqlite/link-kinds.js +6 -2
- package/dist/store/sqlite/manifest.js +7 -0
- package/dist/store/sqlite/memories.d.ts +24 -10
- package/dist/store/sqlite/memories.js +73 -19
- package/dist/store/sqlite/messages.js +2 -0
- package/dist/store/sqlite/migrations.generated.js +134 -0
- package/dist/store/sqlite/money-lines.d.ts +48 -0
- package/dist/store/sqlite/money-lines.js +76 -0
- package/dist/store/sqlite/money-transactions.d.ts +132 -0
- package/dist/store/sqlite/money-transactions.js +295 -0
- package/dist/store/sqlite/notes.d.ts +14 -4
- package/dist/store/sqlite/notes.js +43 -31
- package/dist/store/sqlite/orders.d.ts +36 -6
- package/dist/store/sqlite/orders.js +126 -46
- package/dist/store/sqlite/organizations.d.ts +8 -0
- package/dist/store/sqlite/organizations.js +14 -0
- package/dist/store/sqlite/payment-facts.js +1 -1
- package/dist/store/sqlite/person-preparation.d.ts +1 -1
- package/dist/store/sqlite/person-preparation.js +3 -2
- package/dist/store/sqlite/private-people.js +2 -0
- package/dist/store/sqlite/products.d.ts +78 -0
- package/dist/store/sqlite/products.js +131 -0
- package/dist/store/sqlite/project-transfer/records.js +39 -3
- package/dist/store/sqlite/project-transfer/snapshot.d.ts +4 -1
- package/dist/store/sqlite/project-transfer/snapshot.js +11 -3
- package/dist/store/sqlite/proposed-actions.d.ts +1 -1
- package/dist/store/sqlite/proposed-actions.js +24 -7
- package/dist/store/sqlite/providers.d.ts +0 -4
- package/dist/store/sqlite/providers.js +20 -2
- package/dist/store/sqlite/record-matching.d.ts +80 -0
- package/dist/store/sqlite/record-matching.js +264 -0
- package/dist/store/sqlite/record-projection.d.ts +89 -0
- package/dist/store/sqlite/record-projection.js +50 -0
- package/dist/store/sqlite/record-projectors-direct.d.ts +17 -0
- package/dist/store/sqlite/record-projectors-direct.js +125 -0
- package/dist/store/sqlite/record-projectors-money.d.ts +26 -0
- package/dist/store/sqlite/record-projectors-money.js +214 -0
- package/dist/store/sqlite/record-projectors-phone.d.ts +28 -0
- package/dist/store/sqlite/record-projectors-phone.js +212 -0
- package/dist/store/sqlite/record-projectors.d.ts +3 -44
- package/dist/store/sqlite/record-projectors.js +7 -67
- package/dist/store/sqlite/record-relations.d.ts +24 -0
- package/dist/store/sqlite/record-relations.js +92 -0
- package/dist/store/sqlite/record-remap.d.ts +12 -0
- package/dist/store/sqlite/record-remap.js +92 -0
- package/dist/store/sqlite/record-run.d.ts +71 -0
- package/dist/store/sqlite/record-run.js +179 -0
- package/dist/store/sqlite/record-settling.d.ts +9 -0
- package/dist/store/sqlite/record-settling.js +74 -0
- package/dist/store/sqlite/record-stamps.d.ts +13 -0
- package/dist/store/sqlite/record-stamps.js +30 -0
- package/dist/store/sqlite/record-writes.d.ts +43 -0
- package/dist/store/sqlite/record-writes.js +307 -0
- package/dist/store/sqlite/records.d.ts +52 -42
- package/dist/store/sqlite/records.js +123 -353
- package/dist/store/sqlite/ref-summaries.d.ts +6 -5
- package/dist/store/sqlite/ref-summaries.js +60 -8
- package/dist/store/sqlite/refunds.d.ts +31 -0
- package/dist/store/sqlite/refunds.js +112 -0
- package/dist/store/sqlite/relation-list.d.ts +43 -0
- package/dist/store/sqlite/relation-list.js +133 -0
- package/dist/store/sqlite/relation-proposals.d.ts +28 -6
- package/dist/store/sqlite/relation-proposals.js +134 -10
- package/dist/store/sqlite/relation-reads.d.ts +8 -0
- package/dist/store/sqlite/relation-reads.js +7 -0
- package/dist/store/sqlite/relation-roles.d.ts +26 -0
- package/dist/store/sqlite/relation-roles.js +91 -0
- package/dist/store/sqlite/reported-relations.d.ts +63 -0
- package/dist/store/sqlite/reported-relations.js +132 -0
- package/dist/store/sqlite/reviewed.d.ts +109 -0
- package/dist/store/sqlite/reviewed.js +173 -0
- package/dist/store/sqlite/schema/link-revisions.d.ts +136 -0
- package/dist/store/sqlite/schema/link-revisions.js +11 -0
- package/dist/store/sqlite/schema/links.d.ts +360 -0
- package/dist/store/sqlite/schema/links.js +32 -0
- package/dist/store/sqlite/schema.d.ts +2769 -306
- package/dist/store/sqlite/schema.js +258 -25
- package/dist/store/sqlite/source-review-marks.d.ts +54 -0
- package/dist/store/sqlite/source-review-marks.js +143 -0
- package/dist/store/sqlite/source-review.d.ts +54 -0
- package/dist/store/sqlite/source-review.js +221 -0
- package/dist/store/sqlite/stage-amounts.d.ts +14 -0
- package/dist/store/sqlite/stage-amounts.js +23 -0
- package/dist/store/sqlite/subscriptions.d.ts +135 -0
- package/dist/store/sqlite/subscriptions.js +294 -0
- package/dist/store/sqlite/text-input.d.ts +3 -0
- package/dist/store/sqlite/text-input.js +13 -0
- package/dist/store/sqlite/things.js +2 -9
- package/dist/store/sqlite/transaction.d.ts +15 -0
- package/dist/store/sqlite/transaction.js +57 -0
- package/dist/store/sqlite/wallets.d.ts +88 -0
- package/dist/store/sqlite/wallets.js +143 -0
- package/dist/store/store-errors.d.ts +1 -0
- package/dist/store/store-errors.js +45 -0
- package/dist/store/store.d.ts +19 -1
- package/dist/store/store.js +35 -6
- package/package.json +6 -3
- package/schemas/examples/records-business.jsonl +11 -0
- package/schemas/records-envelope.v1.schema.json +1160 -5
|
@@ -52,7 +52,7 @@ export declare const taskCard: v.StrictObjectSchema<{
|
|
|
52
52
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
53
53
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
54
54
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
55
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
55
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
56
56
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
57
57
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
58
58
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -67,7 +67,7 @@ export declare const taskCard: v.StrictObjectSchema<{
|
|
|
67
67
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
68
68
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
69
69
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
70
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
70
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
71
71
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
72
72
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
73
73
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -170,7 +170,7 @@ export declare const taskCreated: v.StrictObjectSchema<{
|
|
|
170
170
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
171
171
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
172
172
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
173
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
173
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
174
174
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
175
175
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
176
176
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -185,7 +185,7 @@ export declare const taskCreated: v.StrictObjectSchema<{
|
|
|
185
185
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
186
186
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
187
187
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
188
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
188
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
189
189
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
190
190
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
191
191
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -289,7 +289,7 @@ export declare const taskLinks: v.UnionSchema<[v.StrictObjectSchema<{
|
|
|
289
289
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
290
290
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
291
291
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
292
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
292
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
293
293
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
294
294
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
295
295
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -304,7 +304,7 @@ export declare const taskLinks: v.UnionSchema<[v.StrictObjectSchema<{
|
|
|
304
304
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
305
305
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
306
306
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
307
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
307
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
308
308
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
309
309
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
310
310
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -436,7 +436,7 @@ export declare const taskMerge: v.StrictObjectSchema<{
|
|
|
436
436
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
437
437
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
438
438
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
439
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
439
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
440
440
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
441
441
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
442
442
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -451,7 +451,7 @@ export declare const taskMerge: v.StrictObjectSchema<{
|
|
|
451
451
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
452
452
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
453
453
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
454
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
454
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
455
455
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
456
456
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
457
457
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -548,7 +548,7 @@ export declare const taskUnmerge: v.StrictObjectSchema<{
|
|
|
548
548
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
549
549
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
550
550
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
551
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
551
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
552
552
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
553
553
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
554
554
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -563,7 +563,7 @@ export declare const taskUnmerge: v.StrictObjectSchema<{
|
|
|
563
563
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
564
564
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
565
565
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
566
|
-
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "assigned-to", "attached"], undefined>;
|
|
566
|
+
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
567
567
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
568
568
|
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
569
569
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
package/dist/errors/reasons.js
CHANGED
|
@@ -20,6 +20,7 @@ const SIGN_IN = [
|
|
|
20
20
|
["oauth.timeout", "timeout", "the sign-in was not finished in time"],
|
|
21
21
|
["oauth.mismatch", "authentication_error", "the pasted sign-in result belongs to another sign-in"],
|
|
22
22
|
["oauth.missing", "authentication_error", "this profile is not signed in"],
|
|
23
|
+
["session.missing", "authentication_error", "this profile is not signed in"],
|
|
23
24
|
["oauth.locked", "provider_unavailable", "another process holds this sign-in's lock"],
|
|
24
25
|
["oauth.no-response", "outcome_unknown", "the token request did not finish"],
|
|
25
26
|
["oauth.unavailable", "provider_unavailable", "the provider's token endpoint is unavailable"],
|
|
@@ -62,6 +63,11 @@ const OTHERS = [
|
|
|
62
63
|
validation("mail-findings.partial", "a cited email is not stored whole yet; cite it once it is"),
|
|
63
64
|
validation("evidence-findings.dedicated-review", "review evidence findings through the dedicated findings command"),
|
|
64
65
|
validation("mail-findings.dedicated-review", "review mail findings through the dedicated findings command"),
|
|
66
|
+
validation("source-review.dedicated-review", "decide a source review through the review of memories and facts"),
|
|
67
|
+
validation("source-review.reason-required", "a challenge says why in 1–2000 characters"),
|
|
68
|
+
validation("source-review.evidence-required", "a challenge cites 1–20 references that contradict it"),
|
|
69
|
+
validation("source-review.suggestion-length", "a suggestion with a challenge takes 1–2000 characters"),
|
|
70
|
+
validation("source-review.not-holding", "the memory or fact no longer holds, so there is nothing to challenge"),
|
|
65
71
|
validation("mail-findings.invalid", "a checked mail findings batch would be refused; details.problems names why, finding by finding"),
|
|
66
72
|
validation("mail-findings.key-used", "the findings batch key was already used for different input"),
|
|
67
73
|
validation("finding.unknown-field", "a finding has a field its kind does not take"),
|
|
@@ -128,6 +134,21 @@ const OTHERS = [
|
|
|
128
134
|
["feed.gone", "not_found", "the feed's server has no feed at this address any more"],
|
|
129
135
|
["feed.timeout", "timeout", "the feed's server did not answer in time"],
|
|
130
136
|
["feed.unreachable", "network_error", "the feed's server could not be reached"],
|
|
137
|
+
validation("source.url-refused", "the link is not an http or https page on the public internet"),
|
|
138
|
+
["source.url-status", "provider_error", "the page's server answered with an error status"],
|
|
139
|
+
["source.url-timeout", "timeout", "the page did not arrive in time"],
|
|
140
|
+
["source.url-redirects", "provider_error", "the page sent the request on too many times"],
|
|
141
|
+
["source.url-unreachable", "network_error", "the page's server could not be found or reached"],
|
|
142
|
+
[
|
|
143
|
+
"source.needs-sign-in",
|
|
144
|
+
"authentication_error",
|
|
145
|
+
"the page asks for a sign-in; a private Google document is read through Drive",
|
|
146
|
+
],
|
|
147
|
+
validation("source.too-large", "the source is larger than one read takes"),
|
|
148
|
+
validation("source.unsupported", "no reader takes this kind of source"),
|
|
149
|
+
validation("source.no-text", "the source holds no text to keep"),
|
|
150
|
+
validation("source.unreadable", "the reader could not read the source"),
|
|
151
|
+
["source.engine-missing", "configuration_error", "reading this source needs a reader package that is not installed"],
|
|
131
152
|
validation("busy.feed", "a feed calendar has no busy times to ask; read its events with events list"),
|
|
132
153
|
["calendar.unsynced", "not_found", "the calendar account has no synced calendar in the store"],
|
|
133
154
|
["calendar.sync-incomplete", "not_found", "a synced calendar's sync never finished or is mid-round"],
|
|
@@ -185,6 +206,8 @@ const OTHERS = [
|
|
|
185
206
|
["store.vector-extension-failed", "configuration_error", "the sqlite-vec extension did not load; reinstall the CLI"],
|
|
186
207
|
validation("store.vector-invalid", "a vector to store had a non-finite value"),
|
|
187
208
|
validation("catalog.scope-limit", "the selected catalog exceeds its entry limit"),
|
|
209
|
+
validation("evidence.quote-length", "a quote from the evidence is empty or over 500 characters"),
|
|
210
|
+
validation("evidence.quote-not-found", "the cited source does not say the quoted words"),
|
|
188
211
|
validation("evidence.row-too-large", "one evidence row is over its size limit"),
|
|
189
212
|
validation("index.not-ready", "the search index is still being built"),
|
|
190
213
|
validation("input.closed", "the input closed before the answer"),
|
|
@@ -204,12 +227,23 @@ const OTHERS = [
|
|
|
204
227
|
validation("finance.over-invoice", "the allocation would settle more than the invoice's total"),
|
|
205
228
|
validation("finance.over-payment", "the allocation would use more than the payment's amount"),
|
|
206
229
|
["finance.owner-only", "permission_error", "only the owner does this with money"],
|
|
230
|
+
validation("finance.over-refund", "the refunds would take back more than the payment, or than it gave an invoice"),
|
|
207
231
|
validation("finance.party", "a party is a person: or organization: reference"),
|
|
208
232
|
validation("finance.ref", "the reference names no invoice or payment"),
|
|
233
|
+
validation("finance.refund", "a refund goes the other way in the same currency, of a live payment confirmed first, to an invoice it paid"),
|
|
234
|
+
validation("finance.refunded", "a refund of the payment still stands; reject it or take it back first"),
|
|
209
235
|
validation("finance.status", "the invoice's status does not allow this"),
|
|
210
236
|
validation("finance.total", "the invoice's total is not the sum of its lines"),
|
|
211
237
|
validation("finance.unallocate", "a rejected or deleted payment's allocations are not taken back"),
|
|
212
|
-
validation("record.entity", "the
|
|
238
|
+
validation("record.entity", "the entity or proposal the record stands for was refused"),
|
|
239
|
+
validation("record.provider-not-imported", "SMS and calls are imported only under an import-only provider, such as phone"),
|
|
240
|
+
validation("record.chat", "the chat an SMS names is not an imported one: a sync owns it"),
|
|
241
|
+
validation("record.moved", "an SMS stays in its thread: delete it and send it again under a new external_id"),
|
|
242
|
+
validation("record.phone-region", "a phone without + is read only in the envelope's phone_region; kept as data"),
|
|
243
|
+
validation("record.separated", "the owner told the one entity these identifiers match apart from them"),
|
|
244
|
+
["store.dry-run", "conflict", "a dry run of an import holds the store; the read or write waits for it to end"],
|
|
245
|
+
validation("record.ambiguous", "the record's identifiers point at more than one entity; the owner says which"),
|
|
246
|
+
validation("record.identifier", "a free-mail domain names no organization: anyone has an address there"),
|
|
213
247
|
["record.map-owner-only", "permission_error", "only the owner says which entity a source record is"],
|
|
214
248
|
validation("record.map-type", "a record maps only to an entity of its own type"),
|
|
215
249
|
validation("record.mapped", "the record already stands for another entity"),
|
|
@@ -219,6 +253,7 @@ const OTHERS = [
|
|
|
219
253
|
validation("record.reference-not-found", "a reference in the record's fields is not in the store"),
|
|
220
254
|
validation("record.relation-ambiguous", "the record names more than one target for a role that takes one"),
|
|
221
255
|
validation("record.stale-revision", "the store holds a newer revision of the record"),
|
|
256
|
+
validation("memory.already-superseded", "the memory was already replaced by another"),
|
|
222
257
|
validation("memory.evidence-required", "a memory needs its evidence"),
|
|
223
258
|
validation("memory.scope-required", "a memory needs its scope"),
|
|
224
259
|
validation("money.amount", "the amount is not a decimal string in the currency's scale"),
|
|
@@ -235,13 +270,45 @@ const OTHERS = [
|
|
|
235
270
|
["pipeline.not-found", "not_found", "no stored pipeline has that name or reference"],
|
|
236
271
|
validation("crm.stage-unknown", "a CRM item stands in a stage the store does not hold; it was not kept"),
|
|
237
272
|
validation("crm.item-invalid", "a CRM item has a field the store refuses, such as a currency it does not keep"),
|
|
238
|
-
validation("crm.pipeline-required", "the CRM has more than one pipeline of the kind; the
|
|
273
|
+
validation("crm.pipeline-required", "the CRM has more than one pipeline of the kind; the command names one"),
|
|
239
274
|
validation("field.unknown", "no custom field of the kind has that code or label; `fields list` lists them"),
|
|
240
275
|
validation("field.ambiguous", "more than one custom field has that label; name one by its code"),
|
|
241
276
|
validation("field.unknown-option", "the list field has no option with that id or label"),
|
|
242
277
|
validation("field.unknown-kind", "fields are listed for deals, leads, people and organizations only"),
|
|
243
278
|
validation("crm.write-unsupported", "the CRM does not take this write, or does not recognise a repeated one"),
|
|
244
279
|
validation("crm.unlisted-held", "a list of every id would mark most of a kind deleted; nothing was, until --rescan"),
|
|
280
|
+
validation("crm.not-reported", "the CRM did not list users or departments; what they would say is unknown, nothing withdrawn"),
|
|
281
|
+
validation("crm.reference-unknown", "a CRM row names a contact, company or user the store does not hold; that link was not made"),
|
|
282
|
+
validation("crm.pending-dropped", "relationships waited too long for an end that never came; they were dropped"),
|
|
283
|
+
validation("crm.email-ambiguous", "a CRM contact's email belongs to more than one person; the owner decides"),
|
|
284
|
+
validation("crm.own-unknown", "no own company of the CRM account is stored, so its users are no one's employees yet"),
|
|
285
|
+
validation("relationship.reference-unknown", "a reported relationship names something the store does not hold"),
|
|
286
|
+
validation("relationship.invalid", "a reported relationship joins ends or takes a role the registry refuses"),
|
|
287
|
+
validation("contract.field", "a field of the contract is not valid"),
|
|
288
|
+
validation("contract.ref", "the reference names no contract, or no deal for it"),
|
|
289
|
+
validation("order.currency", "the product is priced in another currency than the order"),
|
|
290
|
+
validation("order.line", "an order keeps at least one line: reject or cancel it instead"),
|
|
291
|
+
validation("order.line-amount", "the line's amount is not its quantity times its unit price"),
|
|
292
|
+
validation("order.lines", "the order's lines are not valid"),
|
|
293
|
+
["order.no-line", "not_found", "the order has no line at that position"],
|
|
294
|
+
["order.owner-only", "permission_error", "only the owner changes a confirmed order's lines"],
|
|
295
|
+
validation("order.total", "an order with lines names its currency and totals their sum"),
|
|
296
|
+
validation("product.duplicate", "a product with that code is already stored for that supplier"),
|
|
297
|
+
validation("product.field", "a field of the product is not valid"),
|
|
298
|
+
validation("product.ref", "the reference names no product"),
|
|
299
|
+
validation("subscription.field", "a field of the subscription is not valid"),
|
|
300
|
+
validation("subscription.interval", "an interval is a count and a unit, such as 1-month"),
|
|
301
|
+
["subscription.no-price", "not_found", "no stored subscription price has that id"],
|
|
302
|
+
validation("subscription.price", "a price is never changed: reject it and add a new one, after its subscription"),
|
|
303
|
+
validation("subscription.ref", "the reference names no subscription, product or contract for it"),
|
|
304
|
+
validation("transaction.field", "a field of the transaction is not valid"),
|
|
305
|
+
validation("transaction.payment", "the payment is not the same money: currency, direction and amount differ"),
|
|
306
|
+
validation("transaction.ref", "the reference names no transaction or wallet"),
|
|
307
|
+
["transaction.no-split", "not_found", "the transaction has no split at that position"],
|
|
308
|
+
validation("transaction.split", "the splits come to more than the transaction, or name no category"),
|
|
309
|
+
validation("wallet.field", "a field of the wallet is not valid"),
|
|
310
|
+
validation("wallet.number", "a wallet keeps only the last 4 characters of a number"),
|
|
311
|
+
validation("wallet.ref", "the reference names no wallet"),
|
|
245
312
|
validation("order.duplicate", "the shop's order with this number is already stored; change its status instead"),
|
|
246
313
|
validation("order.proposed", "the shop's order with this number already waits for the owner in a findings batch"),
|
|
247
314
|
validation("order.field", "a field of the order is not valid"),
|
|
@@ -293,6 +360,10 @@ const OTHERS = [
|
|
|
293
360
|
["proposals.agent-decisions-off", "permission_error", "agent decisions are turned off; the owner decides"],
|
|
294
361
|
["proposal.unknown-kind", "not_found", "no registered proposal kind holds this id"],
|
|
295
362
|
validation("relationship.exists", "a confirmed relationship already links them"),
|
|
363
|
+
validation("relationship.role-exists", "the role list holds that role already"),
|
|
364
|
+
validation("relationship.role-built-in", "a built-in role stays on its list"),
|
|
365
|
+
validation("relationship.role-in-use", "relationships still hold that role; change them first (details.count)"),
|
|
366
|
+
validation("relationship.role-unknown", "the role is not one the relationship takes; the message lists them"),
|
|
296
367
|
validation("ranking.invalid", "the ranking is not valid"),
|
|
297
368
|
validation("ref.malformed", "the reference has a known kind but not its shape"),
|
|
298
369
|
validation("ref.unknown-kind", "the text names no kind of reference"),
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether an IP address is on the public internet: not loopback, private, link-local, CGNAT, ULA, multicast,
|
|
3
|
+
* unspecified, documentation or reserved, nor one of those carried in an IPv6 form (`::ffff:10.0.0.1`).
|
|
4
|
+
*/
|
|
5
|
+
export declare const isPublicAddress: (address: string) => boolean;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { isIP } from "node:net";
|
|
2
|
+
const within = (address, [prefix, bits]) => {
|
|
3
|
+
for (let bit = 0; bit < bits; bit++) {
|
|
4
|
+
const mask = 0x80 >> (bit % 8);
|
|
5
|
+
if (((address[bit >> 3] ?? 0) & mask) !== ((prefix[bit >> 3] ?? 0) & mask))
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
9
|
+
};
|
|
10
|
+
/** Not the public internet (RFC 6890 and its updates); 240/4 holds the broadcast address. */
|
|
11
|
+
const V4_PRIVATE = [
|
|
12
|
+
[[0], 8],
|
|
13
|
+
[[10], 8],
|
|
14
|
+
[[100, 64], 10],
|
|
15
|
+
[[127], 8],
|
|
16
|
+
[[169, 254], 16],
|
|
17
|
+
[[172, 16], 12],
|
|
18
|
+
[[192, 0, 0], 24],
|
|
19
|
+
[[192, 0, 2], 24],
|
|
20
|
+
[[192, 88, 99], 24],
|
|
21
|
+
[[192, 168], 16],
|
|
22
|
+
[[198, 18], 15],
|
|
23
|
+
[[198, 51, 100], 24],
|
|
24
|
+
[[203, 0, 113], 24],
|
|
25
|
+
[[224], 4],
|
|
26
|
+
[[240], 4],
|
|
27
|
+
];
|
|
28
|
+
/** Inside global unicast (2000::/3), the blocks that are not the public internet. */
|
|
29
|
+
const V6_PRIVATE = [
|
|
30
|
+
[[0x20, 0x01, 0x00, 0x00], 23],
|
|
31
|
+
[[0x20, 0x01, 0x0d, 0xb8], 32],
|
|
32
|
+
[[0x3f, 0xff], 20],
|
|
33
|
+
];
|
|
34
|
+
/** Forms that carry an IPv4 address, and where it sits: mapped, NAT64 and 6to4. */
|
|
35
|
+
const V6_CARRIERS = [
|
|
36
|
+
[[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff], 96], 12],
|
|
37
|
+
[[[0x00, 0x64, 0xff, 0x9b, 0, 0, 0, 0, 0, 0, 0, 0], 96], 12],
|
|
38
|
+
[[[0x20, 0x02], 16], 2],
|
|
39
|
+
];
|
|
40
|
+
const v4Bytes = (text) => new Uint8Array(text.split(".").map(Number));
|
|
41
|
+
const v6Bytes = (text) => {
|
|
42
|
+
const bytes = new Uint8Array(16);
|
|
43
|
+
let address = text.replace(/%.*$/, "");
|
|
44
|
+
const dotted = /(\d+\.\d+\.\d+\.\d+)$/.exec(address);
|
|
45
|
+
if (dotted?.[1]) {
|
|
46
|
+
const [a, b, c, d] = v4Bytes(dotted[1]);
|
|
47
|
+
address = `${address.slice(0, dotted.index)}${(((a ?? 0) << 8) | (b ?? 0)).toString(16)}:${(((c ?? 0) << 8) | (d ?? 0)).toString(16)}`;
|
|
48
|
+
}
|
|
49
|
+
const [head = "", tail] = address.split("::");
|
|
50
|
+
const groups = (part) => (part ? part.split(":").map((group) => Number.parseInt(group, 16)) : []);
|
|
51
|
+
const left = groups(head);
|
|
52
|
+
const right = tail === undefined ? [] : groups(tail);
|
|
53
|
+
const all = [...left, ...new Array(8 - left.length - right.length).fill(0), ...right];
|
|
54
|
+
all.forEach((group, at) => {
|
|
55
|
+
bytes[at * 2] = group >> 8;
|
|
56
|
+
bytes[at * 2 + 1] = group & 0xff;
|
|
57
|
+
});
|
|
58
|
+
return bytes;
|
|
59
|
+
};
|
|
60
|
+
const publicV4 = (bytes) => !V4_PRIVATE.some((prefix) => within(bytes, prefix));
|
|
61
|
+
/**
|
|
62
|
+
* Whether an IP address is on the public internet: not loopback, private, link-local, CGNAT, ULA, multicast,
|
|
63
|
+
* unspecified, documentation or reserved, nor one of those carried in an IPv6 form (`::ffff:10.0.0.1`).
|
|
64
|
+
*/
|
|
65
|
+
export const isPublicAddress = (address) => {
|
|
66
|
+
const family = isIP(address);
|
|
67
|
+
if (family === 4)
|
|
68
|
+
return publicV4(v4Bytes(address));
|
|
69
|
+
if (family !== 6)
|
|
70
|
+
return false;
|
|
71
|
+
const bytes = v6Bytes(address);
|
|
72
|
+
for (const [prefix, at] of V6_CARRIERS)
|
|
73
|
+
if (within(bytes, prefix))
|
|
74
|
+
return publicV4(bytes.subarray(at, at + 4));
|
|
75
|
+
return within(bytes, [[0x20], 3]) && !V6_PRIVATE.some((prefix) => within(bytes, prefix));
|
|
76
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { LoadEngine, Section } from "../readers/types.js";
|
|
2
|
+
export interface PageLimits {
|
|
3
|
+
/** Bytes of the body as sent: the request asks for no compression, so this is what is read. */
|
|
4
|
+
maxBytes: number;
|
|
5
|
+
/** For the whole read: every redirect and the body. */
|
|
6
|
+
timeoutMs: number;
|
|
7
|
+
redirects: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const PAGE_LIMITS: PageLimits;
|
|
10
|
+
export interface ResolvedAddress {
|
|
11
|
+
address: string;
|
|
12
|
+
family: 4 | 6;
|
|
13
|
+
}
|
|
14
|
+
export type PageLookup = (hostname: string) => Promise<ResolvedAddress[]>;
|
|
15
|
+
export interface PageRequest {
|
|
16
|
+
url: URL;
|
|
17
|
+
/** The checked address the connection must go to, whatever the name resolves to by then. */
|
|
18
|
+
address: ResolvedAddress;
|
|
19
|
+
headers: Readonly<Record<string, string>>;
|
|
20
|
+
signal: AbortSignal;
|
|
21
|
+
}
|
|
22
|
+
export interface PageResponse {
|
|
23
|
+
status: number;
|
|
24
|
+
header(name: string): string | null;
|
|
25
|
+
body: AsyncIterable<Uint8Array>;
|
|
26
|
+
/** Drops the rest of the body and the connection. */
|
|
27
|
+
cancel(): void;
|
|
28
|
+
}
|
|
29
|
+
/** Sends one GET to the pinned address and answers once the headers arrive; follows no redirect. */
|
|
30
|
+
export type PageTransport = (request: PageRequest) => Promise<PageResponse>;
|
|
31
|
+
export interface FetchPageOptions {
|
|
32
|
+
limits?: Partial<PageLimits>;
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
lookup?: PageLookup;
|
|
35
|
+
transport?: PageTransport;
|
|
36
|
+
load?: LoadEngine;
|
|
37
|
+
}
|
|
38
|
+
export interface FetchedPage {
|
|
39
|
+
/** The address as given: what a caller keeps as the source's address. */
|
|
40
|
+
requestedUrl: string;
|
|
41
|
+
/** Where the redirects ended; it may carry a token a redirect signed, so it is never stored or logged. */
|
|
42
|
+
finalUrl: string;
|
|
43
|
+
status: number;
|
|
44
|
+
contentType: string | null;
|
|
45
|
+
bytes: number;
|
|
46
|
+
/** Empty when `read` is `no-text`: an image, whose words a reader of the owner's choice may read later. */
|
|
47
|
+
text: string;
|
|
48
|
+
extractor: string | null;
|
|
49
|
+
read: "extracted" | "no-text";
|
|
50
|
+
/** The reader kept only the first part of the text. */
|
|
51
|
+
truncated: boolean;
|
|
52
|
+
metadata?: Record<string, string | string[]>;
|
|
53
|
+
sections?: Section[];
|
|
54
|
+
}
|
|
55
|
+
/** Names the tool, never the owner. */
|
|
56
|
+
export declare const PAGE_USER_AGENT = "Mozilla/5.0 (compatible; WireCat)";
|
|
57
|
+
/** node's own client, so the connection goes to the checked address and the TLS name stays the page's. */
|
|
58
|
+
export declare const nodeTransport: PageTransport;
|
|
59
|
+
/**
|
|
60
|
+
* One page read from the internet, for a source the owner adds by hand: http(s) only, every hop's address checked to
|
|
61
|
+
* be public and connected to as checked, at most `redirects` redirects followed by hand, no cookies, no credentials,
|
|
62
|
+
* and the reader chosen by the content type. Errors name the host only: an address may carry a token.
|
|
63
|
+
*/
|
|
64
|
+
export declare const fetchPage: (address: string, options?: FetchPageOptions) => Promise<FetchedPage>;
|