@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.mjs CHANGED
@@ -624,6 +624,17 @@ var Activity = class {
624
624
  ...options
625
625
  });
626
626
  }
627
+ /**
628
+ * Export the activity feed as NDJSON
629
+ *
630
+ * 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.
631
+ */
632
+ static exportActivity(options) {
633
+ return (options.client ?? client).get({
634
+ url: "/v1/projects/{project_id}/activity/export",
635
+ ...options
636
+ });
637
+ }
627
638
  };
628
639
  var Actors = class {
629
640
  /**
@@ -2003,6 +2014,17 @@ var Documents = class {
2003
2014
  });
2004
2015
  }
2005
2016
  /**
2017
+ * Export documents as NDJSON
2018
+ *
2019
+ * 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.
2020
+ */
2021
+ static exportDocuments(options) {
2022
+ return (options.client ?? client).get({
2023
+ url: "/v1/projects/{project_id}/documents/export",
2024
+ ...options
2025
+ });
2026
+ }
2027
+ /**
2006
2028
  * Delete a document
2007
2029
  *
2008
2030
  * Deletes a document and its underlying file
@@ -2040,6 +2062,45 @@ var Documents = class {
2040
2062
  });
2041
2063
  }
2042
2064
  /**
2065
+ * List a document's relations
2066
+ *
2067
+ * 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.
2068
+ */
2069
+ static listDocumentRelations(options) {
2070
+ return (options.client ?? client).get({
2071
+ url: "/v1/projects/{project_id}/documents/{document_id}/relations",
2072
+ ...options
2073
+ });
2074
+ }
2075
+ /**
2076
+ * Assert a relation
2077
+ *
2078
+ * 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.
2079
+ *
2080
+ * 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.
2081
+ */
2082
+ static createDocumentRelation(options) {
2083
+ return (options.client ?? client).post({
2084
+ url: "/v1/projects/{project_id}/documents/{document_id}/relations",
2085
+ ...options,
2086
+ headers: {
2087
+ "Content-Type": "application/json",
2088
+ ...options.headers
2089
+ }
2090
+ });
2091
+ }
2092
+ /**
2093
+ * Retract a relation
2094
+ *
2095
+ * 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.
2096
+ */
2097
+ static deleteDocumentRelation(options) {
2098
+ return (options.client ?? client).delete({
2099
+ url: "/v1/projects/{project_id}/documents/{document_id}/relations/{relation_id}",
2100
+ ...options
2101
+ });
2102
+ }
2103
+ /**
2043
2104
  * Get document ingestion status
2044
2105
  *
2045
2106
  * Returns a lightweight ingestion status payload for polling — `status`,
@@ -2057,6 +2118,70 @@ var Documents = class {
2057
2118
  });
2058
2119
  }
2059
2120
  /**
2121
+ * Withdraw a document
2122
+ *
2123
+ * 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.
2124
+ *
2125
+ * 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.
2126
+ *
2127
+ * `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.
2128
+ *
2129
+ */
2130
+ static withdrawDocument(options) {
2131
+ return (options.client ?? client).post({
2132
+ url: "/v1/projects/{project_id}/documents/{document_id}/withdraw",
2133
+ ...options,
2134
+ headers: {
2135
+ "Content-Type": "application/json",
2136
+ ...options.headers
2137
+ }
2138
+ });
2139
+ }
2140
+ /**
2141
+ * List a document's content versions
2142
+ *
2143
+ * 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.
2144
+ *
2145
+ */
2146
+ static listDocumentVersions(options) {
2147
+ return (options.client ?? client).get({
2148
+ url: "/v1/projects/{project_id}/documents/{document_id}/versions",
2149
+ ...options
2150
+ });
2151
+ }
2152
+ /**
2153
+ * Fetch an archived document version
2154
+ *
2155
+ * 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.
2156
+ *
2157
+ */
2158
+ static getDocumentVersion(options) {
2159
+ return (options.client ?? client).get({
2160
+ url: "/v1/projects/{project_id}/documents/{document_id}/versions/{version}",
2161
+ ...options
2162
+ });
2163
+ }
2164
+ /**
2165
+ * Restore an archived document version
2166
+ *
2167
+ * 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.
2168
+ *
2169
+ * 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.
2170
+ *
2171
+ * A tombstone version has no content, so naming one is `400 VALIDATION_FAILED`: restore the version before it instead.
2172
+ *
2173
+ */
2174
+ static restoreDocumentVersion(options) {
2175
+ return (options.client ?? client).post({
2176
+ url: "/v1/projects/{project_id}/documents/{document_id}/versions/{version}/restore",
2177
+ ...options,
2178
+ headers: {
2179
+ "Content-Type": "application/json",
2180
+ ...options.headers
2181
+ }
2182
+ });
2183
+ }
2184
+ /**
2060
2185
  * Re-ingest an existing document
2061
2186
  *
2062
2187
  * Re-runs ingestion for an existing document against its already-stored
@@ -3101,6 +3226,26 @@ var Memories = class {
3101
3226
  });
3102
3227
  }
3103
3228
  /**
3229
+ * Retract a memory
3230
+ *
3231
+ * 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.
3232
+ *
3233
+ * 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.
3234
+ *
3235
+ * The memory stays readable by id, with its text and its assertions. `DELETE` remains the way to remove it outright.
3236
+ *
3237
+ */
3238
+ static retractMemory(options) {
3239
+ return (options.client ?? client).post({
3240
+ url: "/v1/projects/{project_id}/memories/{memory_id}/retract",
3241
+ ...options,
3242
+ headers: {
3243
+ "Content-Type": "application/json",
3244
+ ...options.headers
3245
+ }
3246
+ });
3247
+ }
3248
+ /**
3104
3249
  * List a memory's assertions
3105
3250
  *
3106
3251
  * 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.
@@ -3294,6 +3439,17 @@ var MemoryStores = class {
3294
3439
  });
3295
3440
  }
3296
3441
  /**
3442
+ * Export a memory store's memories as NDJSON
3443
+ *
3444
+ * 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.
3445
+ */
3446
+ static exportMemories(options) {
3447
+ return (options.client ?? client).get({
3448
+ url: "/v1/projects/{project_id}/memory-stores/{memory_store_id}/export",
3449
+ ...options
3450
+ });
3451
+ }
3452
+ /**
3297
3453
  * Get memory store tags
3298
3454
  *
3299
3455
  * Returns all tags attached to the memory store
@@ -3335,6 +3491,92 @@ var MemoryStores = class {
3335
3491
  });
3336
3492
  }
3337
3493
  };
3494
+ var MetadataSchemas = class {
3495
+ /**
3496
+ * List metadata schemas
3497
+ *
3498
+ * Returns the declarations in scope, oldest first. `resource_type` narrows them to one governed resource.
3499
+ */
3500
+ static listMetadataSchemas(options) {
3501
+ return (options.client ?? client).get({
3502
+ url: "/v1/projects/{project_id}/metadata-schemas",
3503
+ ...options
3504
+ });
3505
+ }
3506
+ /**
3507
+ * Declare a metadata schema
3508
+ *
3509
+ * 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`.
3510
+ *
3511
+ * 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.
3512
+ *
3513
+ */
3514
+ static createMetadataSchema(options) {
3515
+ return (options.client ?? client).post({
3516
+ url: "/v1/projects/{project_id}/metadata-schemas",
3517
+ ...options,
3518
+ headers: {
3519
+ "Content-Type": "application/json",
3520
+ ...options.headers
3521
+ }
3522
+ });
3523
+ }
3524
+ /**
3525
+ * Check metadata against what is declared
3526
+ *
3527
+ * 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.
3528
+ *
3529
+ * 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.
3530
+ *
3531
+ */
3532
+ static validateMetadata(options) {
3533
+ return (options.client ?? client).post({
3534
+ url: "/v1/projects/{project_id}/metadata-schemas/validate",
3535
+ ...options,
3536
+ headers: {
3537
+ "Content-Type": "application/json",
3538
+ ...options.headers
3539
+ }
3540
+ });
3541
+ }
3542
+ /**
3543
+ * Delete a metadata schema
3544
+ *
3545
+ * Removes the declaration. Documents already stored keep the metadata they hold — the rule governed writes, not rows.
3546
+ */
3547
+ static deleteMetadataSchema(options) {
3548
+ return (options.client ?? client).delete({
3549
+ url: "/v1/projects/{project_id}/metadata-schemas/{metadata_schema_id}",
3550
+ ...options
3551
+ });
3552
+ }
3553
+ /**
3554
+ * Get a metadata schema
3555
+ *
3556
+ * Returns one declaration by id.
3557
+ */
3558
+ static getMetadataSchema(options) {
3559
+ return (options.client ?? client).get({
3560
+ url: "/v1/projects/{project_id}/metadata-schemas/{metadata_schema_id}",
3561
+ ...options
3562
+ });
3563
+ }
3564
+ /**
3565
+ * Update a metadata schema
3566
+ *
3567
+ * 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.
3568
+ */
3569
+ static updateMetadataSchema(options) {
3570
+ return (options.client ?? client).patch({
3571
+ url: "/v1/projects/{project_id}/metadata-schemas/{metadata_schema_id}",
3572
+ ...options,
3573
+ headers: {
3574
+ "Content-Type": "application/json",
3575
+ ...options.headers
3576
+ }
3577
+ });
3578
+ }
3579
+ };
3338
3580
  var ModelRoutes = class {
3339
3581
  /**
3340
3582
  * List model routes
@@ -4972,6 +5214,7 @@ var NaturaliClient = class {
4972
5214
  memories;
4973
5215
  memoryRules;
4974
5216
  memoryStores;
5217
+ metadataSchemas;
4975
5218
  modelRoutes;
4976
5219
  quotas;
4977
5220
  models;
@@ -5023,6 +5266,7 @@ var NaturaliClient = class {
5023
5266
  this.memories = bindResource(Memories, this.http);
5024
5267
  this.memoryRules = bindResource(MemoryRules, this.http);
5025
5268
  this.memoryStores = bindResource(MemoryStores, this.http);
5269
+ this.metadataSchemas = bindResource(MetadataSchemas, this.http);
5026
5270
  this.modelRoutes = bindResource(ModelRoutes, this.http);
5027
5271
  this.quotas = bindResource(Quotas, this.http);
5028
5272
  this.models = bindResource(Models, this.http);
@@ -5040,4 +5284,4 @@ var NaturaliClient = class {
5040
5284
  }
5041
5285
  };
5042
5286
  //#endregion
5043
- export { Activity, Actors, Admin, AgentVersions, Agents, AiProviders, ApiKeys, Approvals, Assistant, AuditLog, Auth, Chains, Channels, Conversations, Documents, Embeddings, Evaluations, Exceptions, Files, Formations, Generations, Guardrails, IngestionRules, Knowledge, Memories, MemoryRules, MemoryStores, ModelRoutes, Models, NaturaliClient, Orchestrations, Projects, Quotas, Secrets, Sessions, Tasks, Tools, Traces, Triggers, Users, Webhooks, Workflows, createClient, createConfig };
5287
+ export { Activity, Actors, Admin, AgentVersions, Agents, AiProviders, ApiKeys, Approvals, Assistant, AuditLog, Auth, Chains, Channels, Conversations, Documents, Embeddings, Evaluations, Exceptions, Files, Formations, Generations, Guardrails, IngestionRules, Knowledge, Memories, MemoryRules, MemoryStores, MetadataSchemas, ModelRoutes, Models, NaturaliClient, Orchestrations, Projects, Quotas, Secrets, Sessions, Tasks, Tools, Traces, Triggers, Users, Webhooks, Workflows, createClient, createConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.136.0",
3
+ "version": "0.137.0",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@hey-api/openapi-ts": "^0.99.0",
34
- "@naturali/api": "0.136.0",
34
+ "@naturali/api": "0.137.0",
35
35
  "@ttoss/openapi-codegen": "^0.3.1",
36
36
  "@types/node": "^26.5.1",
37
37
  "tsdown": "^0.23.0",