@sylphx/sdk 0.30.0 → 0.31.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/data.d.ts CHANGED
@@ -262,6 +262,22 @@ export interface DeleteKvNamespaceRequest {
262
262
  /** Validate without deleting anything. */
263
263
  validateOnly?: boolean;
264
264
  }
265
+ /** The request of DeleteObject. */
266
+ export interface DeleteObjectRequest {
267
+ /** The bucket's id. */
268
+ bucketId: string;
269
+ /** The object key. */
270
+ key: string;
271
+ /** Delete only when the current version equals this one (0: any). */
272
+ expectedVersion?: string;
273
+ }
274
+ /** The response of DeleteObject. */
275
+ export interface DeleteObjectResponse {
276
+ /** Whether a current version existed and was deleted. */
277
+ deleted?: boolean;
278
+ /** The delete marker written. */
279
+ object?: ObjectRecord;
280
+ }
265
281
  /** The request of DeleteSearchIndex. */
266
282
  export interface DeleteSearchIndexRequest {
267
283
  /** The name of the search index to delete. */
@@ -273,6 +289,20 @@ export interface DeleteSearchIndexRequest {
273
289
  /** Validate without deleting anything. */
274
290
  validateOnly?: boolean;
275
291
  }
292
+ /** The request of DeleteValue. */
293
+ export interface DeleteValueRequest {
294
+ /** The namespace's id. */
295
+ namespaceId: string;
296
+ /** The key. */
297
+ key: string;
298
+ /** Delete only when the current version equals this one (0: any). */
299
+ expectedVersion?: string;
300
+ }
301
+ /** The response of DeleteValue. */
302
+ export interface DeleteValueResponse {
303
+ /** Whether the key existed. */
304
+ deleted?: boolean;
305
+ }
276
306
  /** The request of GetBucket. */
277
307
  export interface GetBucketRequest {
278
308
  /** The name of the bucket to get. */
@@ -288,11 +318,53 @@ export interface GetKvNamespaceRequest {
288
318
  /** The name of the kv namespace to get. */
289
319
  name: string;
290
320
  }
321
+ /** The request of GetObject. */
322
+ export interface GetObjectRequest {
323
+ /** The bucket's id. */
324
+ bucketId: string;
325
+ /** The object key. */
326
+ key: string;
327
+ /** Zero reads the current version; a positive value reads that version. */
328
+ version?: string;
329
+ }
330
+ /** The response of GetObject. */
331
+ export interface GetObjectResponse {
332
+ /** The object's metadata. */
333
+ object?: ObjectRecord;
334
+ /** The bytes, base64. */
335
+ body?: string;
336
+ }
291
337
  /** The request of GetSearchIndex. */
292
338
  export interface GetSearchIndexRequest {
293
339
  /** The name of the search index to get. */
294
340
  name: string;
295
341
  }
342
+ /** The request of GetValue. */
343
+ export interface GetValueRequest {
344
+ /** The namespace's id. */
345
+ namespaceId: string;
346
+ /** The key. */
347
+ key: string;
348
+ }
349
+ /** The response of GetValue. */
350
+ export interface GetValueResponse {
351
+ /** The entry. */
352
+ value?: ValueRecord;
353
+ }
354
+ /** The request of IncrementValue. */
355
+ export interface IncrementValueRequest {
356
+ /** The namespace's id. */
357
+ namespaceId: string;
358
+ /** The key. */
359
+ key: string;
360
+ /** The amount to add; unset adds 1, and zero reads the count. */
361
+ delta?: string;
362
+ }
363
+ /** The response of IncrementValue. */
364
+ export interface IncrementValueResponse {
365
+ /** The entry after the increment; `value` is the decimal text of the count. */
366
+ value?: ValueRecord;
367
+ }
296
368
  /**
297
369
  * A KvNamespace is one customer key-value store on its own Valkey: versioned
298
370
  * bytes with compare-and-set, TTL, and prefix list, plus a closed Valkey
@@ -400,6 +472,24 @@ export interface ListKvNamespacesResponse {
400
472
  /** The token of the next page; empty on the last page. */
401
473
  nextPageToken?: string;
402
474
  }
475
+ /** The request of ListObjects. */
476
+ export interface ListObjectsRequest {
477
+ /** The bucket's id. */
478
+ bucketId: string;
479
+ /** Only keys with this prefix. */
480
+ prefix?: string;
481
+ /** At most this many objects; the service caps it. */
482
+ pageSize?: number;
483
+ /** The `next_page_token` of the previous page. */
484
+ pageToken?: string;
485
+ }
486
+ /** The response of ListObjects. */
487
+ export interface ListObjectsResponse {
488
+ /** The page of objects. */
489
+ objects?: ObjectRecord[];
490
+ /** Empty on the last page. */
491
+ nextPageToken?: string;
492
+ }
403
493
  /** The request of ListSearchIndexes. */
404
494
  export interface ListSearchIndexesRequest {
405
495
  /** The parent to list in. */
@@ -420,6 +510,87 @@ export interface ListSearchIndexesResponse {
420
510
  /** The token of the next page; empty on the last page. */
421
511
  nextPageToken?: string;
422
512
  }
513
+ /** The request of ListValues. */
514
+ export interface ListValuesRequest {
515
+ /** The namespace's id. */
516
+ namespaceId: string;
517
+ /** Only keys with this prefix. */
518
+ prefix?: string;
519
+ /** At most this many entries; the service caps it. */
520
+ pageSize?: number;
521
+ /** The `next_page_token` of the previous page. */
522
+ pageToken?: string;
523
+ }
524
+ /** The response of ListValues. */
525
+ export interface ListValuesResponse {
526
+ /** The page of entries. */
527
+ values?: ValueRecord[];
528
+ /** Empty on the last page. */
529
+ nextPageToken?: string;
530
+ }
531
+ /** An object's metadata. */
532
+ export interface ObjectRecord {
533
+ /** The bucket's id in the environment, for example `uploads`. */
534
+ bucketId?: string;
535
+ /** The object key; `/` separates path segments. */
536
+ key?: string;
537
+ /** `sha256:<hex>` of the bytes. */
538
+ sha256?: string;
539
+ /** Size in bytes. */
540
+ size?: string;
541
+ /** The media type given at put. */
542
+ contentType?: string;
543
+ /** The entity tag of this version. */
544
+ etag?: string;
545
+ /** The version, increasing per key. */
546
+ version?: string;
547
+ /** When this version was written, in Unix milliseconds. */
548
+ updatedAtUnixMs?: string;
549
+ /** Whether this version is a delete marker (exact-version reads only). */
550
+ deleteMarker?: boolean;
551
+ /** `public` or `private` (the default); current version only. */
552
+ visibility?: string;
553
+ }
554
+ /** The request of PutObject. */
555
+ export interface PutObjectRequest {
556
+ /** The bucket's id. */
557
+ bucketId: string;
558
+ /** The object key. */
559
+ key: string;
560
+ /** The bytes, base64. */
561
+ body?: string;
562
+ /** The media type, for example `application/pdf`. */
563
+ contentType?: string;
564
+ /** Write only when the current version equals this one (0: any). */
565
+ expectedVersion?: string;
566
+ }
567
+ /** The response of PutObject. */
568
+ export interface PutObjectResponse {
569
+ /** The stored object. */
570
+ object?: ObjectRecord;
571
+ }
572
+ /** The request of PutValue. */
573
+ export interface PutValueRequest {
574
+ /** The namespace's id. */
575
+ namespaceId: string;
576
+ /** The key. */
577
+ key: string;
578
+ /** The bytes, base64. */
579
+ value?: string;
580
+ /** Seconds to live; unset uses the namespace default, zero never expires. */
581
+ ttlSeconds?: string;
582
+ /** Write only when the current version equals this one (0: any). */
583
+ expectedVersion?: string;
584
+ /** Write only when the key is absent (SET NX). */
585
+ nx?: boolean;
586
+ /** Write only when the key is present (SET XX); excludes `nx`. */
587
+ xx?: boolean;
588
+ }
589
+ /** The response of PutValue. */
590
+ export interface PutValueResponse {
591
+ /** The stored entry. */
592
+ value?: ValueRecord;
593
+ }
423
594
  /** The request of RestoreDatabase. */
424
595
  export interface RestoreDatabaseRequest {
425
596
  /** The name of the database. */
@@ -560,19 +731,47 @@ export interface UpdateSearchIndexRequest {
560
731
  /** Validate and return the result without writing anything. */
561
732
  validateOnly?: boolean;
562
733
  }
734
+ /** A key-value entry. */
735
+ export interface ValueRecord {
736
+ /** The namespace's id in the environment, for example `ratelimit`. */
737
+ namespaceId?: string;
738
+ /** The key. */
739
+ key?: string;
740
+ /** The bytes, base64. */
741
+ value?: string;
742
+ /** `sha256:<hex>` of the value. */
743
+ sha256?: string;
744
+ /** The version, increasing per key. */
745
+ version?: string;
746
+ /** Expiry in Unix milliseconds; zero never expires. */
747
+ expiresAtUnixMs?: string;
748
+ /** When this version was written, in Unix milliseconds. */
749
+ updatedAtUnixMs?: string;
750
+ }
563
751
  /** ConnectionProfile is which Postgres path a connection takes. */
564
752
  export type ConnectionProfile = 'pooled' | 'direct' | (string & {});
565
753
  /** DatastoreState is whether a datastore is serving. */
566
754
  export type DatastoreState = 'provisioning' | 'active' | 'idle' | 'moving' | 'deleting' | (string & {});
567
755
  /**
568
- * DataService is Sylphx Data's control plane: the four customer datastores and
569
- * how to connect to them (docs/services/data/vision.md). Each datastore is its
570
- * own silo; its engine credentials are not API keys, and every endpoint is
571
- * `{ref}[-direct].sylphx.net` served by Data Edge from the Cell Snapshot.
756
+ * DataPlaneService is the data plane of Sylphx Data: object bytes and
757
+ * key-value entries in an environment's buckets and KV namespaces. It is
758
+ * served by Data itself at its origin, not by the Resource API, and is called
759
+ * with the environment's secret key (`SYLPHX_API_KEY`); the key's org,
760
+ * project, and environment are the tenant. Every call carries a new
761
+ * `Sylphx-Effect-Id`, which the SDK sends and reuses on retries.
762
+ *
763
+ * The buckets and namespaces themselves are Resources of DataService. The
764
+ * messages here are Data's wire format
765
+ * (`services/data/proto/sylphx/data/v1/data.proto`), field for field; Data
766
+ * answers ProtoJSON (camelCase names, 64-bit integers and bytes as strings).
572
767
  *
573
768
  * Namespace of Sylphx Data on `Sylphx`.
574
769
  */
575
770
  export declare class DataApi {
771
+ /** The `objects` collection. */
772
+ readonly objects: ObjectsCollection;
773
+ /** The `kv` collection. */
774
+ readonly kv: KvCollection;
576
775
  /** The `databases` collection. */
577
776
  readonly databases: DatabasesCollection;
578
777
  /** The `kv_namespaces` collection. */
@@ -583,6 +782,90 @@ export declare class DataApi {
583
782
  readonly searchIndexes: SearchIndexesCollection;
584
783
  constructor(client: runtime.Client);
585
784
  }
785
+ /** `objects` of Sylphx Data: served at `https://api.data.sylphx.com`. */
786
+ export declare class ObjectsCollection {
787
+ private readonly client;
788
+ constructor(client: runtime.Client);
789
+ /**
790
+ * Writes an object's bytes, replacing the current version. `body` is the
791
+ * base64 of the bytes.
792
+ *
793
+ * `PUT /v1/objects/{bucket_id}/{key=**}` · permission `data:write` · effect `write`
794
+ *
795
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `RESOURCE_NOT_FOUND`, `ETAG_MISMATCH`.
796
+ */
797
+ put(request: PutObjectRequest): Promise<PutObjectResponse>;
798
+ /**
799
+ * Reads an object and its bytes (`body`, base64).
800
+ *
801
+ * `GET /v1/objects/{bucket_id}/{key=**}` · permission `data:read` · effect `read`
802
+ *
803
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
804
+ */
805
+ get(request: GetObjectRequest): Promise<GetObjectResponse>;
806
+ /**
807
+ * Lists a bucket's objects in key order.
808
+ *
809
+ * `GET /v1/objects/{bucket_id}` · permission `data:read` · effect `read`
810
+ *
811
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`.
812
+ */
813
+ list(request: ListObjectsRequest): Promise<ListObjectsResponse>;
814
+ /**
815
+ * Deletes an object's current version (history is kept).
816
+ *
817
+ * `DELETE /v1/objects/{bucket_id}/{key=**}` · permission `data:write` · effect `destructive`
818
+ *
819
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `ETAG_MISMATCH`.
820
+ */
821
+ delete(request: DeleteObjectRequest): Promise<DeleteObjectResponse>;
822
+ }
823
+ /** `kv` of Sylphx Data: served at `https://api.data.sylphx.com`. */
824
+ export declare class KvCollection {
825
+ private readonly client;
826
+ constructor(client: runtime.Client);
827
+ /**
828
+ * Writes a value. Without `ttl_seconds` the namespace default applies; zero
829
+ * means no expiry.
830
+ *
831
+ * `PUT /v1/kv/{namespace_id}/{key=**}` · permission `data:write` · effect `write`
832
+ *
833
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `RESOURCE_NOT_FOUND`, `ETAG_MISMATCH`.
834
+ */
835
+ put(request: PutValueRequest): Promise<PutValueResponse>;
836
+ /**
837
+ * Reads a value.
838
+ *
839
+ * `GET /v1/kv/{namespace_id}/{key=**}` · permission `data:read` · effect `read`
840
+ *
841
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
842
+ */
843
+ get(request: GetValueRequest): Promise<GetValueResponse>;
844
+ /**
845
+ * Lists a namespace's values in key order.
846
+ *
847
+ * `GET /v1/kv/{namespace_id}` · permission `data:read` · effect `read`
848
+ *
849
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`.
850
+ */
851
+ list(request: ListValuesRequest): Promise<ListValuesResponse>;
852
+ /**
853
+ * Deletes a value.
854
+ *
855
+ * `DELETE /v1/kv/{namespace_id}/{key=**}` · permission `data:write` · effect `destructive`
856
+ *
857
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `ETAG_MISMATCH`.
858
+ */
859
+ delete(request: DeleteValueRequest): Promise<DeleteValueResponse>;
860
+ /**
861
+ * Adds `delta` (default 1) to an integer value, creating it at zero.
862
+ *
863
+ * `POST /v1/kv-increments` · permission `data:write` · effect `write`
864
+ *
865
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `RESOURCE_NOT_FOUND`.
866
+ */
867
+ increment(request: IncrementValueRequest): Promise<IncrementValueResponse>;
868
+ }
586
869
  /** `databases` of Sylphx Data: Resource type `data.sylphx.com/Database`. */
587
870
  export declare class DatabasesCollection {
588
871
  private readonly client;
package/dist/data.js CHANGED
@@ -1,4 +1,4 @@
1
- // @generated by sylphx-gen 0.1.0 from contracts@cdf6473b36ca648759a7f4b1fc21554541d52a947477e6e9d1d7a6a9a79bdaa0. Do not edit.
1
+ // @generated by sylphx-gen 0.1.0 from contracts@446ceb843d4ff88057b0db68e2e54e4aea52d8143b72d66016122995b878de20. Do not edit.
2
2
  // `sylphx.data.v1`.
3
3
  import * as runtime from './runtime.js';
4
4
  import './common.js';
@@ -86,14 +86,44 @@ runtime.registerSchemas({
86
86
  ['allowMissing', 'allow_missing'],
87
87
  ['validateOnly', 'validate_only'],
88
88
  ],
89
+ 'sylphx.data.v1.DeleteObjectRequest': [
90
+ ['bucketId', 'bucket_id'],
91
+ ['expectedVersion', 'expected_version'],
92
+ ],
93
+ 'sylphx.data.v1.DeleteObjectResponse': [
94
+ ['object', 'object', 'sylphx.data.v1.ObjectRecord'],
95
+ ],
89
96
  'sylphx.data.v1.DeleteSearchIndexRequest': [
90
97
  ['allowMissing', 'allow_missing'],
91
98
  ['validateOnly', 'validate_only'],
92
99
  ],
100
+ 'sylphx.data.v1.DeleteValueRequest': [
101
+ ['namespaceId', 'namespace_id'],
102
+ ['expectedVersion', 'expected_version'],
103
+ ],
104
+ 'sylphx.data.v1.DeleteValueResponse': [],
93
105
  'sylphx.data.v1.GetBucketRequest': [],
94
106
  'sylphx.data.v1.GetDatabaseRequest': [],
95
107
  'sylphx.data.v1.GetKvNamespaceRequest': [],
108
+ 'sylphx.data.v1.GetObjectRequest': [
109
+ ['bucketId', 'bucket_id'],
110
+ ],
111
+ 'sylphx.data.v1.GetObjectResponse': [
112
+ ['object', 'object', 'sylphx.data.v1.ObjectRecord'],
113
+ ],
96
114
  'sylphx.data.v1.GetSearchIndexRequest': [],
115
+ 'sylphx.data.v1.GetValueRequest': [
116
+ ['namespaceId', 'namespace_id'],
117
+ ],
118
+ 'sylphx.data.v1.GetValueResponse': [
119
+ ['value', 'value', 'sylphx.data.v1.ValueRecord'],
120
+ ],
121
+ 'sylphx.data.v1.IncrementValueRequest': [
122
+ ['namespaceId', 'namespace_id'],
123
+ ],
124
+ 'sylphx.data.v1.IncrementValueResponse': [
125
+ ['value', 'value', 'sylphx.data.v1.ValueRecord'],
126
+ ],
97
127
  'sylphx.data.v1.KvNamespace': [
98
128
  ['meta', 'meta', 'sylphx.common.v1.ResourceMeta'],
99
129
  ['spec', 'spec', 'sylphx.data.v1.KvNamespaceSpec'],
@@ -135,6 +165,15 @@ runtime.registerSchemas({
135
165
  ['kvNamespaces', 'kv_namespaces', 'sylphx.data.v1.KvNamespace'],
136
166
  ['nextPageToken', 'next_page_token'],
137
167
  ],
168
+ 'sylphx.data.v1.ListObjectsRequest': [
169
+ ['bucketId', 'bucket_id'],
170
+ ['pageSize', 'page_size'],
171
+ ['pageToken', 'page_token'],
172
+ ],
173
+ 'sylphx.data.v1.ListObjectsResponse': [
174
+ ['objects', 'objects', 'sylphx.data.v1.ObjectRecord'],
175
+ ['nextPageToken', 'next_page_token'],
176
+ ],
138
177
  'sylphx.data.v1.ListSearchIndexesRequest': [
139
178
  ['pageSize', 'page_size'],
140
179
  ['pageToken', 'page_token'],
@@ -144,6 +183,37 @@ runtime.registerSchemas({
144
183
  ['searchIndexes', 'search_indexes', 'sylphx.data.v1.SearchIndex'],
145
184
  ['nextPageToken', 'next_page_token'],
146
185
  ],
186
+ 'sylphx.data.v1.ListValuesRequest': [
187
+ ['namespaceId', 'namespace_id'],
188
+ ['pageSize', 'page_size'],
189
+ ['pageToken', 'page_token'],
190
+ ],
191
+ 'sylphx.data.v1.ListValuesResponse': [
192
+ ['values', 'values', 'sylphx.data.v1.ValueRecord'],
193
+ ['nextPageToken', 'next_page_token'],
194
+ ],
195
+ 'sylphx.data.v1.ObjectRecord': [
196
+ ['bucketId', 'bucket_id'],
197
+ ['contentType', 'content_type'],
198
+ ['updatedAtUnixMs', 'updated_at_unix_ms'],
199
+ ['deleteMarker', 'delete_marker'],
200
+ ],
201
+ 'sylphx.data.v1.PutObjectRequest': [
202
+ ['bucketId', 'bucket_id'],
203
+ ['contentType', 'content_type'],
204
+ ['expectedVersion', 'expected_version'],
205
+ ],
206
+ 'sylphx.data.v1.PutObjectResponse': [
207
+ ['object', 'object', 'sylphx.data.v1.ObjectRecord'],
208
+ ],
209
+ 'sylphx.data.v1.PutValueRequest': [
210
+ ['namespaceId', 'namespace_id'],
211
+ ['ttlSeconds', 'ttl_seconds'],
212
+ ['expectedVersion', 'expected_version'],
213
+ ],
214
+ 'sylphx.data.v1.PutValueResponse': [
215
+ ['value', 'value', 'sylphx.data.v1.ValueRecord'],
216
+ ],
147
217
  'sylphx.data.v1.RestoreDatabaseRequest': [
148
218
  ['restoreTime', 'restore_time'],
149
219
  ['validateOnly', 'validate_only'],
@@ -199,16 +269,32 @@ runtime.registerSchemas({
199
269
  ['allowMissing', 'allow_missing'],
200
270
  ['validateOnly', 'validate_only'],
201
271
  ],
272
+ 'sylphx.data.v1.ValueRecord': [
273
+ ['namespaceId', 'namespace_id'],
274
+ ['expiresAtUnixMs', 'expires_at_unix_ms'],
275
+ ['updatedAtUnixMs', 'updated_at_unix_ms'],
276
+ ],
202
277
  });
203
278
  /**
204
- * DataService is Sylphx Data's control plane: the four customer datastores and
205
- * how to connect to them (docs/services/data/vision.md). Each datastore is its
206
- * own silo; its engine credentials are not API keys, and every endpoint is
207
- * `{ref}[-direct].sylphx.net` served by Data Edge from the Cell Snapshot.
279
+ * DataPlaneService is the data plane of Sylphx Data: object bytes and
280
+ * key-value entries in an environment's buckets and KV namespaces. It is
281
+ * served by Data itself at its origin, not by the Resource API, and is called
282
+ * with the environment's secret key (`SYLPHX_API_KEY`); the key's org,
283
+ * project, and environment are the tenant. Every call carries a new
284
+ * `Sylphx-Effect-Id`, which the SDK sends and reuses on retries.
285
+ *
286
+ * The buckets and namespaces themselves are Resources of DataService. The
287
+ * messages here are Data's wire format
288
+ * (`services/data/proto/sylphx/data/v1/data.proto`), field for field; Data
289
+ * answers ProtoJSON (camelCase names, 64-bit integers and bytes as strings).
208
290
  *
209
291
  * Namespace of Sylphx Data on `Sylphx`.
210
292
  */
211
293
  export class DataApi {
294
+ /** The `objects` collection. */
295
+ objects;
296
+ /** The `kv` collection. */
297
+ kv;
212
298
  /** The `databases` collection. */
213
299
  databases;
214
300
  /** The `kv_namespaces` collection. */
@@ -218,12 +304,194 @@ export class DataApi {
218
304
  /** The `search_indexes` collection. */
219
305
  searchIndexes;
220
306
  constructor(client) {
307
+ this.objects = new ObjectsCollection(client);
308
+ this.kv = new KvCollection(client);
221
309
  this.databases = new DatabasesCollection(client);
222
310
  this.kvNamespaces = new KvNamespacesCollection(client);
223
311
  this.buckets = new BucketsCollection(client);
224
312
  this.searchIndexes = new SearchIndexesCollection(client);
225
313
  }
226
314
  }
315
+ /** `objects` of Sylphx Data: served at `https://api.data.sylphx.com`. */
316
+ export class ObjectsCollection {
317
+ client;
318
+ constructor(client) {
319
+ this.client = client;
320
+ }
321
+ /**
322
+ * Writes an object's bytes, replacing the current version. `body` is the
323
+ * base64 of the bytes.
324
+ *
325
+ * `PUT /v1/objects/{bucket_id}/{key=**}` · permission `data:write` · effect `write`
326
+ *
327
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `RESOURCE_NOT_FOUND`, `ETAG_MISMATCH`.
328
+ */
329
+ async put(request) {
330
+ return this.client.call({
331
+ method: 'PUT',
332
+ path: `/v1/objects/${runtime.protocolParam(request.bucketId, false, 'bucket_id')}/${runtime.protocolParam(request.key, true, 'key')}`,
333
+ body: runtime.omit(request, ['bucketId', 'key']),
334
+ bodyType: 'sylphx.data.v1.PutObjectRequest',
335
+ responseType: 'sylphx.data.v1.PutObjectResponse',
336
+ origin: 'https://api.data.sylphx.com',
337
+ effectIds: true,
338
+ mutation: true,
339
+ });
340
+ }
341
+ /**
342
+ * Reads an object and its bytes (`body`, base64).
343
+ *
344
+ * `GET /v1/objects/{bucket_id}/{key=**}` · permission `data:read` · effect `read`
345
+ *
346
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
347
+ */
348
+ async get(request) {
349
+ return this.client.call({
350
+ method: 'GET',
351
+ path: `/v1/objects/${runtime.protocolParam(request.bucketId, false, 'bucket_id')}/${runtime.protocolParam(request.key, true, 'key')}`,
352
+ query: { version: request.version },
353
+ responseType: 'sylphx.data.v1.GetObjectResponse',
354
+ origin: 'https://api.data.sylphx.com',
355
+ effectIds: true,
356
+ mutation: false,
357
+ });
358
+ }
359
+ /**
360
+ * Lists a bucket's objects in key order.
361
+ *
362
+ * `GET /v1/objects/{bucket_id}` · permission `data:read` · effect `read`
363
+ *
364
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`.
365
+ */
366
+ async list(request) {
367
+ return this.client.call({
368
+ method: 'GET',
369
+ path: `/v1/objects/${runtime.protocolParam(request.bucketId, false, 'bucket_id')}`,
370
+ query: { prefix: request.prefix, page_size: request.pageSize, page_token: request.pageToken },
371
+ responseType: 'sylphx.data.v1.ListObjectsResponse',
372
+ origin: 'https://api.data.sylphx.com',
373
+ effectIds: true,
374
+ mutation: false,
375
+ });
376
+ }
377
+ /**
378
+ * Deletes an object's current version (history is kept).
379
+ *
380
+ * `DELETE /v1/objects/{bucket_id}/{key=**}` · permission `data:write` · effect `destructive`
381
+ *
382
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `ETAG_MISMATCH`.
383
+ */
384
+ async delete(request) {
385
+ return this.client.call({
386
+ method: 'DELETE',
387
+ path: `/v1/objects/${runtime.protocolParam(request.bucketId, false, 'bucket_id')}/${runtime.protocolParam(request.key, true, 'key')}`,
388
+ query: { expected_version: request.expectedVersion },
389
+ responseType: 'sylphx.data.v1.DeleteObjectResponse',
390
+ origin: 'https://api.data.sylphx.com',
391
+ effectIds: true,
392
+ mutation: true,
393
+ });
394
+ }
395
+ }
396
+ /** `kv` of Sylphx Data: served at `https://api.data.sylphx.com`. */
397
+ export class KvCollection {
398
+ client;
399
+ constructor(client) {
400
+ this.client = client;
401
+ }
402
+ /**
403
+ * Writes a value. Without `ttl_seconds` the namespace default applies; zero
404
+ * means no expiry.
405
+ *
406
+ * `PUT /v1/kv/{namespace_id}/{key=**}` · permission `data:write` · effect `write`
407
+ *
408
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `RESOURCE_NOT_FOUND`, `ETAG_MISMATCH`.
409
+ */
410
+ async put(request) {
411
+ return this.client.call({
412
+ method: 'PUT',
413
+ path: `/v1/kv/${runtime.protocolParam(request.namespaceId, false, 'namespace_id')}/${runtime.protocolParam(request.key, true, 'key')}`,
414
+ body: runtime.omit(request, ['key', 'namespaceId']),
415
+ bodyType: 'sylphx.data.v1.PutValueRequest',
416
+ responseType: 'sylphx.data.v1.PutValueResponse',
417
+ origin: 'https://api.data.sylphx.com',
418
+ effectIds: true,
419
+ mutation: true,
420
+ });
421
+ }
422
+ /**
423
+ * Reads a value.
424
+ *
425
+ * `GET /v1/kv/{namespace_id}/{key=**}` · permission `data:read` · effect `read`
426
+ *
427
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
428
+ */
429
+ async get(request) {
430
+ return this.client.call({
431
+ method: 'GET',
432
+ path: `/v1/kv/${runtime.protocolParam(request.namespaceId, false, 'namespace_id')}/${runtime.protocolParam(request.key, true, 'key')}`,
433
+ responseType: 'sylphx.data.v1.GetValueResponse',
434
+ origin: 'https://api.data.sylphx.com',
435
+ effectIds: true,
436
+ mutation: false,
437
+ });
438
+ }
439
+ /**
440
+ * Lists a namespace's values in key order.
441
+ *
442
+ * `GET /v1/kv/{namespace_id}` · permission `data:read` · effect `read`
443
+ *
444
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`.
445
+ */
446
+ async list(request) {
447
+ return this.client.call({
448
+ method: 'GET',
449
+ path: `/v1/kv/${runtime.protocolParam(request.namespaceId, false, 'namespace_id')}`,
450
+ query: { prefix: request.prefix, page_size: request.pageSize, page_token: request.pageToken },
451
+ responseType: 'sylphx.data.v1.ListValuesResponse',
452
+ origin: 'https://api.data.sylphx.com',
453
+ effectIds: true,
454
+ mutation: false,
455
+ });
456
+ }
457
+ /**
458
+ * Deletes a value.
459
+ *
460
+ * `DELETE /v1/kv/{namespace_id}/{key=**}` · permission `data:write` · effect `destructive`
461
+ *
462
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `ETAG_MISMATCH`.
463
+ */
464
+ async delete(request) {
465
+ return this.client.call({
466
+ method: 'DELETE',
467
+ path: `/v1/kv/${runtime.protocolParam(request.namespaceId, false, 'namespace_id')}/${runtime.protocolParam(request.key, true, 'key')}`,
468
+ query: { expected_version: request.expectedVersion },
469
+ responseType: 'sylphx.data.v1.DeleteValueResponse',
470
+ origin: 'https://api.data.sylphx.com',
471
+ effectIds: true,
472
+ mutation: true,
473
+ });
474
+ }
475
+ /**
476
+ * Adds `delta` (default 1) to an integer value, creating it at zero.
477
+ *
478
+ * `POST /v1/kv-increments` · permission `data:write` · effect `write`
479
+ *
480
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `RESOURCE_NOT_FOUND`.
481
+ */
482
+ async increment(request) {
483
+ return this.client.call({
484
+ method: 'POST',
485
+ path: `/v1/kv-increments`,
486
+ body: runtime.omit(request, []),
487
+ bodyType: 'sylphx.data.v1.IncrementValueRequest',
488
+ responseType: 'sylphx.data.v1.IncrementValueResponse',
489
+ origin: 'https://api.data.sylphx.com',
490
+ effectIds: true,
491
+ mutation: true,
492
+ });
493
+ }
494
+ }
227
495
  /** `databases` of Sylphx Data: Resource type `data.sylphx.com/Database`. */
228
496
  export class DatabasesCollection {
229
497
  client;