@base44-preview/sdk 0.8.56-pr.347.bba12e2 → 0.8.56-pr.349.170ad04

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.d.ts CHANGED
@@ -14,7 +14,7 @@ export type { AppLogsModule } from "./modules/app-logs.types.js";
14
14
  export type { AppModule, AppPublicSettings, AppPublicSettingsResponse, } from "./modules/app.types.js";
15
15
  export type { ActorsModule, ActorClient, ActorRef, Connection, ActorSubscription, ActorConnectOptions, ActorNameRegistry, ActorRegistry, } from "./modules/actors.types.js";
16
16
  export type { SsoModule, SsoAccessTokenResponse } from "./modules/sso.types.js";
17
- export type { PaymentsModule, ServiceRolePaymentsModule, PaymentsErrorCode, PaymentsRecurringFrequency, CheckoutBuyer, CheckoutFreeTrial, CheckoutItem, CheckoutItemRecurring, CheckoutPresentation, CheckoutShipping, CheckoutElement, CheckoutMount, MountableCheckout, CreateCheckoutParams, CreateCheckoutResult, CompleteCheckoutResult, EmbeddedCheckout, PayPalEmbeddedCheckout, StripeEmbeddedCheckout, MountCheckoutOptions, ListPurchasesParams, ServiceRoleListPurchasesParams, ListPurchasesResult, Purchase, PurchaseItem, PurchaseStatus, RefundParams, ShippingAddress, RefundResult, CancelSubscriptionOptions, SubscriptionResult, } from "./modules/payments.types.js";
17
+ export type { PaymentsModule, ServiceRolePaymentsModule, PaymentsErrorCode, PaymentsRecurringFrequency, CheckoutBuyer, CheckoutFreeTrial, CheckoutItem, CheckoutItemRecurring, CheckoutPresentation, CheckoutElement, CheckoutMount, MountableCheckout, CreateCheckoutParams, CreateCheckoutResult, CompleteCheckoutResult, EmbeddedCheckout, PayPalEmbeddedCheckout, StripeEmbeddedCheckout, MountCheckoutOptions, ListPurchasesParams, ServiceRoleListPurchasesParams, ListPurchasesResult, Purchase, PurchaseItem, PurchaseStatus, RefundParams, RefundResult, CancelSubscriptionOptions, SubscriptionResult, } from "./modules/payments.types.js";
18
18
  export type { BrowserModule, BrowserSession, BrowserSessionOptions, } from "./modules/browser.types.js";
19
19
  export { Actor, type Conn } from "./actor.js";
20
20
  export type { ConnectorsModule, UserConnectorsModule, ConnectorApiRequest, ConnectorApiResponse, ConnectorApiResponsePhase, } from "./modules/connectors.types.js";
@@ -702,6 +702,10 @@ export interface EntityHandler<T = any> {
702
702
  *
703
703
  * Permanently removes all records that match the provided query.
704
704
  *
705
+ * This isn't a transaction. Each record is deleted on its own, so if the call
706
+ * fails partway, the records already deleted stay deleted. Learn more about
707
+ * [concurrent updates](/developers/backend/resources/entities/entity-schemas#concurrent-updates).
708
+ *
705
709
  * @param query - Query matching {@linkcode EntityFilterQuery}. Every matching record is deleted.
706
710
  * @returns Promise resolving to the deletion result.
707
711
  *
@@ -722,6 +726,10 @@ export interface EntityHandler<T = any> {
722
726
  * Efficiently creates multiple records at once. This is faster
723
727
  * than creating them individually.
724
728
  *
729
+ * This isn't a transaction. Each record is written on its own, so if the call
730
+ * fails partway, the records already written stay written. Learn more about
731
+ * [concurrent updates](/developers/backend/resources/entities/entity-schemas#concurrent-updates).
732
+ *
725
733
  * @param data - Array of record data objects.
726
734
  * @returns Promise resolving to an array of created records.
727
735
  *
@@ -749,6 +757,15 @@ export interface EntityHandler<T = any> {
749
757
  * so you don't re-process the same entities on each iteration. For
750
758
  * example, filter by `status: 'pending'` when setting status to `'processed'`.
751
759
  *
760
+ * Each matching record is updated on its own, and the call isn't a transaction.
761
+ * To claim one record safely, so that only one of 2 users acting at the same
762
+ * time succeeds, pass that record's `id` as a plain value plus the conditions
763
+ * that must still be true, then check `updated` in the response. The conditions
764
+ * are only checked again at write time when the query names a single `id`. Any
765
+ * other query, including several IDs in `$in` or `$or`, finds the matching
766
+ * records first and then updates them. Learn more about
767
+ * [concurrent updates](/developers/backend/resources/entities/entity-schemas#concurrent-updates).
768
+ *
752
769
  * To update a single record by ID, use {@linkcode update | update()} instead. To update
753
770
  * multiple specific records with different data each, use {@linkcode bulkUpdate | bulkUpdate()}.
754
771
  *
@@ -808,6 +825,21 @@ export interface EntityHandler<T = any> {
808
825
  * hasMore = result.has_more;
809
826
  * }
810
827
  * ```
828
+ *
829
+ * @example
830
+ * ```typescript
831
+ * // Claim a record
832
+ * // Only one user can claim the task, even if several try at the same time
833
+ * const result = await base44.entities.Task.updateMany(
834
+ * { id: taskId, status: 'open' },
835
+ * { $set: { status: 'claimed', claimed_by: user.email } }
836
+ * );
837
+ * if (result.updated === 1) {
838
+ * // This user claimed the task
839
+ * } else {
840
+ * // Someone else claimed it first, or it was no longer open
841
+ * }
842
+ * ```
811
843
  */
812
844
  updateMany(query: Partial<T>, data: Record<string, Record<string, any>>): Promise<UpdateManyResult>;
813
845
  /**
@@ -919,6 +951,11 @@ export interface EntityHandler<T = any> {
919
951
  * key, the last one wins. Updates merge the given fields into the existing record, like
920
952
  * {@linkcode update | update()}.
921
953
  *
954
+ * This isn't a transaction. Each record is written on its own, so if the call
955
+ * fails partway, the records already written stay written. Concurrent calls with
956
+ * the same key can also create duplicate records. Learn more about
957
+ * [concurrent updates](/developers/backend/resources/entities/entity-schemas#concurrent-updates).
958
+ *
922
959
  * @param records - Array of record data objects. Each must carry a value, not an object or
923
960
  * array, for every field named in `options.key`, to find or create by. Other fields are
924
961
  * optional, and only the ones you include are merged into a matched record, like `update()`.
@@ -955,6 +992,10 @@ export interface EntityHandler<T = any> {
955
992
  *
956
993
  * You can update up to 500 records per request.
957
994
  *
995
+ * This isn't a transaction. Each record is written on its own, so if the call
996
+ * fails partway, the records already written stay written. Learn more about
997
+ * [concurrent updates](/developers/backend/resources/entities/entity-schemas#concurrent-updates).
998
+ *
958
999
  * To apply the same update to all records matching a query, use
959
1000
  * {@linkcode updateMany | updateMany()}. To update a single record by ID, use
960
1001
  * {@linkcode update | update()}.
@@ -58,36 +58,6 @@ export interface CheckoutBuyer {
58
58
  /** Buyer's phone number. */
59
59
  phone?: string;
60
60
  }
61
- /**
62
- * A shipping address. Returned on a purchase whether your app or the provider collected it.
63
- */
64
- export interface ShippingAddress {
65
- /** Recipient's full name, 1 to 300 characters. */
66
- name: string;
67
- /** Street address, 1 to 300 characters. */
68
- line1: string;
69
- /** Apartment, suite or building, up to 300 characters. */
70
- line2?: string | null;
71
- /** City, up to 120 characters. Some countries address by region and postal code alone. */
72
- city?: string | null;
73
- /** State, province or region, up to 300 characters. */
74
- region?: string | null;
75
- /** Postal or ZIP code, up to 60 characters. */
76
- postal_code?: string | null;
77
- /** Two-letter ISO 3166-1 country code, such as `'US'`. */
78
- country: string;
79
- }
80
- /**
81
- * Shipping for a checkout with at least one `shippable` item. Supported for PayPal one-time checkouts only.
82
- *
83
- * Compute the fee on your server, never in the browser. When the fee depends on the address, such as by distance or zone, collect the address in your app and pass it in `address`: PayPal shows it to the buyer locked, so the order ships where the fee was computed for. When the fee doesn't depend on the address, pass only `amount` and PayPal asks the buyer for the address.
84
- */
85
- export interface CheckoutShipping {
86
- /** Address your app collected. Omit it to let the provider ask the buyer. */
87
- address?: ShippingAddress;
88
- /** Shipping fee in minor units, shown to the buyer as its own shipping line. Omit it for free shipping. */
89
- amount?: number;
90
- }
91
61
  /**
92
62
  * How the buyer pays.
93
63
  *
@@ -115,8 +85,6 @@ export interface CreateCheckoutParams {
115
85
  idempotency_key?: string;
116
86
  /** How the buyer pays. Defaults to `'redirect'`. PayPal apps must pass `'embedded'`, and Wix Payments supports only `'redirect'`. */
117
87
  presentation?: CheckoutPresentation;
118
- /** Shipping address and fee. Allowed only when at least one item is `shippable`. Supported for PayPal one-time checkouts only; other providers and subscriptions reject it with `invalid_request`. */
119
- shipping?: CheckoutShipping;
120
88
  }
121
89
  /**
122
90
  * Data that Stripe Embedded Checkout needs to render.
@@ -216,10 +184,6 @@ export interface Purchase {
216
184
  metadata?: Record<string, string> | null;
217
185
  /** ID of the subscription, for recurring purchases. */
218
186
  subscription_id?: string | null;
219
- /** Where the order ships, whether your app or the provider collected the address. Always `null` unless you call with the service role. Save it on your order record. */
220
- shipping_address?: ShippingAddress | null;
221
- /** Shipping fee in minor units, when the checkout charged one. */
222
- shipping_amount?: number | null;
223
187
  /** ID of the payment to pass to [`refund()`](/developers/references/sdk/docs/interfaces/service-role-payments#refund). For a PayPal subscription it's the latest charge, returned only with the service role: read it when you start a refund and reuse it on retries. It's `null` where the provider doesn't name a payment, such as a PayPal subscription whose latest charge is already refunded. */
224
188
  payment_id?: string | null;
225
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.56-pr.347.bba12e2",
3
+ "version": "0.8.56-pr.349.170ad04",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",