@base44-preview/sdk 0.8.56-pr.353.656b952 → 0.8.57-pr.354.985807e
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/client.types.d.ts
CHANGED
|
@@ -18,10 +18,12 @@ import type { FetchWithAuthInit } from "./utils/fetch-with-auth.js";
|
|
|
18
18
|
*/
|
|
19
19
|
export interface CreateClientOptions {
|
|
20
20
|
/**
|
|
21
|
-
* Optional error handler that
|
|
21
|
+
* Optional error handler that the SDK calls when:
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* - An API request fails.
|
|
24
|
+
* - A client can't connect to an {@link ActorsModule | actor}.
|
|
25
|
+
*
|
|
26
|
+
* Errors are usually {@linkcode Base44Error} instances. Check `error.status` for the HTTP status code. Returns `undefined` for network errors.
|
|
25
27
|
*/
|
|
26
28
|
onError?: (error: Error) => void;
|
|
27
29
|
/**
|
|
@@ -128,7 +130,7 @@ export interface Base44Client {
|
|
|
128
130
|
appLogs: AppLogsModule;
|
|
129
131
|
/** {@link AppModule | App module} for reading the app's own public configuration. */
|
|
130
132
|
app: AppModule;
|
|
131
|
-
/** {@link ActorsModule | Actors module} for
|
|
133
|
+
/** {@link ActorsModule | Actors module} for connecting to actor sessions and exchanging messages with actors. */
|
|
132
134
|
actors: ActorsModule;
|
|
133
135
|
/** {@link AuthModule | Auth module} for user authentication and management. */
|
|
134
136
|
auth: AuthModule;
|
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, 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";
|
|
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";
|
|
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";
|
|
@@ -50,7 +50,7 @@ export interface RegisterParams {
|
|
|
50
50
|
email: string;
|
|
51
51
|
/** User's password. */
|
|
52
52
|
password: string;
|
|
53
|
-
/**
|
|
53
|
+
/** Has no effect. Base44 doesn't verify Turnstile tokens for app users. */
|
|
54
54
|
turnstile_token?: string | null;
|
|
55
55
|
/** Optional {@link https://docs.base44.com/Getting-Started/Referral-program | referral code} from an existing user. */
|
|
56
56
|
referral_code?: string | null;
|
|
@@ -137,6 +137,11 @@ export interface AuthModule {
|
|
|
137
137
|
* You can update any [custom fields](/developers/backend/resources/entities/user-schema#custom-fields)
|
|
138
138
|
* defined in your User entity schema.
|
|
139
139
|
*
|
|
140
|
+
* [Field-level security](/developers/backend/resources/entities/security#field-level-security-fls)
|
|
141
|
+
* `write` rules on custom User fields also apply to this method. If `data` includes a field
|
|
142
|
+
* the user isn't allowed to write, the call throws a permission error and no fields are
|
|
143
|
+
* updated.
|
|
144
|
+
*
|
|
140
145
|
* Updating `role` requires editor access on the app.
|
|
141
146
|
*
|
|
142
147
|
* <Note>
|
|
@@ -274,7 +279,7 @@ export interface AuthModule {
|
|
|
274
279
|
*
|
|
275
280
|
* @param email - User's email address.
|
|
276
281
|
* @param password - User's password.
|
|
277
|
-
* @param turnstileToken -
|
|
282
|
+
* @param turnstileToken - Has no effect. Base44 doesn't verify Turnstile tokens for app users.
|
|
278
283
|
* @returns Promise resolving to login response with access token and user data.
|
|
279
284
|
* @throws Error if the email and password combination is invalid or the user is not registered.
|
|
280
285
|
*
|
|
@@ -684,7 +684,11 @@ export interface EntityHandler<T = any> {
|
|
|
684
684
|
/**
|
|
685
685
|
* Deletes a single record by ID.
|
|
686
686
|
*
|
|
687
|
-
*
|
|
687
|
+
* The record moves to the entity's trash. To restore it or delete it permanently,
|
|
688
|
+
* use **Recently deleted** in the [Data tab](/Building-your-app/Managing-your-app-data)
|
|
689
|
+
* or the [Restore entity record](/api-reference/restore-entity-record) and
|
|
690
|
+
* [Permanently delete entity record](/api-reference/permanently-delete-entity-record)
|
|
691
|
+
* endpoints.
|
|
688
692
|
*
|
|
689
693
|
* @param id - The unique identifier of the record to delete.
|
|
690
694
|
* @returns Promise resolving to the deletion result.
|
|
@@ -700,7 +704,12 @@ export interface EntityHandler<T = any> {
|
|
|
700
704
|
/**
|
|
701
705
|
* Deletes multiple records matching a query.
|
|
702
706
|
*
|
|
703
|
-
*
|
|
707
|
+
* The matching records move to the entity's trash. To restore them or delete them
|
|
708
|
+
* permanently, use **Recently deleted** in the
|
|
709
|
+
* [Data tab](/Building-your-app/Managing-your-app-data) or the
|
|
710
|
+
* [Restore entity records](/api-reference/restore-entity-records) and
|
|
711
|
+
* [Permanently delete entity record](/api-reference/permanently-delete-entity-record)
|
|
712
|
+
* endpoints.
|
|
704
713
|
*
|
|
705
714
|
* This isn't a transaction. Each record is deleted on its own, so if the call
|
|
706
715
|
* fails partway, the records already deleted stay deleted. Learn more about
|
|
@@ -758,6 +767,8 @@ export interface EntityHandler<T = any> {
|
|
|
758
767
|
* example, filter by `status: 'pending'` when setting status to `'processed'`.
|
|
759
768
|
*
|
|
760
769
|
* Each matching record is updated on its own, and the call isn't a transaction.
|
|
770
|
+
* All the update operators in a call, such as `$set`, `$inc`, and `$push`, are
|
|
771
|
+
* applied to each record in a single write.
|
|
761
772
|
* To claim one record safely, so that only one of 2 users acting at the same
|
|
762
773
|
* time succeeds, pass that record's `id` as a plain value plus the conditions
|
|
763
774
|
* that must still be true, then check `updated` in the response. The conditions
|
|
@@ -840,6 +851,20 @@ export interface EntityHandler<T = any> {
|
|
|
840
851
|
* // Someone else claimed it first, or it was no longer open
|
|
841
852
|
* }
|
|
842
853
|
* ```
|
|
854
|
+
*
|
|
855
|
+
* @example
|
|
856
|
+
* ```typescript
|
|
857
|
+
* // Save only if the record hasn't changed
|
|
858
|
+
* // `version` is a number field defined in the Document schema.
|
|
859
|
+
* // The edit is saved only if the record is still at the version this user loaded.
|
|
860
|
+
* const result = await base44.entities.Document.updateMany(
|
|
861
|
+
* { id: doc.id, version: doc.version },
|
|
862
|
+
* { $set: { body: newBody }, $inc: { version: 1 } }
|
|
863
|
+
* );
|
|
864
|
+
* if (result.updated === 0) {
|
|
865
|
+
* // Someone else saved a change first. Reload the record and try again.
|
|
866
|
+
* }
|
|
867
|
+
* ```
|
|
843
868
|
*/
|
|
844
869
|
updateMany(query: Partial<T>, data: Record<string, Record<string, any>>): Promise<UpdateManyResult>;
|
|
845
870
|
/**
|
|
@@ -1117,7 +1142,7 @@ type DynamicEntitiesModule = {
|
|
|
1117
1142
|
*
|
|
1118
1143
|
* Every app includes a built-in `User` entity that stores user account information. This entity has special security rules that can't be changed.
|
|
1119
1144
|
*
|
|
1120
|
-
* Regular users can only read and update their own user record. With service role authentication, you can read
|
|
1145
|
+
* Regular users can only read and update their own user record. With service role authentication, you can read and update any user, and remove any user except the app owner. A removed user moves to **Recently deleted** for 30 days, where an app editor can restore them, and is then deleted permanently. You can't create users using the entities module. Instead, use the functions of the {@link AuthModule | auth module} to invite or register new users.
|
|
1121
1146
|
*
|
|
1122
1147
|
* ## Generated Types
|
|
1123
1148
|
*
|
|
@@ -40,7 +40,7 @@ export interface CheckoutItem {
|
|
|
40
40
|
amount: number;
|
|
41
41
|
/** Number of units, from 1 to 1,000,000. Defaults to `1`. */
|
|
42
42
|
quantity?: number;
|
|
43
|
-
/** Whether the item ships
|
|
43
|
+
/** Whether the item ships. The provider then collects a shipping address, unless you pass one in `shipping.address`. */
|
|
44
44
|
shippable?: boolean;
|
|
45
45
|
/** Billing terms. Set this to sell the item as a subscription. PayPal and Wix Payments allow one recurring item per checkout, and PayPal allows no other items with it. */
|
|
46
46
|
recurring?: CheckoutItemRecurring;
|
|
@@ -58,6 +58,36 @@ 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
|
+
}
|
|
61
91
|
/**
|
|
62
92
|
* How the buyer pays.
|
|
63
93
|
*
|
|
@@ -85,6 +115,8 @@ export interface CreateCheckoutParams {
|
|
|
85
115
|
idempotency_key?: string;
|
|
86
116
|
/** How the buyer pays. Defaults to `'redirect'`. PayPal apps must pass `'embedded'`, and Wix Payments supports only `'redirect'`. */
|
|
87
117
|
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;
|
|
88
120
|
}
|
|
89
121
|
/**
|
|
90
122
|
* Data that Stripe Embedded Checkout needs to render.
|
|
@@ -184,6 +216,10 @@ export interface Purchase {
|
|
|
184
216
|
metadata?: Record<string, string> | null;
|
|
185
217
|
/** ID of the subscription, for recurring purchases. */
|
|
186
218
|
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;
|
|
187
223
|
/** 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. */
|
|
188
224
|
payment_id?: string | null;
|
|
189
225
|
}
|