@schematichq/schematic-typescript-node 1.5.13 → 1.6.1
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/README.md +49 -28
- package/dist/api/resources/credits/client/Client.d.ts +41 -5
- package/dist/api/resources/credits/client/requests/ReserveCreditsRequestBody.d.ts +18 -0
- package/dist/api/resources/credits/client/requests/index.d.ts +1 -0
- package/dist/api/resources/credits/types/ReleaseCreditReservationResponse.d.ts +6 -0
- package/dist/api/resources/credits/types/ReserveCreditsResponse.d.ts +6 -0
- package/dist/api/resources/credits/types/index.d.ts +2 -0
- package/dist/api/resources/features/client/Client.d.ts +18 -0
- package/dist/api/resources/features/client/requests/CheckAndReserveFlagRequestBody.d.ts +15 -0
- package/dist/api/resources/features/client/requests/index.d.ts +1 -0
- package/dist/api/resources/features/types/CheckAndReserveFlagResponse.d.ts +6 -0
- package/dist/api/resources/features/types/index.d.ts +1 -0
- package/dist/api/resources/planmigrations/client/Client.d.ts +4 -2
- package/dist/api/resources/planmigrations/client/requests/CountMigrationsRequest.d.ts +3 -1
- package/dist/api/resources/planmigrations/client/requests/ListMigrationsRequest.d.ts +3 -1
- package/dist/api/resources/planmigrations/types/CountMigrationsParams.d.ts +1 -0
- package/dist/api/resources/planmigrations/types/ListMigrationsParams.d.ts +1 -0
- package/dist/api/resources/plans/client/Client.d.ts +4 -0
- package/dist/api/resources/plans/client/requests/CountPlansRequest.d.ts +6 -0
- package/dist/api/resources/plans/client/requests/ListPlansRequest.d.ts +6 -0
- package/dist/api/resources/plans/types/CountPlansParams.d.ts +4 -0
- package/dist/api/resources/plans/types/ListPlansParams.d.ts +4 -0
- package/dist/api/types/CheckAndReserveFlagResponseData.d.ts +35 -0
- package/dist/api/types/CreditReservationResponseData.d.ts +15 -0
- package/dist/api/types/CreditUsageReason.d.ts +2 -0
- package/dist/api/types/EventBodyTrack.d.ts +2 -0
- package/dist/api/types/EventDetailResponseData.d.ts +1 -0
- package/dist/api/types/EventResponseData.d.ts +1 -0
- package/dist/api/types/FlagCheckReservationResponseData.d.ts +15 -0
- package/dist/api/types/PlanVersionMigrationResponseData.d.ts +2 -0
- package/dist/api/types/index.d.ts +3 -1
- package/dist/credits/index.d.ts +2 -2
- package/dist/credits/server-check.d.ts +40 -0
- package/dist/credits/track.d.ts +1 -1
- package/dist/credits/types.d.ts +36 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/serialization/resources/credits/client/requests/ReserveCreditsRequestBody.d.ts +13 -0
- package/dist/serialization/resources/credits/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/credits/types/ReleaseCreditReservationResponse.d.ts +11 -0
- package/dist/serialization/resources/credits/types/ReserveCreditsResponse.d.ts +11 -0
- package/dist/serialization/resources/credits/types/index.d.ts +2 -0
- package/dist/serialization/resources/features/client/requests/CheckAndReserveFlagRequestBody.d.ts +14 -0
- package/dist/serialization/resources/features/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/features/types/CheckAndReserveFlagResponse.d.ts +11 -0
- package/dist/serialization/resources/features/types/index.d.ts +1 -0
- package/dist/serialization/resources/planmigrations/types/CountMigrationsParams.d.ts +1 -0
- package/dist/serialization/resources/planmigrations/types/ListMigrationsParams.d.ts +1 -0
- package/dist/serialization/resources/plans/types/CountPlansParams.d.ts +2 -0
- package/dist/serialization/resources/plans/types/ListPlansParams.d.ts +2 -0
- package/dist/serialization/types/CheckAndReserveFlagResponseData.d.ts +28 -0
- package/dist/serialization/types/CreditReservationResponseData.d.ts +17 -0
- package/dist/serialization/types/CreditUsageReason.d.ts +1 -1
- package/dist/serialization/types/EventBodyTrack.d.ts +1 -0
- package/dist/serialization/types/EventDetailResponseData.d.ts +1 -0
- package/dist/serialization/types/EventResponseData.d.ts +1 -0
- package/dist/serialization/types/FlagCheckReservationResponseData.d.ts +16 -0
- package/dist/serialization/types/PlanVersionMigrationResponseData.d.ts +2 -0
- package/dist/serialization/types/index.d.ts +3 -1
- package/dist/wrapper.d.ts +41 -10
- package/package.json +9 -1
- package/dist/api/types/ReleaseCreditLeaseRequestBody.d.ts +0 -1
- package/dist/serialization/types/ReleaseCreditLeaseRequestBody.d.ts +0 -7
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as Schematic from "../../../../../api/index";
|
|
2
|
+
import * as core from "../../../../../core";
|
|
3
|
+
import type * as serializers from "../../../../index";
|
|
4
|
+
export declare const ReserveCreditsRequestBody: core.serialization.Schema<serializers.ReserveCreditsRequestBody.Raw, Schematic.ReserveCreditsRequestBody>;
|
|
5
|
+
export declare namespace ReserveCreditsRequestBody {
|
|
6
|
+
interface Raw {
|
|
7
|
+
amount: number;
|
|
8
|
+
company_id: string;
|
|
9
|
+
credit_type_id: string;
|
|
10
|
+
expires_at?: string | null;
|
|
11
|
+
idempotency_key?: string | null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -4,6 +4,7 @@ export { CreateCompanyCreditGrant } from "./CreateCompanyCreditGrant";
|
|
|
4
4
|
export { CreateCreditBundleRequestBody } from "./CreateCreditBundleRequestBody";
|
|
5
5
|
export { CreateCreditSpendPolicyRequestBody } from "./CreateCreditSpendPolicyRequestBody";
|
|
6
6
|
export { ExtendCreditLeaseRequestBody } from "./ExtendCreditLeaseRequestBody";
|
|
7
|
+
export { ReserveCreditsRequestBody } from "./ReserveCreditsRequestBody";
|
|
7
8
|
export { UpdateBillingCreditRequestBody } from "./UpdateBillingCreditRequestBody";
|
|
8
9
|
export { UpdateCreditBundleDetailsRequestBody } from "./UpdateCreditBundleDetailsRequestBody";
|
|
9
10
|
export { UpdateCreditSpendPolicyRequestBody } from "./UpdateCreditSpendPolicyRequestBody";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as Schematic from "../../../../api/index";
|
|
2
|
+
import * as core from "../../../../core";
|
|
3
|
+
import type * as serializers from "../../../index";
|
|
4
|
+
import { CreditReservationResponseData } from "../../../types/CreditReservationResponseData";
|
|
5
|
+
export declare const ReleaseCreditReservationResponse: core.serialization.ObjectSchema<serializers.ReleaseCreditReservationResponse.Raw, Schematic.ReleaseCreditReservationResponse>;
|
|
6
|
+
export declare namespace ReleaseCreditReservationResponse {
|
|
7
|
+
interface Raw {
|
|
8
|
+
data: CreditReservationResponseData.Raw;
|
|
9
|
+
params: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as Schematic from "../../../../api/index";
|
|
2
|
+
import * as core from "../../../../core";
|
|
3
|
+
import type * as serializers from "../../../index";
|
|
4
|
+
import { CreditReservationResponseData } from "../../../types/CreditReservationResponseData";
|
|
5
|
+
export declare const ReserveCreditsResponse: core.serialization.ObjectSchema<serializers.ReserveCreditsResponse.Raw, Schematic.ReserveCreditsResponse>;
|
|
6
|
+
export declare namespace ReserveCreditsResponse {
|
|
7
|
+
interface Raw {
|
|
8
|
+
data: CreditReservationResponseData.Raw;
|
|
9
|
+
params: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -44,6 +44,8 @@ export * from "./ListCreditSpendPoliciesResponse";
|
|
|
44
44
|
export * from "./ListGrantsForCreditParams";
|
|
45
45
|
export * from "./ListGrantsForCreditResponse";
|
|
46
46
|
export * from "./ReleaseCreditLeaseResponse";
|
|
47
|
+
export * from "./ReleaseCreditReservationResponse";
|
|
48
|
+
export * from "./ReserveCreditsResponse";
|
|
47
49
|
export * from "./SoftDeleteBillingCreditResponse";
|
|
48
50
|
export * from "./UpdateBillingCreditResponse";
|
|
49
51
|
export * from "./UpdateBillingPlanCreditGrantResponse";
|
package/dist/serialization/resources/features/client/requests/CheckAndReserveFlagRequestBody.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as Schematic from "../../../../../api/index";
|
|
2
|
+
import * as core from "../../../../../core";
|
|
3
|
+
import type * as serializers from "../../../../index";
|
|
4
|
+
import { PreflightRequestBody } from "../../../../types/PreflightRequestBody";
|
|
5
|
+
export declare const CheckAndReserveFlagRequestBody: core.serialization.Schema<serializers.CheckAndReserveFlagRequestBody.Raw, Schematic.CheckAndReserveFlagRequestBody>;
|
|
6
|
+
export declare namespace CheckAndReserveFlagRequestBody {
|
|
7
|
+
interface Raw {
|
|
8
|
+
company?: Record<string, string> | null;
|
|
9
|
+
expires_at?: string | null;
|
|
10
|
+
preflight?: PreflightRequestBody.Raw | null;
|
|
11
|
+
quantity?: number | null;
|
|
12
|
+
user?: Record<string, string> | null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { CheckAndReserveFlagRequestBody } from "./CheckAndReserveFlagRequestBody";
|
|
1
2
|
export { CheckFlagsBulkRequestBody } from "./CheckFlagsBulkRequestBody";
|
|
2
3
|
export { CreateBillingLinkedFeatureRequestBody } from "./CreateBillingLinkedFeatureRequestBody";
|
|
3
4
|
export { CreateFeatureRequestBody } from "./CreateFeatureRequestBody";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as Schematic from "../../../../api/index";
|
|
2
|
+
import * as core from "../../../../core";
|
|
3
|
+
import type * as serializers from "../../../index";
|
|
4
|
+
import { CheckAndReserveFlagResponseData } from "../../../types/CheckAndReserveFlagResponseData";
|
|
5
|
+
export declare const CheckAndReserveFlagResponse: core.serialization.ObjectSchema<serializers.CheckAndReserveFlagResponse.Raw, Schematic.CheckAndReserveFlagResponse>;
|
|
6
|
+
export declare namespace CheckAndReserveFlagResponse {
|
|
7
|
+
interface Raw {
|
|
8
|
+
data: CheckAndReserveFlagResponseData.Raw;
|
|
9
|
+
params: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -5,6 +5,7 @@ import { PlanVersionMigrationStatus } from "../../../types/PlanVersionMigrationS
|
|
|
5
5
|
export declare const CountMigrationsParams: core.serialization.ObjectSchema<serializers.CountMigrationsParams.Raw, Schematic.CountMigrationsParams>;
|
|
6
6
|
export declare namespace CountMigrationsParams {
|
|
7
7
|
interface Raw {
|
|
8
|
+
feature_id?: string | null;
|
|
8
9
|
limit?: number | null;
|
|
9
10
|
offset?: number | null;
|
|
10
11
|
plan_version_id?: string | null;
|
|
@@ -5,6 +5,7 @@ import { PlanVersionMigrationStatus } from "../../../types/PlanVersionMigrationS
|
|
|
5
5
|
export declare const ListMigrationsParams: core.serialization.ObjectSchema<serializers.ListMigrationsParams.Raw, Schematic.ListMigrationsParams>;
|
|
6
6
|
export declare namespace ListMigrationsParams {
|
|
7
7
|
interface Raw {
|
|
8
|
+
feature_id?: string | null;
|
|
8
9
|
limit?: number | null;
|
|
9
10
|
offset?: number | null;
|
|
10
11
|
plan_version_id?: string | null;
|
|
@@ -21,7 +21,9 @@ export declare namespace CountPlansParams {
|
|
|
21
21
|
q?: string | null;
|
|
22
22
|
scoped_to_company_id?: string | null;
|
|
23
23
|
with_entitlements?: boolean | null;
|
|
24
|
+
with_published_version?: boolean | null;
|
|
24
25
|
without_entitlement_for?: string | null;
|
|
26
|
+
without_entitlement_for_include_drafts?: boolean | null;
|
|
25
27
|
without_paid_product_id?: boolean | null;
|
|
26
28
|
}
|
|
27
29
|
}
|
|
@@ -21,7 +21,9 @@ export declare namespace ListPlansParams {
|
|
|
21
21
|
q?: string | null;
|
|
22
22
|
scoped_to_company_id?: string | null;
|
|
23
23
|
with_entitlements?: boolean | null;
|
|
24
|
+
with_published_version?: boolean | null;
|
|
24
25
|
without_entitlement_for?: string | null;
|
|
26
|
+
without_entitlement_for_include_drafts?: boolean | null;
|
|
25
27
|
without_paid_product_id?: boolean | null;
|
|
26
28
|
}
|
|
27
29
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type * as Schematic from "../../api/index";
|
|
2
|
+
import * as core from "../../core";
|
|
3
|
+
import type * as serializers from "../index";
|
|
4
|
+
import { FeatureEntitlement } from "./FeatureEntitlement";
|
|
5
|
+
import { FlagCheckReservationResponseData } from "./FlagCheckReservationResponseData";
|
|
6
|
+
import { MetricPeriod } from "./MetricPeriod";
|
|
7
|
+
import { RuleType } from "./RuleType";
|
|
8
|
+
export declare const CheckAndReserveFlagResponseData: core.serialization.ObjectSchema<serializers.CheckAndReserveFlagResponseData.Raw, Schematic.CheckAndReserveFlagResponseData>;
|
|
9
|
+
export declare namespace CheckAndReserveFlagResponseData {
|
|
10
|
+
interface Raw {
|
|
11
|
+
company_id?: string | null;
|
|
12
|
+
entitlement?: FeatureEntitlement.Raw | null;
|
|
13
|
+
error?: string | null;
|
|
14
|
+
feature_allocation?: number | null;
|
|
15
|
+
feature_usage?: number | null;
|
|
16
|
+
feature_usage_event?: string | null;
|
|
17
|
+
feature_usage_period?: MetricPeriod.Raw | null;
|
|
18
|
+
feature_usage_reset_at?: string | null;
|
|
19
|
+
flag: string;
|
|
20
|
+
flag_id?: string | null;
|
|
21
|
+
reason: string;
|
|
22
|
+
reservation?: FlagCheckReservationResponseData.Raw | null;
|
|
23
|
+
rule_id?: string | null;
|
|
24
|
+
rule_type?: RuleType.Raw | null;
|
|
25
|
+
user_id?: string | null;
|
|
26
|
+
value: boolean;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type * as Schematic from "../../api/index";
|
|
2
|
+
import * as core from "../../core";
|
|
3
|
+
import type * as serializers from "../index";
|
|
4
|
+
export declare const CreditReservationResponseData: core.serialization.ObjectSchema<serializers.CreditReservationResponseData.Raw, Schematic.CreditReservationResponseData>;
|
|
5
|
+
export declare namespace CreditReservationResponseData {
|
|
6
|
+
interface Raw {
|
|
7
|
+
company_id: string;
|
|
8
|
+
created_at: string;
|
|
9
|
+
credit_type_id: string;
|
|
10
|
+
expires_at: string;
|
|
11
|
+
id: string;
|
|
12
|
+
released_at?: string | null;
|
|
13
|
+
reserved_amount: number;
|
|
14
|
+
settled_amount: number;
|
|
15
|
+
updated_at: string;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -3,5 +3,5 @@ import * as core from "../../core";
|
|
|
3
3
|
import type * as serializers from "../index";
|
|
4
4
|
export declare const CreditUsageReason: core.serialization.Schema<serializers.CreditUsageReason.Raw, Schematic.CreditUsageReason>;
|
|
5
5
|
export declare namespace CreditUsageReason {
|
|
6
|
-
type Raw = "lease_hold" | "lease_release" | "manual_adjustment" | "reconciliation" | "track";
|
|
6
|
+
type Raw = "lease_hold" | "lease_release" | "manual_adjustment" | "reconciliation" | "reservation_hold" | "reservation_release" | "track";
|
|
7
7
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type * as Schematic from "../../api/index";
|
|
2
|
+
import * as core from "../../core";
|
|
3
|
+
import type * as serializers from "../index";
|
|
4
|
+
export declare const FlagCheckReservationResponseData: core.serialization.ObjectSchema<serializers.FlagCheckReservationResponseData.Raw, Schematic.FlagCheckReservationResponseData>;
|
|
5
|
+
export declare namespace FlagCheckReservationResponseData {
|
|
6
|
+
interface Raw {
|
|
7
|
+
company_id: string;
|
|
8
|
+
consumption_rate: number;
|
|
9
|
+
credit_type_id: string;
|
|
10
|
+
credits_reserved: number;
|
|
11
|
+
event_subtype?: string | null;
|
|
12
|
+
expires_at: string;
|
|
13
|
+
id: string;
|
|
14
|
+
quantity_reserved: number;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -12,6 +12,8 @@ export declare namespace PlanVersionMigrationResponseData {
|
|
|
12
12
|
created_at: string;
|
|
13
13
|
error?: string | null;
|
|
14
14
|
failed_companies: number;
|
|
15
|
+
feature_id?: string | null;
|
|
16
|
+
feature_plan_rollout_id?: string | null;
|
|
15
17
|
id: string;
|
|
16
18
|
next_due_at?: string | null;
|
|
17
19
|
plan_id: string;
|
|
@@ -79,6 +79,7 @@ export * from "./CatalogResponseData";
|
|
|
79
79
|
export * from "./ChangeSubscriptionInternalRequestBody";
|
|
80
80
|
export * from "./ChangeSubscriptionRequestBody";
|
|
81
81
|
export * from "./ChargeType";
|
|
82
|
+
export * from "./CheckAndReserveFlagResponseData";
|
|
82
83
|
export * from "./CheckFlagRequestBody";
|
|
83
84
|
export * from "./CheckFlagResponseData";
|
|
84
85
|
export * from "./CheckFlagsBulkResponseData";
|
|
@@ -169,6 +170,7 @@ export * from "./CreditGrantDetail";
|
|
|
169
170
|
export * from "./CreditGrantExpiryRequestBody";
|
|
170
171
|
export * from "./CreditGrantSortOrder";
|
|
171
172
|
export * from "./CreditLeaseResponseData";
|
|
173
|
+
export * from "./CreditReservationResponseData";
|
|
172
174
|
export * from "./CreditSpendPolicyResponseData";
|
|
173
175
|
export * from "./CreditSpendPolicyScope";
|
|
174
176
|
export * from "./CreditsAutoTopupCompanySummary";
|
|
@@ -251,6 +253,7 @@ export * from "./FeatureUsageLegacyResponseData";
|
|
|
251
253
|
export * from "./FeatureUsageResponseData";
|
|
252
254
|
export * from "./FeatureUsageTimeSeriesResponseData";
|
|
253
255
|
export * from "./FeatureView";
|
|
256
|
+
export * from "./FlagCheckReservationResponseData";
|
|
254
257
|
export * from "./FlagDetailResponseData";
|
|
255
258
|
export * from "./FlagInPlanResponseData";
|
|
256
259
|
export * from "./FlagResponseData";
|
|
@@ -360,7 +363,6 @@ export * from "./PublicPlansResponseData";
|
|
|
360
363
|
export * from "./QuickstartResp";
|
|
361
364
|
export * from "./RawEventBatchResponseData";
|
|
362
365
|
export * from "./RawEventResponseData";
|
|
363
|
-
export * from "./ReleaseCreditLeaseRequestBody";
|
|
364
366
|
export * from "./Rule";
|
|
365
367
|
export * from "./RuleConditionDetailResponseData";
|
|
366
368
|
export * from "./RuleConditionGroupDetailResponseData";
|
package/dist/wrapper.d.ts
CHANGED
|
@@ -55,12 +55,14 @@ export interface SchematicOptions {
|
|
|
55
55
|
/** The default maximum time to wait for a response in milliseconds */
|
|
56
56
|
timeoutMs?: number;
|
|
57
57
|
/**
|
|
58
|
-
* Enable
|
|
59
|
-
*
|
|
58
|
+
* Enable credit reservation behavior on `check` / `trackWithReservation`.
|
|
59
|
+
* Omit to keep the SDK credit-unaware.
|
|
60
60
|
*
|
|
61
|
-
*
|
|
62
|
-
* SDK has
|
|
63
|
-
*
|
|
61
|
+
* Client mode (local leases) requires DataStream (or replicator mode) so
|
|
62
|
+
* the SDK has the cached flag + company state it needs to gate locally
|
|
63
|
+
* against the lease balance. Without DataStream the SDK gates in server
|
|
64
|
+
* mode instead — one `check-and-reserve` API call per check. See
|
|
65
|
+
* `CreditLeaseConfig.mode`.
|
|
64
66
|
*/
|
|
65
67
|
creditLeases?: CreditLeaseConfig;
|
|
66
68
|
}
|
|
@@ -145,6 +147,8 @@ export declare class SchematicClient extends BaseClient {
|
|
|
145
147
|
private reservations?;
|
|
146
148
|
private leaseBackendShared;
|
|
147
149
|
private prewarmResolveTimeoutMs;
|
|
150
|
+
private creditLeaseMode?;
|
|
151
|
+
private serverReservationTTL;
|
|
148
152
|
/**
|
|
149
153
|
* Creates a new instance of the SchematicClient
|
|
150
154
|
* @param opts - Configuration options for the client
|
|
@@ -154,6 +158,23 @@ export declare class SchematicClient extends BaseClient {
|
|
|
154
158
|
* Returns whether DataStream is enabled and available
|
|
155
159
|
*/
|
|
156
160
|
private useDataStream;
|
|
161
|
+
/**
|
|
162
|
+
* Whether the configured mode wants the local lease plumbing (stores,
|
|
163
|
+
* manager, sweeper). Read during construction, after the DataStream client
|
|
164
|
+
* has been wired, so `auto` can resolve against it.
|
|
165
|
+
*/
|
|
166
|
+
private creditLeaseModeUsesLeases;
|
|
167
|
+
/**
|
|
168
|
+
* Which reservation mode a `check()` with `usage` resolves to right now.
|
|
169
|
+
* `undefined` means no credit gating at all — `creditLeases` isn't
|
|
170
|
+
* configured, or the client is offline.
|
|
171
|
+
*
|
|
172
|
+
* `auto` is resolved per check rather than once at startup so a DataStream
|
|
173
|
+
* that failed to start after construction (its `start()` rejection clears
|
|
174
|
+
* `datastreamClient`) falls to server mode instead of silently dropping
|
|
175
|
+
* every check to a plain, ungated flag check.
|
|
176
|
+
*/
|
|
177
|
+
private effectiveLeaseMode;
|
|
157
178
|
/**
|
|
158
179
|
* Checks the value of a feature flag for the given evaluation context
|
|
159
180
|
* @param evalCtx - The context (company and/or user) for evaluating the feature flag
|
|
@@ -232,11 +253,17 @@ export declare class SchematicClient extends BaseClient {
|
|
|
232
253
|
*/
|
|
233
254
|
private resolveCompanyIdWithWait;
|
|
234
255
|
/**
|
|
235
|
-
*
|
|
256
|
+
* Credit-aware feature check. When `creditLeases` is configured and the
|
|
236
257
|
* caller passes `usage` (optionally qualified by `eventSubtype`), this
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
258
|
+
* gates the check against the company's credit balance and returns a
|
|
259
|
+
* reservation handle on success — pass that handle to
|
|
260
|
+
* `trackWithReservation` when the work completes.
|
|
261
|
+
*
|
|
262
|
+
* In client mode (DataStream enabled) the hold is carved out of a local
|
|
263
|
+
* lease and the flag is evaluated by the WASM engine. In server mode it is
|
|
264
|
+
* a single `check-and-reserve` API call that evaluates the flag and takes
|
|
265
|
+
* the hold server-side. `creditLeases.mode` picks; the default (`auto`)
|
|
266
|
+
* uses client mode when DataStream is enabled and server mode otherwise.
|
|
240
267
|
*
|
|
241
268
|
* When `creditLeases` is not configured (or `usage` is omitted) this falls
|
|
242
269
|
* through to a plain flag check and returns `{allowed: value}` with no
|
|
@@ -255,6 +282,10 @@ export declare class SchematicClient extends BaseClient {
|
|
|
255
282
|
* `actualQuantity × consumption_rate` from the company's real credit
|
|
256
283
|
* balance.
|
|
257
284
|
*
|
|
285
|
+
* A server-mode handle has no local hold to refund: the Track event carries
|
|
286
|
+
* the reservation id, and the server settles the hold (refunding the
|
|
287
|
+
* unspent slice) when it processes the event.
|
|
288
|
+
*
|
|
258
289
|
* If the work outlived the reservation's TTL and the sweeper already
|
|
259
290
|
* returned the hold to the lease, the local refund has happened but the
|
|
260
291
|
* usage must still be billed — so we emit the Track anyway (a "recovery"
|
|
@@ -269,7 +300,7 @@ export declare class SchematicClient extends BaseClient {
|
|
|
269
300
|
* accidental second `trackWithReservation`, collapses to a single billed
|
|
270
301
|
* event — across pods and process restarts, not just within one process.
|
|
271
302
|
*/
|
|
272
|
-
trackWithReservation(reservation: Reservation, actualQuantity: number, options?: TrackWithReservationOptions): Promise<void>;
|
|
303
|
+
trackWithReservation(reservation: Reservation | undefined, actualQuantity: number, options?: TrackWithReservationOptions): Promise<void>;
|
|
273
304
|
private resolveCompanyId;
|
|
274
305
|
/**
|
|
275
306
|
* Send a non-blocking event to create or update companies and users.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schematichq/schematic-typescript-node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -57,12 +57,20 @@
|
|
|
57
57
|
"crypto": false,
|
|
58
58
|
"timers": false
|
|
59
59
|
},
|
|
60
|
+
"resolutions": {
|
|
61
|
+
"sharp": "^0.35.4",
|
|
62
|
+
"undici": "7.29.0"
|
|
63
|
+
},
|
|
60
64
|
"packageManager": "yarn@1.22.22",
|
|
61
65
|
"engines": {
|
|
62
66
|
"node": ">=18.0.0"
|
|
63
67
|
},
|
|
64
68
|
"sideEffects": false,
|
|
65
69
|
"license": "MIT",
|
|
70
|
+
"resolutions": {
|
|
71
|
+
"sharp": "^0.35.4",
|
|
72
|
+
"undici": "7.29.0"
|
|
73
|
+
},
|
|
66
74
|
"files": [
|
|
67
75
|
"dist/**/*.js",
|
|
68
76
|
"dist/**/*.d.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ReleaseCreditLeaseRequestBody = Record<string, unknown>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type * as Schematic from "../../api/index";
|
|
2
|
-
import * as core from "../../core";
|
|
3
|
-
import type * as serializers from "../index";
|
|
4
|
-
export declare const ReleaseCreditLeaseRequestBody: core.serialization.Schema<serializers.ReleaseCreditLeaseRequestBody.Raw, Schematic.ReleaseCreditLeaseRequestBody>;
|
|
5
|
-
export declare namespace ReleaseCreditLeaseRequestBody {
|
|
6
|
-
type Raw = Record<string, unknown>;
|
|
7
|
-
}
|