@layers/amba-web 4.0.6 → 4.0.7
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.browser.d.ts +2437 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +2451 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.d.ts +31 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -16
- package/dist/index.js.map +1 -1
- package/dist-rn/index.d.ts +31 -2
- package/dist-rn/index.js +30 -5
- package/package.json +3 -3
package/dist-rn/index.d.ts
CHANGED
|
@@ -38,6 +38,17 @@ interface AmbaConfig {
|
|
|
38
38
|
debug?: boolean;
|
|
39
39
|
/** Override the localStorage key prefix. Defaults to `"amba"`. */
|
|
40
40
|
storagePrefix?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Advanced: explicit URL or RequestInfo for the @layers/amba-core WASM file.
|
|
43
|
+
* Browser bundlers should not need this; the browser entry supplies a
|
|
44
|
+
* bundler-safe core runtime automatically.
|
|
45
|
+
*/
|
|
46
|
+
wasmUrl?: RequestInfo | URL;
|
|
47
|
+
/**
|
|
48
|
+
* Advanced: explicit compiled module, response, or bytes for the WASM core.
|
|
49
|
+
* Mutually exclusive with `wasmUrl`.
|
|
50
|
+
*/
|
|
51
|
+
wasmModule?: Response | BufferSource | WebAssembly.Module;
|
|
41
52
|
}
|
|
42
53
|
type SocialProvider = "apple" | "google";
|
|
43
54
|
type PushPlatform = "apns" | "fcm" | "web";
|
|
@@ -116,7 +127,7 @@ interface OrderBy {
|
|
|
116
127
|
}
|
|
117
128
|
/**
|
|
118
129
|
* Eager-load related rows from another collection in the same `find` call,
|
|
119
|
-
* avoiding an N+1 round-trip per base row.
|
|
130
|
+
* avoiding an N+1 round-trip per base row.
|
|
120
131
|
*
|
|
121
132
|
* belongs-to — each base row's `localKey` column points at the related row:
|
|
122
133
|
* { collection: "novels", localKey: "novel_id", as: "novel", single: true }
|
|
@@ -145,6 +156,24 @@ interface IncludeClause {
|
|
|
145
156
|
single?: boolean;
|
|
146
157
|
/** has-many only: cap related rows per base row (default 100, max 1000). */
|
|
147
158
|
limit?: number;
|
|
159
|
+
/**
|
|
160
|
+
* Filtered include — an extra predicate on the related rows, in the
|
|
161
|
+
* server's where-DSL shape (`{ status: "published" }`,
|
|
162
|
+
* `{ score: { gte: 10 } }`). The target collection's own read policy +
|
|
163
|
+
* soft-delete still apply.
|
|
164
|
+
*/
|
|
165
|
+
where?: Record<string, unknown>;
|
|
166
|
+
/**
|
|
167
|
+
* Projection on the included rows — only these columns are returned
|
|
168
|
+
* (join keys are handled internally).
|
|
169
|
+
*/
|
|
170
|
+
select?: string[];
|
|
171
|
+
/**
|
|
172
|
+
* Nested include — eager-load relations OF the included rows
|
|
173
|
+
* (e.g. novels → chapters → comments). Max depth 3; max 10 clauses
|
|
174
|
+
* total per find.
|
|
175
|
+
*/
|
|
176
|
+
include?: IncludeClause[];
|
|
148
177
|
}
|
|
149
178
|
interface FindOptions {
|
|
150
179
|
filter?: Filter;
|
|
@@ -2402,7 +2431,7 @@ declare function getCoreWasm(): AmbaCoreWasm;
|
|
|
2402
2431
|
* `verify-sdk-version-coherence` GH action gates every publish on the
|
|
2403
2432
|
* pair agreeing (and matching the `web-v<X.Y.Z>` tag when tag-triggered).
|
|
2404
2433
|
*/
|
|
2405
|
-
declare const SDK_VERSION = "4.0.
|
|
2434
|
+
declare const SDK_VERSION = "4.0.7";
|
|
2406
2435
|
//#endregion
|
|
2407
2436
|
export { Achievement, AchievementProgress, AiContentBlock, AiImageInput, AiMessage, AiMessageRequest, AiMessageResponse, type AiStreamDelta, type AiStreamDone, type AiStreamEvent, type AiStreamOptions, AiUsage, Amba, AmbaApiError, type AmbaApiErrorCode, AmbaConfig, AndFilter, AppSession, AuthResult, CatalogItem, Challenge, ChallengeProgress, CollectionSubscription, ConditionFilter, ConfigBundle, ConsumeRequest, ContentItem, Conversation, ConversationParticipant, ConversationSubscription, ConversationType, CreateConversationRequest, CurrencyBalance, CurrencyTransaction, DeepLink, DeepLinkCreate, DeleteManyResult, DiagnosticsEnvironment, EntitlementPeriodType, EntitlementStore, EventExplainResult, ExplainMatchedRule, FeedItem, FeedResponse, Filter, FilterValue, FindOptions, FindResponse, FlagAssignment, type FlushResult, Friendship, FriendshipState, type GamificationChange, type GamificationKind, GamificationSubscription, Group, GroupCreate, GroupMember, GroupUpdate, IncludeClause, InventoryItem, InvokeOptions, type KvStore, Leaderboard, LeaderboardEntry, LeagueCohort, LeagueCohortMember, LeagueCohortView, LeagueMembership, LeagueTier, LinkedIdentifier, ListMessagesOptions, LocalNotificationHandle, LocalNotificationTrigger, type LocalNotificationsNamespace, MarkReadResult, MediaAsset, MediaCatalog, MediaCatalogItem, MediaListResponse, Message, type MessageChange, MessageType, NearestOptions, NearestResponse, NotFilter, Offering, OfferingPackage, OfferingProduct, OfferingsResult, OnboardingStatus, OrFilter, OrderBy, type OutboxOp, type OutboxOpKind, PingResult, PresignData, PullChangesCursor, PullChangesResult, PurchaseOption, PurchaseRequest, PurchaseResult, PushChangesResult, PushPlatform, PushToken, type RealtimeChange, ReferralClaim, ReferralCode, Report, ReportRequest, RestoreResult, Review, ReviewCreate, ReviewUpdate, Role, type RowChangeOp, SDK_VERSION, ScheduleLocalNotificationInput, ScheduledLocalNotification, SendMessageRequest, Session, SocialProvider, Store, Streak, type SubscribeOptions, SyncChange, SyncConflict, TransactionOp, TransactionOpResult, type Unsubscribe, UpsertOptions, User, UserEntitlement, XpBalance, XpTransaction, getCoreWasm, withOptimistic };
|
|
2408
2437
|
//# sourceMappingURL=index.d.ts.map
|
package/dist-rn/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import init, { AmbaCoreWasm } from "@layers/amba-core";
|
|
2
|
-
|
|
3
1
|
//#region src/storage-adapter.ts
|
|
4
2
|
/**
|
|
5
3
|
* Browser localStorage adapter for SDK identity persistence.
|
|
@@ -1316,6 +1314,26 @@ const notifications = {
|
|
|
1316
1314
|
}
|
|
1317
1315
|
};
|
|
1318
1316
|
|
|
1317
|
+
//#endregion
|
|
1318
|
+
//#region src/wasm-loader.ts
|
|
1319
|
+
let coreInit;
|
|
1320
|
+
let coreWasmClass;
|
|
1321
|
+
function setCoreRuntime(init, wasmClass) {
|
|
1322
|
+
coreInit = init;
|
|
1323
|
+
coreWasmClass = wasmClass;
|
|
1324
|
+
}
|
|
1325
|
+
async function getCoreRuntime() {
|
|
1326
|
+
if (coreInit === void 0 || coreWasmClass === void 0) {
|
|
1327
|
+
const core = await import("@layers/amba-core");
|
|
1328
|
+
setCoreRuntime(core.default, core.AmbaCoreWasm);
|
|
1329
|
+
}
|
|
1330
|
+
if (coreInit === void 0 || coreWasmClass === void 0) throw new Error("Amba.configure: core WASM runtime failed to load");
|
|
1331
|
+
return {
|
|
1332
|
+
initCore: coreInit,
|
|
1333
|
+
wasmClass: coreWasmClass
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1319
1337
|
//#endregion
|
|
1320
1338
|
//#region src/index.ts
|
|
1321
1339
|
const DEFAULT_API_URL = "https://api.amba.dev";
|
|
@@ -1633,12 +1651,19 @@ const Amba = {
|
|
|
1633
1651
|
configure: async (config) => {
|
|
1634
1652
|
if (!config.projectId || config.projectId.trim() === "") throw new Error("Amba.configure: projectId is required");
|
|
1635
1653
|
if (!config.clientKey || config.clientKey.trim() === "") throw new Error("Amba.configure: clientKey is required");
|
|
1636
|
-
|
|
1654
|
+
if (config.wasmUrl !== void 0 && config.wasmModule !== void 0) throw new Error("Amba.configure: pass only one of wasmUrl or wasmModule");
|
|
1655
|
+
else {
|
|
1656
|
+
const { initCore } = await getCoreRuntime();
|
|
1657
|
+
const explicitWasmInput = config.wasmModule ?? config.wasmUrl;
|
|
1658
|
+
if (explicitWasmInput !== void 0) await initCore({ module_or_path: explicitWasmInput });
|
|
1659
|
+
else await initCore(); // Hermes-stripped Node-init block (DX-15) — see scripts/build-rn.mjs
|
|
1660
|
+
}
|
|
1637
1661
|
const persistence = new LocalStoragePersistence(config.storagePrefix ?? "amba");
|
|
1638
1662
|
persistence.hydrate();
|
|
1639
1663
|
let nextCore;
|
|
1640
1664
|
try {
|
|
1641
|
-
|
|
1665
|
+
const { wasmClass } = await getCoreRuntime();
|
|
1666
|
+
nextCore = wasmClass.init(encodeJson({
|
|
1642
1667
|
api_key: config.clientKey,
|
|
1643
1668
|
base_url: config.apiUrl,
|
|
1644
1669
|
project_id: config.projectId,
|
|
@@ -2402,7 +2427,7 @@ function getCoreWasm() {
|
|
|
2402
2427
|
* `verify-sdk-version-coherence` GH action gates every publish on the
|
|
2403
2428
|
* pair agreeing (and matching the `web-v<X.Y.Z>` tag when tag-triggered).
|
|
2404
2429
|
*/
|
|
2405
|
-
const SDK_VERSION = "4.0.
|
|
2430
|
+
const SDK_VERSION = "4.0.7";
|
|
2406
2431
|
|
|
2407
2432
|
//#endregion
|
|
2408
2433
|
export { Amba, AmbaApiError, CollectionSubscription, ConversationSubscription, GamificationSubscription, SDK_VERSION, getCoreWasm, withOptimistic };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layers/amba-web",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "amba SDK for browser apps — full SDK 4.0 surface (34 modules: auth + magic link, users, sessions, sync, collections + vector search, storage + list/delete/download, push, entitlements, flags, config, deep links, onboarding, content, messaging, friends, groups, feeds, reviews, moderation, roles, referrals, achievements, xp, streaks, challenges, leaderboards, leagues, currencies, inventory, stores, catalog, ai, diagnostics).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"react-native": "./dist-rn/index.js",
|
|
13
|
-
"browser": "./dist/index.js",
|
|
13
|
+
"browser": "./dist/index.browser.js",
|
|
14
14
|
"import": "./dist/index.js",
|
|
15
15
|
"default": "./dist/index.js"
|
|
16
16
|
}
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"sideEffects": false,
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@layers/amba-core": "^4.0.
|
|
35
|
+
"@layers/amba-core": "^4.0.7"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^22.13.14",
|