@hexclave/js 1.0.45 → 1.0.47
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/{admin-app-impl-DI94ECl1.d.ts → admin-app-impl-6CEJgE2l.d.ts} +10 -9
- package/dist/{admin-app-impl-DI94ECl1.d.ts.map → admin-app-impl-6CEJgE2l.d.ts.map} +1 -1
- package/dist/clickmap/clickmap-core.d.ts +1 -1
- package/dist/clickmap/index.d.ts +1 -1
- package/dist/{client-app-Cw7oo4B1.d.ts → client-app-BgdvwktS.d.ts} +2 -2
- package/dist/{client-app-Cw7oo4B1.d.ts.map → client-app-BgdvwktS.d.ts.map} +1 -1
- package/dist/dev-tool/dev-tool-core.d.ts +1 -1
- package/dist/dev-tool/index.d.ts +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +4 -4
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js +9 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +2 -2
- package/dist/esm/lib/hexclave-app/apps/implementations/common.js +2 -2
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +1 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.js +5 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.js.map +1 -1
- package/dist/esm/lib/hexclave-app/plan-usage/index.d.ts +1 -0
- package/dist/esm/lib/hexclave-app/plan-usage/index.d.ts.map +1 -1
- package/dist/{index-D7Vdg30O.d.ts → index-B594jg4e.d.ts} +2 -1
- package/dist/{index-D7Vdg30O.d.ts.map → index-B594jg4e.d.ts.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js +8 -0
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/common.js +2 -2
- package/dist/lib/hexclave-app/apps/implementations/index.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.js +5 -0
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.js.map +1 -1
- package/dist/lib/hexclave-app/apps/index.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/admin-app.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/client-app.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/server-app.d.ts +1 -1
- package/dist/lib/hexclave-app/index.d.ts +2 -2
- package/dist/lib/hexclave-app/plan-usage/index.d.ts +1 -1
- package/dist/lib/hexclave-app/projects/index.d.ts +1 -1
- package/dist/lib/hexclave-app/teams/index.d.ts +1 -1
- package/dist/lib/hexclave-app/users/index.d.ts +1 -1
- package/dist/pushed-config-error-overlay/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/lib/hexclave-app/apps/implementations/admin-app-impl.ts +17 -1
- package/src/lib/hexclave-app/apps/implementations/server-app-impl.ts +10 -0
- package/src/lib/hexclave-app/plan-usage/index.ts +1 -0
|
@@ -13,7 +13,7 @@ import type { AdminGetSessionReplayChunkEventsResponse } from "@hexclave/shared/
|
|
|
13
13
|
import type { Transaction, TransactionType } from "@hexclave/shared/dist/interface/crud/transactions";
|
|
14
14
|
import type { RestrictedReason } from "@hexclave/shared/dist/schema-fields";
|
|
15
15
|
import type { MoneyAmount } from "@hexclave/shared/dist/utils/currency-constants";
|
|
16
|
-
import { HexclaveAssertionError, throwErr } from "@hexclave/shared/dist/utils/errors";
|
|
16
|
+
import { HexclaveAssertionError, captureError, throwErr } from "@hexclave/shared/dist/utils/errors";
|
|
17
17
|
import type { Json } from "@hexclave/shared/dist/utils/json";
|
|
18
18
|
import { pick, typedEntries, typedValues } from "@hexclave/shared/dist/utils/objects";
|
|
19
19
|
import { Result } from "@hexclave/shared/dist/utils/results";
|
|
@@ -342,6 +342,8 @@ export class _HexclaveAdminAppImplIncomplete<HasTokenStore extends boolean, Proj
|
|
|
342
342
|
periodStart: new Date(data.period_start_millis),
|
|
343
343
|
periodEnd: new Date(data.period_end_millis),
|
|
344
344
|
nextPlanId: data.next_plan_id,
|
|
345
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- getPlanUsage() returns raw JSON without yup validation, so this field can be undefined at runtime if the backend hasn't deployed the field yet
|
|
346
|
+
arePlanLimitsEnforced: data.are_plan_limits_enforced ?? true,
|
|
345
347
|
rows: data.rows.map((row) => ({
|
|
346
348
|
itemId: row.item_id,
|
|
347
349
|
displayName: row.display_name,
|
|
@@ -773,6 +775,20 @@ export class _HexclaveAdminAppImplIncomplete<HasTokenStore extends boolean, Proj
|
|
|
773
775
|
allow_negative: true,
|
|
774
776
|
}
|
|
775
777
|
);
|
|
778
|
+
const [customerType, customerId] = "userId" in options
|
|
779
|
+
? ["user", options.userId] as const
|
|
780
|
+
: "teamId" in options
|
|
781
|
+
? ["team", options.teamId] as const
|
|
782
|
+
: ["custom", options.customCustomerId] as const;
|
|
783
|
+
try {
|
|
784
|
+
// Best-effort: the quantity change is already persisted at this point, so
|
|
785
|
+
// a cache refresh failure must not make the mutation look failed (a retry
|
|
786
|
+
// would apply the delta twice).
|
|
787
|
+
await this._refreshItemCache(customerType, customerId, options.itemId);
|
|
788
|
+
await this._transactionsCache.invalidateWhere(() => true);
|
|
789
|
+
} catch (error) {
|
|
790
|
+
captureError("create-item-quantity-change-cache-refresh", error);
|
|
791
|
+
}
|
|
776
792
|
}
|
|
777
793
|
|
|
778
794
|
async refundTransaction(options: {
|
|
@@ -1157,6 +1157,16 @@ export class _HexclaveServerAppImplIncomplete<HasTokenStore extends boolean, Pro
|
|
|
1157
1157
|
}
|
|
1158
1158
|
}
|
|
1159
1159
|
|
|
1160
|
+
protected async _refreshItemCache(customerType: "user" | "team" | "custom", customerId: string, itemId: string): Promise<void> {
|
|
1161
|
+
if (customerType === "user") {
|
|
1162
|
+
await this._serverUserItemsCache.refresh([customerId, itemId]);
|
|
1163
|
+
} else if (customerType === "team") {
|
|
1164
|
+
await this._serverTeamItemsCache.refresh([customerId, itemId]);
|
|
1165
|
+
} else {
|
|
1166
|
+
await this._serverCustomItemsCache.refresh([customerId, itemId]);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1160
1170
|
async listProducts(options: CustomerProductsRequestOptions): Promise<CustomerProductsList> {
|
|
1161
1171
|
if ("userId" in options) {
|
|
1162
1172
|
const response = Result.orThrow(await this._serverUserProductsCache.getOrWait([options.userId, options.cursor ?? null, options.limit ?? null], "write-only"));
|