@naturali/sdk 0.136.0 → 0.137.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/dist/index.cjs +245 -0
- package/dist/index.d.cts +1614 -543
- package/dist/index.d.mts +1614 -543
- package/dist/index.mjs +245 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -625,6 +625,17 @@ var Activity = class {
|
|
|
625
625
|
...options
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
|
+
/**
|
|
629
|
+
* Export the activity feed as NDJSON
|
|
630
|
+
*
|
|
631
|
+
* Streams a project's activity entries as newline-delimited JSON — one entry object per line, **oldest first**, where the feed itself reads newest first: a feed answers what just happened, and a file is read start to end. `project_id` is required: the export is per-project by design. Filters behave exactly as they do on the list endpoint.
|
|
632
|
+
*/
|
|
633
|
+
static exportActivity(options) {
|
|
634
|
+
return (options.client ?? client).get({
|
|
635
|
+
url: "/v1/projects/{project_id}/activity/export",
|
|
636
|
+
...options
|
|
637
|
+
});
|
|
638
|
+
}
|
|
628
639
|
};
|
|
629
640
|
var Actors = class {
|
|
630
641
|
/**
|
|
@@ -2004,6 +2015,17 @@ var Documents = class {
|
|
|
2004
2015
|
});
|
|
2005
2016
|
}
|
|
2006
2017
|
/**
|
|
2018
|
+
* Export documents as NDJSON
|
|
2019
|
+
*
|
|
2020
|
+
* Streams a project's documents as newline-delimited JSON — one document object per line, oldest first — for archiving the corpus or shipping it into another system. `project_id` is required: the export is per-project by design. The rows are the rows the listing returns for the same caller, so a policy that hides a document hides it here too, and withdrawn documents and the reserved `/.system/` root are left out.
|
|
2021
|
+
*/
|
|
2022
|
+
static exportDocuments(options) {
|
|
2023
|
+
return (options.client ?? client).get({
|
|
2024
|
+
url: "/v1/projects/{project_id}/documents/export",
|
|
2025
|
+
...options
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
/**
|
|
2007
2029
|
* Delete a document
|
|
2008
2030
|
*
|
|
2009
2031
|
* Deletes a document and its underlying file
|
|
@@ -2041,6 +2063,45 @@ var Documents = class {
|
|
|
2041
2063
|
});
|
|
2042
2064
|
}
|
|
2043
2065
|
/**
|
|
2066
|
+
* List a document's relations
|
|
2067
|
+
*
|
|
2068
|
+
* Returns the typed edges this document asserts about others, oldest first. An edge is owned by the document it leaves, so this is what the document claims — use `?related_to=` on the listing to find what claims something about it.
|
|
2069
|
+
*/
|
|
2070
|
+
static listDocumentRelations(options) {
|
|
2071
|
+
return (options.client ?? client).get({
|
|
2072
|
+
url: "/v1/projects/{project_id}/documents/{document_id}/relations",
|
|
2073
|
+
...options
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
/**
|
|
2077
|
+
* Assert a relation
|
|
2078
|
+
*
|
|
2079
|
+
* Asserts a typed edge from this document to another in the same project. Asserting the same edge twice is `409`: an edge is a fact, and the second assertion is the same fact.
|
|
2080
|
+
*
|
|
2081
|
+
* Writing an edge is a write of the asserting document (`documents:UpdateDocument`); the document it points at is unchanged, which is what lets an agent record what its own report derives from without being able to make another report claim anything.
|
|
2082
|
+
*/
|
|
2083
|
+
static createDocumentRelation(options) {
|
|
2084
|
+
return (options.client ?? client).post({
|
|
2085
|
+
url: "/v1/projects/{project_id}/documents/{document_id}/relations",
|
|
2086
|
+
...options,
|
|
2087
|
+
headers: {
|
|
2088
|
+
"Content-Type": "application/json",
|
|
2089
|
+
...options.headers
|
|
2090
|
+
}
|
|
2091
|
+
});
|
|
2092
|
+
}
|
|
2093
|
+
/**
|
|
2094
|
+
* Retract a relation
|
|
2095
|
+
*
|
|
2096
|
+
* Removes an edge this document asserts. Both documents are left as they are — retracting a claim is not a change to what it was about.
|
|
2097
|
+
*/
|
|
2098
|
+
static deleteDocumentRelation(options) {
|
|
2099
|
+
return (options.client ?? client).delete({
|
|
2100
|
+
url: "/v1/projects/{project_id}/documents/{document_id}/relations/{relation_id}",
|
|
2101
|
+
...options
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
/**
|
|
2044
2105
|
* Get document ingestion status
|
|
2045
2106
|
*
|
|
2046
2107
|
* Returns a lightweight ingestion status payload for polling — `status`,
|
|
@@ -2058,6 +2119,70 @@ var Documents = class {
|
|
|
2058
2119
|
});
|
|
2059
2120
|
}
|
|
2060
2121
|
/**
|
|
2122
|
+
* Withdraw a document
|
|
2123
|
+
*
|
|
2124
|
+
* Takes a document out of every default read while keeping its history. The withdrawal is archived as a **tombstone version**, so one mechanism answers what a document holds now and there is no second lifecycle flag for a reader to miss.
|
|
2125
|
+
*
|
|
2126
|
+
* Its chunks are dropped from the knowledge index, so a withdrawn document costs a live search nothing. The content is not lost with them: it is in the version before the tombstone, which [`POST /v1/projects/{project_id}/documents/{document_id}/versions/{version}/restore`](/docs/api/documents/restore-document-version) re-chunks from.
|
|
2127
|
+
*
|
|
2128
|
+
* `DELETE` stays what it is — permanent, and it removes the backing file. Withdrawal is the reversible act. It does not apply under `/.system/`: a platform-written document keeps the owning module's lifecycle.
|
|
2129
|
+
*
|
|
2130
|
+
*/
|
|
2131
|
+
static withdrawDocument(options) {
|
|
2132
|
+
return (options.client ?? client).post({
|
|
2133
|
+
url: "/v1/projects/{project_id}/documents/{document_id}/withdraw",
|
|
2134
|
+
...options,
|
|
2135
|
+
headers: {
|
|
2136
|
+
"Content-Type": "application/json",
|
|
2137
|
+
...options.headers
|
|
2138
|
+
}
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
/**
|
|
2142
|
+
* List a document's content versions
|
|
2143
|
+
*
|
|
2144
|
+
* Returns the document's archived states, newest first. A version is written on create and on every subsequent write that changes the content or its annotations, and a withdrawal is archived as a version carrying no content.
|
|
2145
|
+
*
|
|
2146
|
+
*/
|
|
2147
|
+
static listDocumentVersions(options) {
|
|
2148
|
+
return (options.client ?? client).get({
|
|
2149
|
+
url: "/v1/projects/{project_id}/documents/{document_id}/versions",
|
|
2150
|
+
...options
|
|
2151
|
+
});
|
|
2152
|
+
}
|
|
2153
|
+
/**
|
|
2154
|
+
* Fetch an archived document version
|
|
2155
|
+
*
|
|
2156
|
+
* Returns the exact content and annotations the document held at a given version, which is what lets a run that cited a version read what it read.
|
|
2157
|
+
*
|
|
2158
|
+
*/
|
|
2159
|
+
static getDocumentVersion(options) {
|
|
2160
|
+
return (options.client ?? client).get({
|
|
2161
|
+
url: "/v1/projects/{project_id}/documents/{document_id}/versions/{version}",
|
|
2162
|
+
...options
|
|
2163
|
+
});
|
|
2164
|
+
}
|
|
2165
|
+
/**
|
|
2166
|
+
* Restore an archived document version
|
|
2167
|
+
*
|
|
2168
|
+
* Writes an archived version's content and annotations back as the document's live state, which archives them again as a **new** version rather than rewinding the counter — so a run citing any version in between still resolves.
|
|
2169
|
+
*
|
|
2170
|
+
* The restore runs through the ordinary update path, so the content is re-chunked and re-embedded; restoring the state the document already holds is a no-op and archives nothing. Restoring any content version of a withdrawn document brings it back into listings and search.
|
|
2171
|
+
*
|
|
2172
|
+
* A tombstone version has no content, so naming one is `400 VALIDATION_FAILED`: restore the version before it instead.
|
|
2173
|
+
*
|
|
2174
|
+
*/
|
|
2175
|
+
static restoreDocumentVersion(options) {
|
|
2176
|
+
return (options.client ?? client).post({
|
|
2177
|
+
url: "/v1/projects/{project_id}/documents/{document_id}/versions/{version}/restore",
|
|
2178
|
+
...options,
|
|
2179
|
+
headers: {
|
|
2180
|
+
"Content-Type": "application/json",
|
|
2181
|
+
...options.headers
|
|
2182
|
+
}
|
|
2183
|
+
});
|
|
2184
|
+
}
|
|
2185
|
+
/**
|
|
2061
2186
|
* Re-ingest an existing document
|
|
2062
2187
|
*
|
|
2063
2188
|
* Re-runs ingestion for an existing document against its already-stored
|
|
@@ -3102,6 +3227,26 @@ var Memories = class {
|
|
|
3102
3227
|
});
|
|
3103
3228
|
}
|
|
3104
3229
|
/**
|
|
3230
|
+
* Retract a memory
|
|
3231
|
+
*
|
|
3232
|
+
* Retires a fact that stopped holding with nothing replacing it. The memory leaves the default listing, [knowledge search](/docs/api/knowledge/search-knowledge) and write deduplication, so restating the fact later lands as a new memory.
|
|
3233
|
+
*
|
|
3234
|
+
* It is an invalidation with no successor, which is what tells it apart from a supersede: `invalidated_at` is set and `superseded_by_memory_id` stays null. The retraction is appended to the assertion ledger with outcome `retracted`, so who withdrew the fact is part of the record.
|
|
3235
|
+
*
|
|
3236
|
+
* The memory stays readable by id, with its text and its assertions. `DELETE` remains the way to remove it outright.
|
|
3237
|
+
*
|
|
3238
|
+
*/
|
|
3239
|
+
static retractMemory(options) {
|
|
3240
|
+
return (options.client ?? client).post({
|
|
3241
|
+
url: "/v1/projects/{project_id}/memories/{memory_id}/retract",
|
|
3242
|
+
...options,
|
|
3243
|
+
headers: {
|
|
3244
|
+
"Content-Type": "application/json",
|
|
3245
|
+
...options.headers
|
|
3246
|
+
}
|
|
3247
|
+
});
|
|
3248
|
+
}
|
|
3249
|
+
/**
|
|
3105
3250
|
* List a memory's assertions
|
|
3106
3251
|
*
|
|
3107
3252
|
* Returns every write that resolved into this memory, oldest first: the one that created it, the duplicates it absorbed, and the assertion that superseded another memory in its favour. A superseded memory keeps its own assertions, so the chain can be walked in both directions.
|
|
@@ -3295,6 +3440,17 @@ var MemoryStores = class {
|
|
|
3295
3440
|
});
|
|
3296
3441
|
}
|
|
3297
3442
|
/**
|
|
3443
|
+
* Export a memory store's memories as NDJSON
|
|
3444
|
+
*
|
|
3445
|
+
* Streams one store's memories as newline-delimited JSON — one memory object per line, oldest first. Invalidated memories (retracted or superseded) are left out unless `include_invalidated` asks for them, so the file holds what the store currently asserts. The rows are the rows the listing returns for the same caller.
|
|
3446
|
+
*/
|
|
3447
|
+
static exportMemories(options) {
|
|
3448
|
+
return (options.client ?? client).get({
|
|
3449
|
+
url: "/v1/projects/{project_id}/memory-stores/{memory_store_id}/export",
|
|
3450
|
+
...options
|
|
3451
|
+
});
|
|
3452
|
+
}
|
|
3453
|
+
/**
|
|
3298
3454
|
* Get memory store tags
|
|
3299
3455
|
*
|
|
3300
3456
|
* Returns all tags attached to the memory store
|
|
@@ -3336,6 +3492,92 @@ var MemoryStores = class {
|
|
|
3336
3492
|
});
|
|
3337
3493
|
}
|
|
3338
3494
|
};
|
|
3495
|
+
var MetadataSchemas = class {
|
|
3496
|
+
/**
|
|
3497
|
+
* List metadata schemas
|
|
3498
|
+
*
|
|
3499
|
+
* Returns the declarations in scope, oldest first. `resource_type` narrows them to one governed resource.
|
|
3500
|
+
*/
|
|
3501
|
+
static listMetadataSchemas(options) {
|
|
3502
|
+
return (options.client ?? client).get({
|
|
3503
|
+
url: "/v1/projects/{project_id}/metadata-schemas",
|
|
3504
|
+
...options
|
|
3505
|
+
});
|
|
3506
|
+
}
|
|
3507
|
+
/**
|
|
3508
|
+
* Declare a metadata schema
|
|
3509
|
+
*
|
|
3510
|
+
* Declares what `metadata` must satisfy for one resource type under one selector. A document is selected by `path_prefix`, matched on a path boundary: `/reports` covers `/reports/q1.txt` and never `/reports-archive/q1.txt`.
|
|
3511
|
+
*
|
|
3512
|
+
* The schema is compiled here, so one JSON Schema cannot parse is refused rather than stored — a stored one would be a rule that silently governs nothing. One selector has one schema per resource type; a second declaration of the same one is `409 NAME_CONFLICT`. The reserved root `/.system` cannot be governed: a platform-written document carries no caller metadata.
|
|
3513
|
+
*
|
|
3514
|
+
*/
|
|
3515
|
+
static createMetadataSchema(options) {
|
|
3516
|
+
return (options.client ?? client).post({
|
|
3517
|
+
url: "/v1/projects/{project_id}/metadata-schemas",
|
|
3518
|
+
...options,
|
|
3519
|
+
headers: {
|
|
3520
|
+
"Content-Type": "application/json",
|
|
3521
|
+
...options.headers
|
|
3522
|
+
}
|
|
3523
|
+
});
|
|
3524
|
+
}
|
|
3525
|
+
/**
|
|
3526
|
+
* Check metadata against what is declared
|
|
3527
|
+
*
|
|
3528
|
+
* Answers what a write would be told, without writing: a caller preparing a batch learns which declaration would refuse it, and why, before it sends anything.
|
|
3529
|
+
*
|
|
3530
|
+
* It reports; it does not enforce. The refusal itself lives in each resource's own write path, because a check a writer has to call is advisory and the writer who skips it is the one the rule exists for.
|
|
3531
|
+
*
|
|
3532
|
+
*/
|
|
3533
|
+
static validateMetadata(options) {
|
|
3534
|
+
return (options.client ?? client).post({
|
|
3535
|
+
url: "/v1/projects/{project_id}/metadata-schemas/validate",
|
|
3536
|
+
...options,
|
|
3537
|
+
headers: {
|
|
3538
|
+
"Content-Type": "application/json",
|
|
3539
|
+
...options.headers
|
|
3540
|
+
}
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
/**
|
|
3544
|
+
* Delete a metadata schema
|
|
3545
|
+
*
|
|
3546
|
+
* Removes the declaration. Documents already stored keep the metadata they hold — the rule governed writes, not rows.
|
|
3547
|
+
*/
|
|
3548
|
+
static deleteMetadataSchema(options) {
|
|
3549
|
+
return (options.client ?? client).delete({
|
|
3550
|
+
url: "/v1/projects/{project_id}/metadata-schemas/{metadata_schema_id}",
|
|
3551
|
+
...options
|
|
3552
|
+
});
|
|
3553
|
+
}
|
|
3554
|
+
/**
|
|
3555
|
+
* Get a metadata schema
|
|
3556
|
+
*
|
|
3557
|
+
* Returns one declaration by id.
|
|
3558
|
+
*/
|
|
3559
|
+
static getMetadataSchema(options) {
|
|
3560
|
+
return (options.client ?? client).get({
|
|
3561
|
+
url: "/v1/projects/{project_id}/metadata-schemas/{metadata_schema_id}",
|
|
3562
|
+
...options
|
|
3563
|
+
});
|
|
3564
|
+
}
|
|
3565
|
+
/**
|
|
3566
|
+
* Update a metadata schema
|
|
3567
|
+
*
|
|
3568
|
+
* Changes the schema, the selector, or both. `resource_type` is fixed at creation: it decides the selector's spelling and which write path reads the row, so changing it would silently repoint the declaration at a different door — delete it and declare again instead.
|
|
3569
|
+
*/
|
|
3570
|
+
static updateMetadataSchema(options) {
|
|
3571
|
+
return (options.client ?? client).patch({
|
|
3572
|
+
url: "/v1/projects/{project_id}/metadata-schemas/{metadata_schema_id}",
|
|
3573
|
+
...options,
|
|
3574
|
+
headers: {
|
|
3575
|
+
"Content-Type": "application/json",
|
|
3576
|
+
...options.headers
|
|
3577
|
+
}
|
|
3578
|
+
});
|
|
3579
|
+
}
|
|
3580
|
+
};
|
|
3339
3581
|
var ModelRoutes = class {
|
|
3340
3582
|
/**
|
|
3341
3583
|
* List model routes
|
|
@@ -4973,6 +5215,7 @@ var NaturaliClient = class {
|
|
|
4973
5215
|
memories;
|
|
4974
5216
|
memoryRules;
|
|
4975
5217
|
memoryStores;
|
|
5218
|
+
metadataSchemas;
|
|
4976
5219
|
modelRoutes;
|
|
4977
5220
|
quotas;
|
|
4978
5221
|
models;
|
|
@@ -5024,6 +5267,7 @@ var NaturaliClient = class {
|
|
|
5024
5267
|
this.memories = bindResource(Memories, this.http);
|
|
5025
5268
|
this.memoryRules = bindResource(MemoryRules, this.http);
|
|
5026
5269
|
this.memoryStores = bindResource(MemoryStores, this.http);
|
|
5270
|
+
this.metadataSchemas = bindResource(MetadataSchemas, this.http);
|
|
5027
5271
|
this.modelRoutes = bindResource(ModelRoutes, this.http);
|
|
5028
5272
|
this.quotas = bindResource(Quotas, this.http);
|
|
5029
5273
|
this.models = bindResource(Models, this.http);
|
|
@@ -5068,6 +5312,7 @@ exports.Knowledge = Knowledge;
|
|
|
5068
5312
|
exports.Memories = Memories;
|
|
5069
5313
|
exports.MemoryRules = MemoryRules;
|
|
5070
5314
|
exports.MemoryStores = MemoryStores;
|
|
5315
|
+
exports.MetadataSchemas = MetadataSchemas;
|
|
5071
5316
|
exports.ModelRoutes = ModelRoutes;
|
|
5072
5317
|
exports.Models = Models;
|
|
5073
5318
|
exports.NaturaliClient = NaturaliClient;
|