xmemory 3.20.0 → 3.21.1
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/README.md +33 -5
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/types.d.ts +65 -8
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/types.d.ts +65 -8
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -247,8 +247,9 @@ if (status.write_status === "completed") {
|
|
|
247
247
|
|
|
248
248
|
A finished write carries `changes`, the async path's only view of what the write
|
|
249
249
|
did — and where a [scoped write](#scoped-writes) in `"drop"` mode reports what it
|
|
250
|
-
left out,
|
|
251
|
-
|
|
250
|
+
left out, a [field merge](#mergeable-text-fields) what it chose between, and a
|
|
251
|
+
[delete](#records-a-delete-left-without-a-link) the records it left without a link.
|
|
252
|
+
A status for a write that has not finished carries none, so the field is optional.
|
|
252
253
|
|
|
253
254
|
### Write ordering
|
|
254
255
|
|
|
@@ -334,6 +335,33 @@ The key is omitted when there is no such entry. An absent key does not prove the
|
|
|
334
335
|
texts agreed: a merge that failed, fell back to appending, or left the stored
|
|
335
336
|
text unchanged reports none.
|
|
336
337
|
|
|
338
|
+
### Records a delete left without a link
|
|
339
|
+
|
|
340
|
+
Deleting a record never deletes the records linked to it. The relation's
|
|
341
|
+
`on_delete` removes or clears each link, and the write lists those links under
|
|
342
|
+
`changes.deleted.relations`; a link the same write also states may be reported
|
|
343
|
+
under `relationship_outcomes` as well, or instead. A record whose last link of a
|
|
344
|
+
relation was the deleted one is listed in `changes.orphaned_records`
|
|
345
|
+
(`OrphanedRecord`), so you can decide whether it still belongs. `relation` is
|
|
346
|
+
the relation's class name: an XMD relation `works_at` comes back as `WorksAt`:
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
const result = await inst.write("Remove the Harbour Wall project.");
|
|
350
|
+
for (const r of result.changes.orphaned_records ?? []) {
|
|
351
|
+
console.log(r.object_type_name, r.folded ? `${r.count} more` : r.identity, "has no", r.relation, "link left");
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
The key is omitted when there is no such record and by a server from before this
|
|
356
|
+
report, so a missing key means none reported. It means nothing at all when
|
|
357
|
+
`relationship_outcomes` reports the write's summary unavailable (an entry with
|
|
358
|
+
`status: "unavailable"`). A record the write deleted, or that still has a link
|
|
359
|
+
of that relation when the write completes, is not listed. Past 100 entries of
|
|
360
|
+
one type and relation, the rest arrive as one entry marked `folded: true`, with
|
|
361
|
+
an empty `identity` and their `count`. `deleted.relations` folds a delete's
|
|
362
|
+
links past 100 of one relation into one entry with that relation's `name`, empty
|
|
363
|
+
`endpoints` and `fields`, `folded: true` and their `count`.
|
|
364
|
+
|
|
337
365
|
### `inst.read(query, options?)` → `ReadResult`
|
|
338
366
|
|
|
339
367
|
Query the instance.
|
|
@@ -484,7 +512,7 @@ level in the shape it always had: `depth`, `omitted_objects` and the catalog
|
|
|
484
512
|
entries' `distance`, `related` and `omitted_related` are then absent. A value
|
|
485
513
|
outside 1 to 3 is a 422 whose `code` is `VALIDATION_ERROR`. Asking for related
|
|
486
514
|
types needs the
|
|
487
|
-
`instance.
|
|
515
|
+
`instance.get` permission on the API key, the same one the schema
|
|
488
516
|
endpoints need, on top of `data.read`: a key without it gets a 403 whose
|
|
489
517
|
message names the permission, and the plain read is unaffected.
|
|
490
518
|
|
|
@@ -854,7 +882,7 @@ different things:
|
|
|
854
882
|
| 402 | `QUOTA_EXCEEDED` | Tenant exhausted its plan/usage allowance (a daily or monthly token quota). | **No.** Wait for the window to reset. |
|
|
855
883
|
| 429 | `RATE_LIMITED` | Genuine velocity / rate limit. | **Yes**, with backoff. |
|
|
856
884
|
| 422 | `INVALID_INPUT` | A read that answered nothing: in `"raw-tables"` / `"xresponse"` mode every sub-query's SQL failed, or the model provider declined the input. See [What comes back](#what-comes-back). | **No.** Same input, same answer. |
|
|
857
|
-
| 403 | `FORBIDDEN` | The API key lacks a permission the call needs — for a read with `includeRelatedTypes: "types"`, `instance.get_own
|
|
885
|
+
| 403 | `FORBIDDEN` | The API key lacks a permission the call needs — for a read with `includeRelatedTypes: "types"`, `instance.get` (servers from before the permission rename call it `instance.get_own`); the message names it. See [Related types](#related-types). | **No.** Repeat without the option, or use a key that holds it. |
|
|
858
886
|
|
|
859
887
|
For `QUOTA_EXCEEDED`, `details` carries `kind`
|
|
860
888
|
(`"daily_quota_exceeded"` | `"monthly_quota_exceeded"`) and
|
|
@@ -968,7 +996,7 @@ new file mode 100644
|
|
|
968
996
|
+ id: 'xmemory',
|
|
969
997
|
+ servers: {
|
|
970
998
|
+ xmemory: {
|
|
971
|
-
+ url: new URL('https://
|
|
999
|
+
+ url: new URL('https://mcp.xmemory.ai'),
|
|
972
1000
|
+ requestInit: {
|
|
973
1001
|
+ headers: {
|
|
974
1002
|
+ Authorization: `Bearer ${process.env.XMEM_MCP_BEARER_TOKEN}`,
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { AgentSurface, BindingTier, FragmentMerge, SetupFormat, StepKind } from
|
|
|
10
10
|
export type { AgentSetupResult, AgentSetupStep, AgentSetupSurface, AgentSurfaceValue, FragmentMergeValue, ProjectFragment, ProjectSetup, SetupFormatValue, StepKindValue, BindingTierValue, SchemaTypeValue, ExtractionLogic, ReadMode, RelatedTypesMode, RelationCardinality, WriteQueueStatus, FieldType, OnDelete, CastStrategy, DecisionKind, MigrationSource, } from "./types.js";
|
|
11
11
|
export type { ScopeObject, ReadScope, WriteScope, RelationsScope, WriteScopeMode } from "./types.js";
|
|
12
12
|
export type { XmemoryClientOptions, RequestOptions, ReadOptions, WriteOptions, ExtractOptions, CreateInstanceOptions, GenerateSchemaOptions, UpdateInstanceMetadataOptions, PatchInstanceMetadataOptions, UpdateInstanceSchemaOptions, DryRunMigrationOptions, ListMigrationsOptions, GetMigrationOptions, SuggestionRequestOptions, } from "./types.js";
|
|
13
|
-
export type { ClusterInfo, InstanceInfo, InstanceSchemaInfo, ReadResult, TaggedReaderResult, RelatedTypes, RelatedTypesTouched, RelatedTypesLink, RelatedTypesObjectType, RelatedTypesRelation, WriteResult, WriteChanges, SkippedOutOfScope, FieldMergeContradiction, AsyncWriteResult, WriteStatusResult, ExtractResult, GenerateSchemaResult, ToolDescription, ToolParameterDescription, RawDescribeResult, } from "./types.js";
|
|
13
|
+
export type { ClusterInfo, InstanceInfo, InstanceSchemaInfo, ReadResult, TaggedReaderResult, RelatedTypes, RelatedTypesTouched, RelatedTypesLink, RelatedTypesObjectType, RelatedTypesRelation, WriteResult, WriteChanges, SkippedOutOfScope, FieldMergeContradiction, OrphanedRecord, AsyncWriteResult, WriteStatusResult, ExtractResult, GenerateSchemaResult, ToolDescription, ToolParameterDescription, RawDescribeResult, } from "./types.js";
|
|
14
14
|
export type { WriteMutation, ObjectMutationBody, ObjectCreatePayload, ObjectUpdatePayload, ObjectDeletePayload, RelationMutationBody, RelationCreatePayload, RelationUpdatePayload, RelationDeletePayload, RelationEndpoint, } from "./types.js";
|
|
15
15
|
export type { MigrationPlan, MigrationOp, FieldSpec, AddObject, RemoveObject, RenameObject, ChangeObject, AddField, RemoveField, RenameField, ChangeField, AddRelation, RemoveRelation, RenameRelation, ChangeRelation, DefaultValue, EnumValues, } from "./types.js";
|
|
16
16
|
export type { EnhanceSchemaResult, PlanSummary, DryRunResult, MigrationRecord, ListMigrationsResult, GetMigrationResult, ConsolidatedProposal, ProposalItem, ReviewSuggestionsResult, DecisionInput, RecordedDecision, DependencyWarning, DecideSuggestionsResult, ApplyPendingDecisionsResult, } from "./types.js";
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type ReadMode = "single-answer" | "raw-tables" | "xresponse";
|
|
|
11
11
|
/**
|
|
12
12
|
* What a read says about the schema around its answer. `"types"` adds
|
|
13
13
|
* {@link ReadResult.related_types} to the result; `"none"` (the server default)
|
|
14
|
-
* leaves it out. Asking for it needs the `instance.
|
|
14
|
+
* leaves it out. Asking for it needs the `instance.get` permission on the
|
|
15
15
|
* API key, the same one the schema endpoints need, on top of `data.read`: a key
|
|
16
16
|
* without it gets a 403 whose message names the permission, and the plain read
|
|
17
17
|
* is unaffected.
|
|
@@ -488,20 +488,64 @@ export interface FieldMergeContradiction {
|
|
|
488
488
|
*/
|
|
489
489
|
readonly kept: "stored" | "new" | (string & {});
|
|
490
490
|
}
|
|
491
|
+
/**
|
|
492
|
+
* A stored record a delete in the write left with no link of a relation it had
|
|
493
|
+
* one of: the deleted record was its last link of that relation.
|
|
494
|
+
*
|
|
495
|
+
* Deleting a record never deletes the records linked to it. Its links are
|
|
496
|
+
* removed or cleared, as the relation's `on_delete` says, and listed under
|
|
497
|
+
* `deleted.relations`; a link the same write also states may be reported under
|
|
498
|
+
* `relationship_outcomes` as well, or instead. A record left without any link
|
|
499
|
+
* of a relation is listed here, so the caller can decide whether it still
|
|
500
|
+
* belongs.
|
|
501
|
+
*/
|
|
502
|
+
export interface OrphanedRecord {
|
|
503
|
+
/** The object type of the record left without a link. */
|
|
504
|
+
readonly object_type_name: string;
|
|
505
|
+
/**
|
|
506
|
+
* The record as the write's other entries name it: by the write's own
|
|
507
|
+
* identifier when the write names it, otherwise by its primary key, rendered
|
|
508
|
+
* `field='value'` (a composite key's parts comma-separated). Empty for a type
|
|
509
|
+
* without a key, for a key missing a part, and on a folded entry.
|
|
510
|
+
*/
|
|
511
|
+
readonly identity: string;
|
|
512
|
+
/**
|
|
513
|
+
* The relation the record no longer has a link of, by its class name: an XMD
|
|
514
|
+
* relation `works_at` comes back as `WorksAt`.
|
|
515
|
+
*/
|
|
516
|
+
readonly relation: string;
|
|
517
|
+
/** On a folded entry, how many records it stands for. */
|
|
518
|
+
readonly count?: number;
|
|
519
|
+
/**
|
|
520
|
+
* `true` on an entry that stands for the records past the first 100 of one
|
|
521
|
+
* type and relation, with an empty `identity` and their `count`.
|
|
522
|
+
*/
|
|
523
|
+
readonly folded?: boolean;
|
|
524
|
+
}
|
|
491
525
|
/**
|
|
492
526
|
* What a write did, grouped into `created` / `updated` / `deleted`, plus what a
|
|
493
|
-
* `"drop"`-mode scope left out
|
|
527
|
+
* `"drop"`-mode scope left out, the contradictions a field merge resolved and
|
|
528
|
+
* the records a delete left without a link.
|
|
494
529
|
*
|
|
495
530
|
* The three groups stay `unknown`: their shape is the server's to evolve and
|
|
496
531
|
* this client has never modelled it. `skipped_out_of_scope` is typed because it
|
|
497
532
|
* is the one part a caller has to branch on — a `"drop"`-mode write succeeds
|
|
498
533
|
* whether or not it skipped anything, so this list is the only report that some
|
|
499
534
|
* of what the text said was not applied. `merge_contradictions` is typed because
|
|
500
|
-
* it is the only report of what a merge chose between
|
|
535
|
+
* it is the only report of what a merge chose between, and `orphaned_records`
|
|
536
|
+
* because it is the only report of a record a delete left without a link.
|
|
501
537
|
*/
|
|
502
538
|
export interface WriteChanges {
|
|
503
539
|
readonly created: unknown;
|
|
504
540
|
readonly updated: unknown;
|
|
541
|
+
/**
|
|
542
|
+
* What the write deleted, as `{ objects, relations }`. A record delete's
|
|
543
|
+
* links, removed or cleared as the relation's `on_delete` says, are listed
|
|
544
|
+
* under `relations`; a link the same write also states may be reported
|
|
545
|
+
* under `relationship_outcomes` as well, or instead. Past 100 links of one
|
|
546
|
+
* relation, the rest arrive as one entry with that relation's `name`, empty
|
|
547
|
+
* `endpoints` and `fields`, `folded: true` and their `count`.
|
|
548
|
+
*/
|
|
505
549
|
readonly deleted: unknown;
|
|
506
550
|
/**
|
|
507
551
|
* Omitted by the server when nothing was skipped — which is every write that
|
|
@@ -520,6 +564,18 @@ export interface WriteChanges {
|
|
|
520
564
|
* appended, or left the stored text unchanged reports none.
|
|
521
565
|
*/
|
|
522
566
|
readonly merge_contradictions?: readonly FieldMergeContradiction[];
|
|
567
|
+
/**
|
|
568
|
+
* The stored records a delete in this write left with no link of a relation
|
|
569
|
+
* they had one of. Advisory: delete or relink such a record if it no longer
|
|
570
|
+
* belongs. A record the write deleted, or that still has a link of that
|
|
571
|
+
* relation when the write completes, is not listed. Omitted by the server
|
|
572
|
+
* when there is none, and by a server that predates the report, so
|
|
573
|
+
* `undefined` and `[]` both mean "none reported" — and nothing at all when
|
|
574
|
+
* `relationship_outcomes` reports the write's summary unavailable (an entry
|
|
575
|
+
* with `status: "unavailable"`). Past 100 entries of one type and relation,
|
|
576
|
+
* the rest arrive folded into one entry (see {@link OrphanedRecord.folded}).
|
|
577
|
+
*/
|
|
578
|
+
readonly orphaned_records?: readonly OrphanedRecord[];
|
|
523
579
|
}
|
|
524
580
|
export interface WriteResult {
|
|
525
581
|
readonly write_id: string;
|
|
@@ -528,8 +584,9 @@ export interface WriteResult {
|
|
|
528
584
|
readonly console_url: string | null;
|
|
529
585
|
/**
|
|
530
586
|
* What the write did, grouped into `created` / `updated` / `deleted`; for a
|
|
531
|
-
* scoped write in `"drop"` mode, what it skipped instead of applying;
|
|
532
|
-
*
|
|
587
|
+
* scoped write in `"drop"` mode, what it skipped instead of applying; what a
|
|
588
|
+
* field merge chose between (`merge_contradictions`); and the records a delete
|
|
589
|
+
* left without a link (`orphaned_records`).
|
|
533
590
|
*/
|
|
534
591
|
readonly changes: WriteChanges;
|
|
535
592
|
}
|
|
@@ -551,8 +608,8 @@ export interface WriteStatusResult {
|
|
|
551
608
|
* What the finished write did, in the same shape {@link WriteResult.changes}
|
|
552
609
|
* carries — and the async caller's only view of it, since `writeAsync`
|
|
553
610
|
* returns before the write has done anything. It is therefore where a
|
|
554
|
-
* `"drop"`-mode scope reports what it skipped,
|
|
555
|
-
* between.
|
|
611
|
+
* `"drop"`-mode scope reports what it skipped, a field merge what it chose
|
|
612
|
+
* between, and a delete the records it left without a link.
|
|
556
613
|
*
|
|
557
614
|
* Optional because a status is not always about a finished write: a queued,
|
|
558
615
|
* in-progress, failed or unknown `write_id` carries none. Read it once
|
|
@@ -924,7 +981,7 @@ export interface ReadOptions {
|
|
|
924
981
|
* `"types"` asks for {@link ReadResult.related_types}: the object types the read
|
|
925
982
|
* touched, the fields it did not return, and the object types a declared
|
|
926
983
|
* relation links them to. Left unset, nothing is sent and the server default
|
|
927
|
-
* (`"none"`) applies. Needs `instance.
|
|
984
|
+
* (`"none"`) applies. Needs `instance.get` on the API key; see
|
|
928
985
|
* {@link RelatedTypesMode}.
|
|
929
986
|
*/
|
|
930
987
|
includeRelatedTypes?: RelatedTypesMode;
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Package version. Kept in sync with `package.json` — a test asserts they match. */
|
|
2
|
-
export declare const VERSION = "3.
|
|
2
|
+
export declare const VERSION = "3.21.1";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { AgentSurface, BindingTier, FragmentMerge, SetupFormat, StepKind } from
|
|
|
10
10
|
export type { AgentSetupResult, AgentSetupStep, AgentSetupSurface, AgentSurfaceValue, FragmentMergeValue, ProjectFragment, ProjectSetup, SetupFormatValue, StepKindValue, BindingTierValue, SchemaTypeValue, ExtractionLogic, ReadMode, RelatedTypesMode, RelationCardinality, WriteQueueStatus, FieldType, OnDelete, CastStrategy, DecisionKind, MigrationSource, } from "./types.js";
|
|
11
11
|
export type { ScopeObject, ReadScope, WriteScope, RelationsScope, WriteScopeMode } from "./types.js";
|
|
12
12
|
export type { XmemoryClientOptions, RequestOptions, ReadOptions, WriteOptions, ExtractOptions, CreateInstanceOptions, GenerateSchemaOptions, UpdateInstanceMetadataOptions, PatchInstanceMetadataOptions, UpdateInstanceSchemaOptions, DryRunMigrationOptions, ListMigrationsOptions, GetMigrationOptions, SuggestionRequestOptions, } from "./types.js";
|
|
13
|
-
export type { ClusterInfo, InstanceInfo, InstanceSchemaInfo, ReadResult, TaggedReaderResult, RelatedTypes, RelatedTypesTouched, RelatedTypesLink, RelatedTypesObjectType, RelatedTypesRelation, WriteResult, WriteChanges, SkippedOutOfScope, FieldMergeContradiction, AsyncWriteResult, WriteStatusResult, ExtractResult, GenerateSchemaResult, ToolDescription, ToolParameterDescription, RawDescribeResult, } from "./types.js";
|
|
13
|
+
export type { ClusterInfo, InstanceInfo, InstanceSchemaInfo, ReadResult, TaggedReaderResult, RelatedTypes, RelatedTypesTouched, RelatedTypesLink, RelatedTypesObjectType, RelatedTypesRelation, WriteResult, WriteChanges, SkippedOutOfScope, FieldMergeContradiction, OrphanedRecord, AsyncWriteResult, WriteStatusResult, ExtractResult, GenerateSchemaResult, ToolDescription, ToolParameterDescription, RawDescribeResult, } from "./types.js";
|
|
14
14
|
export type { WriteMutation, ObjectMutationBody, ObjectCreatePayload, ObjectUpdatePayload, ObjectDeletePayload, RelationMutationBody, RelationCreatePayload, RelationUpdatePayload, RelationDeletePayload, RelationEndpoint, } from "./types.js";
|
|
15
15
|
export type { MigrationPlan, MigrationOp, FieldSpec, AddObject, RemoveObject, RenameObject, ChangeObject, AddField, RemoveField, RenameField, ChangeField, AddRelation, RemoveRelation, RenameRelation, ChangeRelation, DefaultValue, EnumValues, } from "./types.js";
|
|
16
16
|
export type { EnhanceSchemaResult, PlanSummary, DryRunResult, MigrationRecord, ListMigrationsResult, GetMigrationResult, ConsolidatedProposal, ProposalItem, ReviewSuggestionsResult, DecisionInput, RecordedDecision, DependencyWarning, DecideSuggestionsResult, ApplyPendingDecisionsResult, } from "./types.js";
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type ReadMode = "single-answer" | "raw-tables" | "xresponse";
|
|
|
11
11
|
/**
|
|
12
12
|
* What a read says about the schema around its answer. `"types"` adds
|
|
13
13
|
* {@link ReadResult.related_types} to the result; `"none"` (the server default)
|
|
14
|
-
* leaves it out. Asking for it needs the `instance.
|
|
14
|
+
* leaves it out. Asking for it needs the `instance.get` permission on the
|
|
15
15
|
* API key, the same one the schema endpoints need, on top of `data.read`: a key
|
|
16
16
|
* without it gets a 403 whose message names the permission, and the plain read
|
|
17
17
|
* is unaffected.
|
|
@@ -488,20 +488,64 @@ export interface FieldMergeContradiction {
|
|
|
488
488
|
*/
|
|
489
489
|
readonly kept: "stored" | "new" | (string & {});
|
|
490
490
|
}
|
|
491
|
+
/**
|
|
492
|
+
* A stored record a delete in the write left with no link of a relation it had
|
|
493
|
+
* one of: the deleted record was its last link of that relation.
|
|
494
|
+
*
|
|
495
|
+
* Deleting a record never deletes the records linked to it. Its links are
|
|
496
|
+
* removed or cleared, as the relation's `on_delete` says, and listed under
|
|
497
|
+
* `deleted.relations`; a link the same write also states may be reported under
|
|
498
|
+
* `relationship_outcomes` as well, or instead. A record left without any link
|
|
499
|
+
* of a relation is listed here, so the caller can decide whether it still
|
|
500
|
+
* belongs.
|
|
501
|
+
*/
|
|
502
|
+
export interface OrphanedRecord {
|
|
503
|
+
/** The object type of the record left without a link. */
|
|
504
|
+
readonly object_type_name: string;
|
|
505
|
+
/**
|
|
506
|
+
* The record as the write's other entries name it: by the write's own
|
|
507
|
+
* identifier when the write names it, otherwise by its primary key, rendered
|
|
508
|
+
* `field='value'` (a composite key's parts comma-separated). Empty for a type
|
|
509
|
+
* without a key, for a key missing a part, and on a folded entry.
|
|
510
|
+
*/
|
|
511
|
+
readonly identity: string;
|
|
512
|
+
/**
|
|
513
|
+
* The relation the record no longer has a link of, by its class name: an XMD
|
|
514
|
+
* relation `works_at` comes back as `WorksAt`.
|
|
515
|
+
*/
|
|
516
|
+
readonly relation: string;
|
|
517
|
+
/** On a folded entry, how many records it stands for. */
|
|
518
|
+
readonly count?: number;
|
|
519
|
+
/**
|
|
520
|
+
* `true` on an entry that stands for the records past the first 100 of one
|
|
521
|
+
* type and relation, with an empty `identity` and their `count`.
|
|
522
|
+
*/
|
|
523
|
+
readonly folded?: boolean;
|
|
524
|
+
}
|
|
491
525
|
/**
|
|
492
526
|
* What a write did, grouped into `created` / `updated` / `deleted`, plus what a
|
|
493
|
-
* `"drop"`-mode scope left out
|
|
527
|
+
* `"drop"`-mode scope left out, the contradictions a field merge resolved and
|
|
528
|
+
* the records a delete left without a link.
|
|
494
529
|
*
|
|
495
530
|
* The three groups stay `unknown`: their shape is the server's to evolve and
|
|
496
531
|
* this client has never modelled it. `skipped_out_of_scope` is typed because it
|
|
497
532
|
* is the one part a caller has to branch on — a `"drop"`-mode write succeeds
|
|
498
533
|
* whether or not it skipped anything, so this list is the only report that some
|
|
499
534
|
* of what the text said was not applied. `merge_contradictions` is typed because
|
|
500
|
-
* it is the only report of what a merge chose between
|
|
535
|
+
* it is the only report of what a merge chose between, and `orphaned_records`
|
|
536
|
+
* because it is the only report of a record a delete left without a link.
|
|
501
537
|
*/
|
|
502
538
|
export interface WriteChanges {
|
|
503
539
|
readonly created: unknown;
|
|
504
540
|
readonly updated: unknown;
|
|
541
|
+
/**
|
|
542
|
+
* What the write deleted, as `{ objects, relations }`. A record delete's
|
|
543
|
+
* links, removed or cleared as the relation's `on_delete` says, are listed
|
|
544
|
+
* under `relations`; a link the same write also states may be reported
|
|
545
|
+
* under `relationship_outcomes` as well, or instead. Past 100 links of one
|
|
546
|
+
* relation, the rest arrive as one entry with that relation's `name`, empty
|
|
547
|
+
* `endpoints` and `fields`, `folded: true` and their `count`.
|
|
548
|
+
*/
|
|
505
549
|
readonly deleted: unknown;
|
|
506
550
|
/**
|
|
507
551
|
* Omitted by the server when nothing was skipped — which is every write that
|
|
@@ -520,6 +564,18 @@ export interface WriteChanges {
|
|
|
520
564
|
* appended, or left the stored text unchanged reports none.
|
|
521
565
|
*/
|
|
522
566
|
readonly merge_contradictions?: readonly FieldMergeContradiction[];
|
|
567
|
+
/**
|
|
568
|
+
* The stored records a delete in this write left with no link of a relation
|
|
569
|
+
* they had one of. Advisory: delete or relink such a record if it no longer
|
|
570
|
+
* belongs. A record the write deleted, or that still has a link of that
|
|
571
|
+
* relation when the write completes, is not listed. Omitted by the server
|
|
572
|
+
* when there is none, and by a server that predates the report, so
|
|
573
|
+
* `undefined` and `[]` both mean "none reported" — and nothing at all when
|
|
574
|
+
* `relationship_outcomes` reports the write's summary unavailable (an entry
|
|
575
|
+
* with `status: "unavailable"`). Past 100 entries of one type and relation,
|
|
576
|
+
* the rest arrive folded into one entry (see {@link OrphanedRecord.folded}).
|
|
577
|
+
*/
|
|
578
|
+
readonly orphaned_records?: readonly OrphanedRecord[];
|
|
523
579
|
}
|
|
524
580
|
export interface WriteResult {
|
|
525
581
|
readonly write_id: string;
|
|
@@ -528,8 +584,9 @@ export interface WriteResult {
|
|
|
528
584
|
readonly console_url: string | null;
|
|
529
585
|
/**
|
|
530
586
|
* What the write did, grouped into `created` / `updated` / `deleted`; for a
|
|
531
|
-
* scoped write in `"drop"` mode, what it skipped instead of applying;
|
|
532
|
-
*
|
|
587
|
+
* scoped write in `"drop"` mode, what it skipped instead of applying; what a
|
|
588
|
+
* field merge chose between (`merge_contradictions`); and the records a delete
|
|
589
|
+
* left without a link (`orphaned_records`).
|
|
533
590
|
*/
|
|
534
591
|
readonly changes: WriteChanges;
|
|
535
592
|
}
|
|
@@ -551,8 +608,8 @@ export interface WriteStatusResult {
|
|
|
551
608
|
* What the finished write did, in the same shape {@link WriteResult.changes}
|
|
552
609
|
* carries — and the async caller's only view of it, since `writeAsync`
|
|
553
610
|
* returns before the write has done anything. It is therefore where a
|
|
554
|
-
* `"drop"`-mode scope reports what it skipped,
|
|
555
|
-
* between.
|
|
611
|
+
* `"drop"`-mode scope reports what it skipped, a field merge what it chose
|
|
612
|
+
* between, and a delete the records it left without a link.
|
|
556
613
|
*
|
|
557
614
|
* Optional because a status is not always about a finished write: a queued,
|
|
558
615
|
* in-progress, failed or unknown `write_id` carries none. Read it once
|
|
@@ -924,7 +981,7 @@ export interface ReadOptions {
|
|
|
924
981
|
* `"types"` asks for {@link ReadResult.related_types}: the object types the read
|
|
925
982
|
* touched, the fields it did not return, and the object types a declared
|
|
926
983
|
* relation links them to. Left unset, nothing is sent and the server default
|
|
927
|
-
* (`"none"`) applies. Needs `instance.
|
|
984
|
+
* (`"none"`) applies. Needs `instance.get` on the API key; see
|
|
928
985
|
* {@link RelatedTypesMode}.
|
|
929
986
|
*/
|
|
930
987
|
includeRelatedTypes?: RelatedTypesMode;
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Package version. Kept in sync with `package.json` — a test asserts they match. */
|
|
2
|
-
export declare const VERSION = "3.
|
|
2
|
+
export declare const VERSION = "3.21.1";
|
package/dist/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Package version. Kept in sync with `package.json` — a test asserts they match. */
|
|
2
|
-
export const VERSION = "3.
|
|
2
|
+
export const VERSION = "3.21.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xmemory",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.1",
|
|
4
4
|
"description": "xmemory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xmemory"
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"build:clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
41
41
|
"build:esm": "tsc -p tsconfig.esm.json && node -e \"require('fs').writeFileSync('dist/esm/package.json','{\\\"type\\\":\\\"module\\\"}')\"",
|
|
42
42
|
"build:cjs": "tsc -p tsconfig.cjs.json && node -e \"require('fs').writeFileSync('dist/cjs/package.json','{\\\"type\\\":\\\"commonjs\\\"}')\"",
|
|
43
|
-
"test": "tsc --noEmit && node --import tsx test.ts",
|
|
44
|
-
"test:types": "tsc --noEmit",
|
|
43
|
+
"test": "tsc --noEmit && tsc -p tsconfig.test.json && node --import tsx test.ts",
|
|
44
|
+
"test:types": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
45
45
|
"prepublishOnly": "npm run build"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|