@sanity/client 3.3.2 → 3.3.3-next.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.
Files changed (2) hide show
  1. package/package.json +11 -11
  2. package/sanityClient.d.ts +83 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "3.3.2",
3
+ "version": "3.3.3-next.0",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "main": "lib/sanityClient.js",
6
6
  "umd": "umd/sanityClient.min.js",
@@ -28,28 +28,28 @@
28
28
  "dependencies": {
29
29
  "@sanity/eventsource": "^4.0.0",
30
30
  "@sanity/generate-help-url": "^3.0.0",
31
- "get-it": "^6.0.1",
31
+ "get-it": "^6.1.1",
32
32
  "make-error": "^1.3.0",
33
33
  "object-assign": "^4.1.1",
34
34
  "rxjs": "^6.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@babel/cli": "^7.17.6",
38
- "@babel/core": "^7.17.7",
39
- "@babel/preset-env": "^7.11.5",
37
+ "@babel/cli": "^7.18.10",
38
+ "@babel/core": "^7.18.10",
39
+ "@babel/preset-env": "^7.18.10",
40
40
  "browserify": "^17.0.0",
41
41
  "envify": "^4.0.0",
42
- "eslint": "^8.11.0",
42
+ "eslint": "^8.21.0",
43
43
  "eslint-config-prettier": "^8.5.0",
44
- "eslint-config-sanity": "^5.1.0",
45
- "nock": "^13.2.4",
44
+ "eslint-config-sanity": "^6.0.0",
45
+ "nock": "^13.2.9",
46
46
  "nyc": "^15.1.0",
47
- "prettier": "^2.6.0",
47
+ "prettier": "^2.7.1",
48
48
  "rimraf": "^3.0.2",
49
49
  "sse-channel": "^4.0.0",
50
- "tape": "^5.5.2",
50
+ "tape": "^5.5.3",
51
51
  "terser": "^5.12.1",
52
- "uglifyify": "^5.0.1",
52
+ "uglifyify": "^5.0.0",
53
53
  "xtend": "4.0.2"
54
54
  },
55
55
  "repository": {
package/sanityClient.d.ts CHANGED
@@ -380,6 +380,48 @@ export class Patch {
380
380
  reset(): this
381
381
  }
382
382
 
383
+ export class ObservablePatch extends Patch {
384
+ /**
385
+ * Clones the patch
386
+ */
387
+ clone(): ObservablePatch
388
+
389
+ /**
390
+ * Commit the patch, returning an observable that produces the first patched document
391
+ *
392
+ * @param options Options for the mutation operation
393
+ */
394
+ commit<R = any>(options: FirstDocumentMutationOptions): Observable<SanityDocument<R>>
395
+
396
+ /**
397
+ * Commit the patch, returning an observable that produces an array of the mutated documents
398
+ *
399
+ * @param options Options for the mutation operation
400
+ */
401
+ commit<R = any>(options: AllDocumentsMutationOptions): Observable<SanityDocument<R>[]>
402
+
403
+ /**
404
+ * Commit the patch, returning an observable that produces a mutation result object
405
+ *
406
+ * @param options Options for the mutation operation
407
+ */
408
+ commit(options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>
409
+
410
+ /**
411
+ * Commit the patch, returning an observable that produces a mutation result object
412
+ *
413
+ * @param options Options for the mutation operation
414
+ */
415
+ commit(options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>
416
+
417
+ /**
418
+ * Commit the patch, returning an observable that produces the first patched document
419
+ *
420
+ * @param options Options for the mutation operation
421
+ */
422
+ commit<R = any>(options?: BaseMutationOptions): Observable<SanityDocument<R>>
423
+ }
424
+
383
425
  export class Transaction {
384
426
  constructor(operations?: Mutation[], client?: SanityClient, transactionId?: string)
385
427
  clone(): Transaction
@@ -493,6 +535,45 @@ export class Transaction {
493
535
  reset(): this
494
536
  }
495
537
 
538
+ export class ObservableTransaction extends Transaction {
539
+ clone(): ObservableTransaction
540
+
541
+ /**
542
+ * Commit the transaction, returning an observable that produces the first mutated document
543
+ *
544
+ * @param options Options for the mutation operation
545
+ */
546
+ commit<R>(options: TransactionFirstDocumentMutationOptions): Observable<SanityDocument<R>>
547
+
548
+ /**
549
+ * Commit the transaction, returning an observable that produces an array of the mutated documents
550
+ *
551
+ * @param options Options for the mutation operation
552
+ */
553
+ commit<R>(options: TransactionAllDocumentsMutationOptions): Observable<SanityDocument<R>[]>
554
+
555
+ /**
556
+ * Commit the transaction, returning an observable that produces a mutation result object
557
+ *
558
+ * @param options Options for the mutation operation
559
+ */
560
+ commit(options: TransactionFirstDocumentIdMutationOptions): Observable<SingleMutationResult>
561
+
562
+ /**
563
+ * Commit the transaction, returning an observable that produces a mutation result object
564
+ *
565
+ * @param options Options for the mutation operation
566
+ */
567
+ commit(options: TransactionAllDocumentIdsMutationOptions): Observable<MultipleMutationResult>
568
+
569
+ /**
570
+ * Commit the transaction, returning an observable that produces a mutation result object
571
+ *
572
+ * @param options Options for the mutation operation
573
+ */
574
+ commit(options?: BaseMutationOptions): Observable<MultipleMutationResult>
575
+ }
576
+
496
577
  export interface ClientConfig {
497
578
  projectId?: string
498
579
  dataset?: string
@@ -1385,14 +1466,14 @@ export class ObservableSanityClient {
1385
1466
  * @param documentId Document ID to patch
1386
1467
  * @param operations Optional object of patch operations to initialize the patch instance with
1387
1468
  */
1388
- patch(documentId: string | MutationSelection, operations?: PatchOperations): Patch
1469
+ patch(documentId: string | MutationSelection, operations?: PatchOperations): ObservablePatch
1389
1470
 
1390
1471
  /**
1391
1472
  * Create a new transaction of mutations
1392
1473
  *
1393
1474
  * @param operations Optional array of mutation operations to initialize the transaction instance with
1394
1475
  */
1395
- transaction<R = any>(operations?: Mutation<R>[]): Transaction
1476
+ transaction<R = any>(operations?: Mutation<R>[]): ObservableTransaction
1396
1477
 
1397
1478
  // "Internals", should generally not be used externally
1398
1479
  /**