@schematichq/schematic-typescript-node 1.5.0 → 1.5.2
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.d.ts +8 -0
- package/dist/api/resources/billing/client/Client.d.ts +47 -0
- package/dist/api/resources/billing/client/requests/ListBillingPricesRequest.d.ts +3 -0
- package/dist/api/resources/billing/client/requests/ListBillingProductPricesRequest.d.ts +3 -0
- package/dist/api/resources/billing/types/DeleteBillingCouponResponse.d.ts +6 -0
- package/dist/api/resources/billing/types/DeleteBillingCustomerResponse.d.ts +6 -0
- package/dist/api/resources/billing/types/DeleteBillingInvoiceResponse.d.ts +6 -0
- package/dist/api/resources/billing/types/ListBillingPricesParams.d.ts +2 -0
- package/dist/api/resources/billing/types/ListBillingProductPricesParams.d.ts +2 -0
- package/dist/api/resources/billing/types/index.d.ts +3 -0
- package/dist/api/resources/credits/client/Client.d.ts +0 -48
- package/dist/api/resources/credits/client/requests/index.d.ts +0 -2
- package/dist/api/resources/credits/types/index.d.ts +0 -4
- package/dist/api/resources/plangroups/client/Client.d.ts +2 -0
- package/dist/api/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +4 -0
- package/dist/api/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +4 -0
- package/dist/api/resources/plans/client/Client.d.ts +2 -10
- package/dist/api/resources/plans/client/requests/PublishPlanVersionRequestBody.d.ts +1 -6
- package/dist/api/resources/plans/client/requests/RetryCustomPlanBillingRequestBody.d.ts +1 -6
- package/dist/api/resources/webhooks/client/Client.d.ts +18 -0
- package/dist/api/resources/webhooks/client/requests/TestWebhookRequestBody.d.ts +10 -0
- package/dist/api/resources/webhooks/client/requests/index.d.ts +1 -0
- package/dist/api/resources/webhooks/types/SendTestWebhookActionResponse.d.ts +6 -0
- package/dist/api/resources/webhooks/types/index.d.ts +1 -0
- package/dist/api/types/AccountMemberPermission.d.ts +0 -1
- package/dist/api/types/BillingCreditGrantZeroedOutReason.d.ts +1 -0
- package/dist/api/types/ChangeSubscriptionInternalRequestBody.d.ts +1 -0
- package/dist/api/types/ChangeSubscriptionRequestBody.d.ts +1 -0
- package/dist/api/types/CheckFlagsResponseData.d.ts +2 -0
- package/dist/api/types/CheckoutSettingsResponseData.d.ts +3 -0
- package/dist/api/types/CompanyCreditBalance.d.ts +8 -0
- package/dist/api/types/CompanySubscriptionResponseData.d.ts +1 -0
- package/dist/api/types/FeatureEntitlement.d.ts +9 -1
- package/dist/api/types/PlanChangeResponseData.d.ts +2 -0
- package/dist/api/types/PreviewSubscriptionChangeResponseData.d.ts +3 -0
- package/dist/api/types/RulesengineFeatureEntitlement.d.ts +9 -1
- package/dist/api/types/TestWebhookResponseData.d.ts +4 -0
- package/dist/api/types/index.d.ts +2 -2
- package/dist/credits/check.d.ts +9 -5
- package/dist/credits/types.d.ts +11 -9
- package/dist/datastream/merge.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/rules-engine.d.ts +4 -0
- package/dist/serialization/resources/billing/types/DeleteBillingCouponResponse.d.ts +11 -0
- package/dist/serialization/resources/billing/types/DeleteBillingCustomerResponse.d.ts +11 -0
- package/dist/serialization/resources/billing/types/DeleteBillingInvoiceResponse.d.ts +11 -0
- package/dist/serialization/resources/billing/types/ListBillingPricesParams.d.ts +1 -0
- package/dist/serialization/resources/billing/types/ListBillingProductPricesParams.d.ts +1 -0
- package/dist/serialization/resources/billing/types/index.d.ts +3 -0
- package/dist/serialization/resources/credits/types/index.d.ts +0 -4
- package/dist/serialization/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +3 -0
- package/dist/serialization/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +3 -0
- package/dist/serialization/resources/plans/client/requests/PublishPlanVersionRequestBody.d.ts +0 -2
- package/dist/serialization/resources/plans/client/requests/RetryCustomPlanBillingRequestBody.d.ts +0 -2
- package/dist/serialization/resources/webhooks/client/requests/TestWebhookRequestBody.d.ts +10 -0
- package/dist/serialization/resources/webhooks/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/webhooks/types/SendTestWebhookActionResponse.d.ts +11 -0
- package/dist/serialization/resources/webhooks/types/index.d.ts +1 -0
- package/dist/serialization/types/AccountMemberPermission.d.ts +1 -1
- package/dist/serialization/types/BillingCreditGrantZeroedOutReason.d.ts +1 -1
- package/dist/serialization/types/ChangeSubscriptionInternalRequestBody.d.ts +1 -0
- package/dist/serialization/types/ChangeSubscriptionRequestBody.d.ts +1 -0
- package/dist/serialization/types/CheckFlagsResponseData.d.ts +2 -0
- package/dist/serialization/types/CheckoutSettingsResponseData.d.ts +3 -0
- package/dist/serialization/types/CompanyCreditBalance.d.ts +11 -0
- package/dist/serialization/types/CompanySubscriptionResponseData.d.ts +1 -0
- package/dist/serialization/types/FeatureEntitlement.d.ts +4 -0
- package/dist/serialization/types/PlanChangeResponseData.d.ts +1 -0
- package/dist/serialization/types/PreviewSubscriptionChangeResponseData.d.ts +3 -0
- package/dist/serialization/types/RulesengineFeatureEntitlement.d.ts +4 -0
- package/dist/serialization/types/TestWebhookResponseData.d.ts +10 -0
- package/dist/serialization/types/index.d.ts +2 -2
- package/dist/wasm/rulesengine.js +4 -4
- package/dist/wrapper.d.ts +0 -30
- package/package.json +1 -1
- package/dist/api/resources/credits/client/requests/CountCreditLedgerRequest.d.ts +0 -26
- package/dist/api/resources/credits/client/requests/GetEnrichedCreditLedgerRequest.d.ts +0 -26
- package/dist/api/resources/credits/types/CountCreditLedgerParams.d.ts +0 -16
- package/dist/api/resources/credits/types/CountCreditLedgerResponse.d.ts +0 -6
- package/dist/api/resources/credits/types/GetEnrichedCreditLedgerParams.d.ts +0 -16
- package/dist/api/resources/credits/types/GetEnrichedCreditLedgerResponse.d.ts +0 -6
- package/dist/api/types/CreditLedgerEnrichedEntryResponseData.d.ts +0 -25
- package/dist/api/types/CreditLedgerPeriod.d.ts +0 -7
- package/dist/serialization/resources/credits/types/CountCreditLedgerParams.d.ts +0 -17
- package/dist/serialization/resources/credits/types/CountCreditLedgerResponse.d.ts +0 -12
- package/dist/serialization/resources/credits/types/GetEnrichedCreditLedgerParams.d.ts +0 -17
- package/dist/serialization/resources/credits/types/GetEnrichedCreditLedgerResponse.d.ts +0 -12
- package/dist/serialization/types/CreditLedgerEnrichedEntryResponseData.d.ts +0 -33
- package/dist/serialization/types/CreditLedgerPeriod.d.ts +0 -7
package/dist/credits/check.d.ts
CHANGED
|
@@ -26,15 +26,19 @@ export interface CreditCheckDeps {
|
|
|
26
26
|
* Drives a single `client.check` with `usage` set.
|
|
27
27
|
*
|
|
28
28
|
* Steps:
|
|
29
|
-
* 1.
|
|
30
|
-
*
|
|
29
|
+
* 1. Probe the engine once (real balance, no preflight, no substitution) and
|
|
30
|
+
* read the matched plan entitlement. If it isn't credit-metered
|
|
31
|
+
* (`valueType != credit` — boolean/override grant, numeric allocation,
|
|
32
|
+
* unlimited, or not entitled) there's nothing to lease: defer to the plain
|
|
33
|
+
* check. Otherwise `creditId` + `consumptionRate` + `eventSubtype` come
|
|
34
|
+
* straight off the entitlement — no structural flag scan.
|
|
31
35
|
* 2. Acquire (or reuse) a lease for `(company, creditId)`.
|
|
32
36
|
* 3. Try to reserve `quantity × consumptionRate` from the lease.
|
|
33
37
|
* 4. Run the WASM rules engine against a substituted company snapshot
|
|
34
38
|
* (`credit_balances[creditId] = lease.localRemaining` *before* the
|
|
35
|
-
* reservation we just made was debited),
|
|
36
|
-
*
|
|
37
|
-
*
|
|
39
|
+
* reservation we just made was debited), gating with `credit_cost` so the
|
|
40
|
+
* engine evaluates the post-call balance. The reservation we made in step 3
|
|
41
|
+
* only sticks if the engine says allowed.
|
|
38
42
|
*/
|
|
39
43
|
export declare function checkWithLease(deps: CreditCheckDeps, key: string, evalCtx: api.CheckFlagRequestBody, options: CheckOptions, fallback: () => Promise<CheckResult>): Promise<CheckResult>;
|
|
40
44
|
/**
|
package/dist/credits/types.d.ts
CHANGED
|
@@ -150,15 +150,17 @@ export interface CheckResult {
|
|
|
150
150
|
/**
|
|
151
151
|
* Entitlement payload from the check.
|
|
152
152
|
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
153
|
+
* For a credit-metered feature the entitlement carries the lease-aware
|
|
154
|
+
* three-way split the server computes: `creditRemaining` (drawable now, open
|
|
155
|
+
* lease holds excluded), `creditReserved` (the open lease's unspent hold),
|
|
156
|
+
* and `creditSettled` (`creditRemaining + creditReserved` = the balance net
|
|
157
|
+
* of actual consumption). Bind a user-facing "credits remaining" counter to
|
|
158
|
+
* `creditSettled` — it's invariant to in-flight lease holds, so it doesn't
|
|
159
|
+
* dip mid-call the way the raw server balance does.
|
|
160
|
+
*
|
|
161
|
+
* These come from the company's resolved entitlement, so the lease-balance
|
|
162
|
+
* substitution a lease-bearing `check()` applies for gating does NOT distort
|
|
163
|
+
* them — the same values surface whether or not `usage` was passed.
|
|
162
164
|
*/
|
|
163
165
|
entitlement?: api.RulesengineFeatureEntitlement;
|
|
164
166
|
/** Flag key checked. */
|
|
@@ -11,7 +11,7 @@ export declare function deepCopyUser(u: Schematic.RulesengineUser): Schematic.Ru
|
|
|
11
11
|
* Partials don't carry refreshed entitlements, so when their derived fields
|
|
12
12
|
* change in another part of the company we sync them here to match server
|
|
13
13
|
* behavior:
|
|
14
|
-
* - creditRemaining ← credit_balances[credit_id]
|
|
14
|
+
* - creditRemaining ← credit_balances[credit_id] (or credit_lease_balance[credit_id].remaining)
|
|
15
15
|
* - usage ← metric value matching (eventName, metricPeriod, monthReset)
|
|
16
16
|
* Both are skipped when the partial also sends entitlements wholesale.
|
|
17
17
|
*
|