@clocknext/sdk 0.19.0 → 0.19.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 +28 -0
- package/dist/index.cjs +22 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +113 -1
- package/dist/index.d.ts +113 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/resources/signals.ts +23 -0
- package/src/types.ts +77 -0
package/dist/index.d.cts
CHANGED
|
@@ -451,6 +451,104 @@ interface UsageLogPage {
|
|
|
451
451
|
* page. */
|
|
452
452
|
nextCursor: string | null;
|
|
453
453
|
}
|
|
454
|
+
/** What a {@link UsageLogLookupEntry} row is. `"outcome"` is one step of a
|
|
455
|
+
* run; `"outcome_completion"` and `"composite_completion"` are the finished
|
|
456
|
+
* runs themselves. */
|
|
457
|
+
type UsageLogLookupEntitlementType = "credit" | "outcome" | "outcome_completion" | "unit" | "composite_completion" | "wallet";
|
|
458
|
+
/**
|
|
459
|
+
* One row of `signals.lookupUsageLogs()`. Only the group that matches
|
|
460
|
+
* `entitlement.type` holds data; the others are `null`.
|
|
461
|
+
*/
|
|
462
|
+
interface UsageLogLookupEntry {
|
|
463
|
+
id: string;
|
|
464
|
+
/** The customer this row belongs to — a lookup can span customers. */
|
|
465
|
+
customerId: string;
|
|
466
|
+
/** For a finished run (`outcome_completion`, `composite_completion`), when
|
|
467
|
+
* it completed. */
|
|
468
|
+
createdAt: string;
|
|
469
|
+
status: SignalStatus;
|
|
470
|
+
/** The credit / outcome / unit / composite this row is for. A wallet row has
|
|
471
|
+
* `id: null` and `name: "Wallet"`. */
|
|
472
|
+
entitlement: {
|
|
473
|
+
type: UsageLogLookupEntitlementType;
|
|
474
|
+
id: string | null;
|
|
475
|
+
name: string | null;
|
|
476
|
+
};
|
|
477
|
+
member: string | null;
|
|
478
|
+
model: {
|
|
479
|
+
name: string | null;
|
|
480
|
+
provider: string | null;
|
|
481
|
+
} | null;
|
|
482
|
+
usage: {
|
|
483
|
+
inputTokens: number;
|
|
484
|
+
outputTokens: number;
|
|
485
|
+
/** Cache-read tokens. */
|
|
486
|
+
cacheTokens: number;
|
|
487
|
+
/** Cache-write tokens, priced separately from cache reads. */
|
|
488
|
+
cacheWriteTokens: number;
|
|
489
|
+
};
|
|
490
|
+
/** Formatted USD strings. `customerCost` is what this row charged:
|
|
491
|
+
* `"$0.00"` on an outcome step (the run is billed at completion) and on any
|
|
492
|
+
* row a composite pays for. On a unit row it is what the wallet paid for
|
|
493
|
+
* that report (debits minus refunds), `"$0.00"` when the wallet paid
|
|
494
|
+
* nothing. */
|
|
495
|
+
cost: {
|
|
496
|
+
providedCost: string;
|
|
497
|
+
customerCost: string;
|
|
498
|
+
};
|
|
499
|
+
/** `entitlement.type === "credit"`. */
|
|
500
|
+
credit: {
|
|
501
|
+
amount: string;
|
|
502
|
+
appliedRules: UsageLogAppliedRule[];
|
|
503
|
+
} | null;
|
|
504
|
+
/** `entitlement.type === "outcome"`. `runCompleted` is true once the run is
|
|
505
|
+
* finished — on every step row of that run. */
|
|
506
|
+
outcome: {
|
|
507
|
+
step: string | null;
|
|
508
|
+
stepName: string | null;
|
|
509
|
+
runId: string | null;
|
|
510
|
+
runCompleted: boolean;
|
|
511
|
+
} | null;
|
|
512
|
+
/** `entitlement.type === "outcome_completion"`. `amount` is the price frozen
|
|
513
|
+
* when the run completed. */
|
|
514
|
+
outcomeCompletion: {
|
|
515
|
+
runId: string | null;
|
|
516
|
+
amount: string;
|
|
517
|
+
} | null;
|
|
518
|
+
/** `entitlement.type === "unit"`. `quantity` is formatted. */
|
|
519
|
+
unit: {
|
|
520
|
+
quantity: string;
|
|
521
|
+
} | null;
|
|
522
|
+
/** `entitlement.type === "composite_completion"`. `refId` is the
|
|
523
|
+
* composite's tag key, `runId` the tag value you sent. */
|
|
524
|
+
compositeCompletion: {
|
|
525
|
+
refId: string | null;
|
|
526
|
+
runId: string | null;
|
|
527
|
+
amount: string;
|
|
528
|
+
startedAt: string;
|
|
529
|
+
} | null;
|
|
530
|
+
/** `entitlement.type === "wallet"`. What the wallet paid, formatted USD —
|
|
531
|
+
* the same value as `cost.customerCost`. */
|
|
532
|
+
wallet: {
|
|
533
|
+
amount: string;
|
|
534
|
+
} | null;
|
|
535
|
+
/** The composite that pays for this row — its id, its tag key (`refId`) and
|
|
536
|
+
* the tag value you sent (`runId`). `null` when the row is billed by
|
|
537
|
+
* itself. */
|
|
538
|
+
composite: {
|
|
539
|
+
id: string | null;
|
|
540
|
+
refId: string | null;
|
|
541
|
+
runId: string | null;
|
|
542
|
+
} | null;
|
|
543
|
+
/** The `custom` object sent, as sent. `null` when none was sent. */
|
|
544
|
+
custom: Record<string, unknown> | null;
|
|
545
|
+
}
|
|
546
|
+
interface UsageLogLookupResult {
|
|
547
|
+
/** The rows found, in the order of the ids you asked for. */
|
|
548
|
+
usageLogs: UsageLogLookupEntry[];
|
|
549
|
+
/** The ids that matched nothing in your org, in the order you asked. */
|
|
550
|
+
notFound: string[];
|
|
551
|
+
}
|
|
454
552
|
interface ApiCustomer {
|
|
455
553
|
id: string;
|
|
456
554
|
/** Your own id for this customer, or `null` when unset. See
|
|
@@ -2324,6 +2422,20 @@ declare class Signals {
|
|
|
2324
2422
|
* buffer or retry here.
|
|
2325
2423
|
*/
|
|
2326
2424
|
usageLog(params: UsageLogListParams): Promise<UsageLogPage>;
|
|
2425
|
+
/**
|
|
2426
|
+
* Fetches up to 100 usage-log rows by id, in one call.
|
|
2427
|
+
* `GET /api/v1/signal/usage-log/lookup`.
|
|
2428
|
+
*
|
|
2429
|
+
* Built for linking a wallet debit to its usage: pass the `usageLogId`s
|
|
2430
|
+
* from `customers.wallet()` instead of paging through
|
|
2431
|
+
* {@link usageLog}. Scoped to your org, not to one customer — every row
|
|
2432
|
+
* carries its own `customerId`.
|
|
2433
|
+
*
|
|
2434
|
+
* Rows come back in the order of `ids`; duplicates are removed. Ids that
|
|
2435
|
+
* match nothing in your org are listed in `notFound`. More than 100
|
|
2436
|
+
* distinct ids is a 400.
|
|
2437
|
+
*/
|
|
2438
|
+
lookupUsageLogs(ids: string[]): Promise<UsageLogLookupResult>;
|
|
2327
2439
|
}
|
|
2328
2440
|
|
|
2329
2441
|
/**
|
|
@@ -2512,4 +2624,4 @@ declare class NetworkError extends ClockNextError {
|
|
|
2512
2624
|
});
|
|
2513
2625
|
}
|
|
2514
2626
|
|
|
2515
|
-
export { type AddMemberInput, type AdjustResult, AllowanceError, type ApiCustomer, AuthError, type BillingCycle, type BillingMode, ClockNext, type ClockNextConfig, ClockNextError, type ClockNextErrorCode, type ComponentType, type Composite, type CompositeAdjustInput, type CompositeBalance, type CompositeCompletionInput, type CompositeCompletionResult, type CompositeItem, type CompositeTag, ConflictError, type CreateCompositeInput, type CreateCreditInput, type CreateCustomerInput, type CreateOutcomeInput, type CreatePlanInput, type CreatePurchaseInput, type CreateTaxInput, type CreateUnitInput, type Credit, type CreditAdjustInput, type CreditBalance, type CreditInput, type CreditSignal, type CustomerBalances, type CustomerList, type CustomerPlan, type CustomerPlanDetails, type CustomerProfileInput, type CustomerRef, type DropReason, type FetchLike, ForbiddenError, type Invoice, type InvoiceDetail, type InvoiceLineItem, type InvoiceListRow, type InvoiceParty, type InvoicePlanSnapshot, type InvoiceStatus, type Logger, type Member, type MemberProfile, type ModelBundleLine, type ModelBundleLineInput, NetworkError, NotFoundError, type Outcome, type OutcomeAdjustInput, type OutcomeBalance, type OutcomeCompletionInput, type OutcomeCompletionResult, type OutcomeInput, type OutcomeSignal, type OutcomeStep, type OutcomeStepInput, type OutcomeWithSteps, type PayLink, type PaymentDetail, type PaymentRow, type Plan, type PlanComponent, type PlanEntitlement, type PlanEntitlementInput, PlanError, type PlanKind, type PlanRef, type PlanType, type PortalToken, type PortalTokenInput, type Purchase, type PurchaseDetail, type PurchaseStatus, RateLimitError, type RecurringGrantInput, type RecurringGrantResult, type RemovedMember, type SerializedOutcomeAttribution, type SerializedRuleApplication, type SerializedUnitUsage, type SerializedUsageLog, ServerError, type Signal, type SignalDelivery, type SignalStatus, type SignalType, type Tax, type TaxBehavior, type Tokens, type TrackResult, type Unit, type UnitAdjustInput, type UnitBalance, type UnitInput, type UnitPricingType, type UnitTier, type UnitTrackResult, type UpdateCompositeInput, type UpdateCreditInput, type UpdateMemberInput, type UpdateOutcomeInput, type UpdatePlanInput, type UpdateTaxInput, type UpdateUnitInput, type UsageBalance, type UsageLogAppliedRule, type UsageLogEntry, type UsageLogListParams, type UsageLogOutcomeAttribution, type UsageLogPage, ValidationError, type WalletAdjustInput, type WalletInput, type WalletLedgerPage, type WalletLedgerParams, type WalletPool, type WalletSignal, type WalletTransaction, type WalletTransactionSource, signalToWire };
|
|
2627
|
+
export { type AddMemberInput, type AdjustResult, AllowanceError, type ApiCustomer, AuthError, type BillingCycle, type BillingMode, ClockNext, type ClockNextConfig, ClockNextError, type ClockNextErrorCode, type ComponentType, type Composite, type CompositeAdjustInput, type CompositeBalance, type CompositeCompletionInput, type CompositeCompletionResult, type CompositeItem, type CompositeTag, ConflictError, type CreateCompositeInput, type CreateCreditInput, type CreateCustomerInput, type CreateOutcomeInput, type CreatePlanInput, type CreatePurchaseInput, type CreateTaxInput, type CreateUnitInput, type Credit, type CreditAdjustInput, type CreditBalance, type CreditInput, type CreditSignal, type CustomerBalances, type CustomerList, type CustomerPlan, type CustomerPlanDetails, type CustomerProfileInput, type CustomerRef, type DropReason, type FetchLike, ForbiddenError, type Invoice, type InvoiceDetail, type InvoiceLineItem, type InvoiceListRow, type InvoiceParty, type InvoicePlanSnapshot, type InvoiceStatus, type Logger, type Member, type MemberProfile, type ModelBundleLine, type ModelBundleLineInput, NetworkError, NotFoundError, type Outcome, type OutcomeAdjustInput, type OutcomeBalance, type OutcomeCompletionInput, type OutcomeCompletionResult, type OutcomeInput, type OutcomeSignal, type OutcomeStep, type OutcomeStepInput, type OutcomeWithSteps, type PayLink, type PaymentDetail, type PaymentRow, type Plan, type PlanComponent, type PlanEntitlement, type PlanEntitlementInput, PlanError, type PlanKind, type PlanRef, type PlanType, type PortalToken, type PortalTokenInput, type Purchase, type PurchaseDetail, type PurchaseStatus, RateLimitError, type RecurringGrantInput, type RecurringGrantResult, type RemovedMember, type SerializedOutcomeAttribution, type SerializedRuleApplication, type SerializedUnitUsage, type SerializedUsageLog, ServerError, type Signal, type SignalDelivery, type SignalStatus, type SignalType, type Tax, type TaxBehavior, type Tokens, type TrackResult, type Unit, type UnitAdjustInput, type UnitBalance, type UnitInput, type UnitPricingType, type UnitTier, type UnitTrackResult, type UpdateCompositeInput, type UpdateCreditInput, type UpdateMemberInput, type UpdateOutcomeInput, type UpdatePlanInput, type UpdateTaxInput, type UpdateUnitInput, type UsageBalance, type UsageLogAppliedRule, type UsageLogEntry, type UsageLogListParams, type UsageLogLookupEntitlementType, type UsageLogLookupEntry, type UsageLogLookupResult, type UsageLogOutcomeAttribution, type UsageLogPage, ValidationError, type WalletAdjustInput, type WalletInput, type WalletLedgerPage, type WalletLedgerParams, type WalletPool, type WalletSignal, type WalletTransaction, type WalletTransactionSource, signalToWire };
|
package/dist/index.d.ts
CHANGED
|
@@ -451,6 +451,104 @@ interface UsageLogPage {
|
|
|
451
451
|
* page. */
|
|
452
452
|
nextCursor: string | null;
|
|
453
453
|
}
|
|
454
|
+
/** What a {@link UsageLogLookupEntry} row is. `"outcome"` is one step of a
|
|
455
|
+
* run; `"outcome_completion"` and `"composite_completion"` are the finished
|
|
456
|
+
* runs themselves. */
|
|
457
|
+
type UsageLogLookupEntitlementType = "credit" | "outcome" | "outcome_completion" | "unit" | "composite_completion" | "wallet";
|
|
458
|
+
/**
|
|
459
|
+
* One row of `signals.lookupUsageLogs()`. Only the group that matches
|
|
460
|
+
* `entitlement.type` holds data; the others are `null`.
|
|
461
|
+
*/
|
|
462
|
+
interface UsageLogLookupEntry {
|
|
463
|
+
id: string;
|
|
464
|
+
/** The customer this row belongs to — a lookup can span customers. */
|
|
465
|
+
customerId: string;
|
|
466
|
+
/** For a finished run (`outcome_completion`, `composite_completion`), when
|
|
467
|
+
* it completed. */
|
|
468
|
+
createdAt: string;
|
|
469
|
+
status: SignalStatus;
|
|
470
|
+
/** The credit / outcome / unit / composite this row is for. A wallet row has
|
|
471
|
+
* `id: null` and `name: "Wallet"`. */
|
|
472
|
+
entitlement: {
|
|
473
|
+
type: UsageLogLookupEntitlementType;
|
|
474
|
+
id: string | null;
|
|
475
|
+
name: string | null;
|
|
476
|
+
};
|
|
477
|
+
member: string | null;
|
|
478
|
+
model: {
|
|
479
|
+
name: string | null;
|
|
480
|
+
provider: string | null;
|
|
481
|
+
} | null;
|
|
482
|
+
usage: {
|
|
483
|
+
inputTokens: number;
|
|
484
|
+
outputTokens: number;
|
|
485
|
+
/** Cache-read tokens. */
|
|
486
|
+
cacheTokens: number;
|
|
487
|
+
/** Cache-write tokens, priced separately from cache reads. */
|
|
488
|
+
cacheWriteTokens: number;
|
|
489
|
+
};
|
|
490
|
+
/** Formatted USD strings. `customerCost` is what this row charged:
|
|
491
|
+
* `"$0.00"` on an outcome step (the run is billed at completion) and on any
|
|
492
|
+
* row a composite pays for. On a unit row it is what the wallet paid for
|
|
493
|
+
* that report (debits minus refunds), `"$0.00"` when the wallet paid
|
|
494
|
+
* nothing. */
|
|
495
|
+
cost: {
|
|
496
|
+
providedCost: string;
|
|
497
|
+
customerCost: string;
|
|
498
|
+
};
|
|
499
|
+
/** `entitlement.type === "credit"`. */
|
|
500
|
+
credit: {
|
|
501
|
+
amount: string;
|
|
502
|
+
appliedRules: UsageLogAppliedRule[];
|
|
503
|
+
} | null;
|
|
504
|
+
/** `entitlement.type === "outcome"`. `runCompleted` is true once the run is
|
|
505
|
+
* finished — on every step row of that run. */
|
|
506
|
+
outcome: {
|
|
507
|
+
step: string | null;
|
|
508
|
+
stepName: string | null;
|
|
509
|
+
runId: string | null;
|
|
510
|
+
runCompleted: boolean;
|
|
511
|
+
} | null;
|
|
512
|
+
/** `entitlement.type === "outcome_completion"`. `amount` is the price frozen
|
|
513
|
+
* when the run completed. */
|
|
514
|
+
outcomeCompletion: {
|
|
515
|
+
runId: string | null;
|
|
516
|
+
amount: string;
|
|
517
|
+
} | null;
|
|
518
|
+
/** `entitlement.type === "unit"`. `quantity` is formatted. */
|
|
519
|
+
unit: {
|
|
520
|
+
quantity: string;
|
|
521
|
+
} | null;
|
|
522
|
+
/** `entitlement.type === "composite_completion"`. `refId` is the
|
|
523
|
+
* composite's tag key, `runId` the tag value you sent. */
|
|
524
|
+
compositeCompletion: {
|
|
525
|
+
refId: string | null;
|
|
526
|
+
runId: string | null;
|
|
527
|
+
amount: string;
|
|
528
|
+
startedAt: string;
|
|
529
|
+
} | null;
|
|
530
|
+
/** `entitlement.type === "wallet"`. What the wallet paid, formatted USD —
|
|
531
|
+
* the same value as `cost.customerCost`. */
|
|
532
|
+
wallet: {
|
|
533
|
+
amount: string;
|
|
534
|
+
} | null;
|
|
535
|
+
/** The composite that pays for this row — its id, its tag key (`refId`) and
|
|
536
|
+
* the tag value you sent (`runId`). `null` when the row is billed by
|
|
537
|
+
* itself. */
|
|
538
|
+
composite: {
|
|
539
|
+
id: string | null;
|
|
540
|
+
refId: string | null;
|
|
541
|
+
runId: string | null;
|
|
542
|
+
} | null;
|
|
543
|
+
/** The `custom` object sent, as sent. `null` when none was sent. */
|
|
544
|
+
custom: Record<string, unknown> | null;
|
|
545
|
+
}
|
|
546
|
+
interface UsageLogLookupResult {
|
|
547
|
+
/** The rows found, in the order of the ids you asked for. */
|
|
548
|
+
usageLogs: UsageLogLookupEntry[];
|
|
549
|
+
/** The ids that matched nothing in your org, in the order you asked. */
|
|
550
|
+
notFound: string[];
|
|
551
|
+
}
|
|
454
552
|
interface ApiCustomer {
|
|
455
553
|
id: string;
|
|
456
554
|
/** Your own id for this customer, or `null` when unset. See
|
|
@@ -2324,6 +2422,20 @@ declare class Signals {
|
|
|
2324
2422
|
* buffer or retry here.
|
|
2325
2423
|
*/
|
|
2326
2424
|
usageLog(params: UsageLogListParams): Promise<UsageLogPage>;
|
|
2425
|
+
/**
|
|
2426
|
+
* Fetches up to 100 usage-log rows by id, in one call.
|
|
2427
|
+
* `GET /api/v1/signal/usage-log/lookup`.
|
|
2428
|
+
*
|
|
2429
|
+
* Built for linking a wallet debit to its usage: pass the `usageLogId`s
|
|
2430
|
+
* from `customers.wallet()` instead of paging through
|
|
2431
|
+
* {@link usageLog}. Scoped to your org, not to one customer — every row
|
|
2432
|
+
* carries its own `customerId`.
|
|
2433
|
+
*
|
|
2434
|
+
* Rows come back in the order of `ids`; duplicates are removed. Ids that
|
|
2435
|
+
* match nothing in your org are listed in `notFound`. More than 100
|
|
2436
|
+
* distinct ids is a 400.
|
|
2437
|
+
*/
|
|
2438
|
+
lookupUsageLogs(ids: string[]): Promise<UsageLogLookupResult>;
|
|
2327
2439
|
}
|
|
2328
2440
|
|
|
2329
2441
|
/**
|
|
@@ -2512,4 +2624,4 @@ declare class NetworkError extends ClockNextError {
|
|
|
2512
2624
|
});
|
|
2513
2625
|
}
|
|
2514
2626
|
|
|
2515
|
-
export { type AddMemberInput, type AdjustResult, AllowanceError, type ApiCustomer, AuthError, type BillingCycle, type BillingMode, ClockNext, type ClockNextConfig, ClockNextError, type ClockNextErrorCode, type ComponentType, type Composite, type CompositeAdjustInput, type CompositeBalance, type CompositeCompletionInput, type CompositeCompletionResult, type CompositeItem, type CompositeTag, ConflictError, type CreateCompositeInput, type CreateCreditInput, type CreateCustomerInput, type CreateOutcomeInput, type CreatePlanInput, type CreatePurchaseInput, type CreateTaxInput, type CreateUnitInput, type Credit, type CreditAdjustInput, type CreditBalance, type CreditInput, type CreditSignal, type CustomerBalances, type CustomerList, type CustomerPlan, type CustomerPlanDetails, type CustomerProfileInput, type CustomerRef, type DropReason, type FetchLike, ForbiddenError, type Invoice, type InvoiceDetail, type InvoiceLineItem, type InvoiceListRow, type InvoiceParty, type InvoicePlanSnapshot, type InvoiceStatus, type Logger, type Member, type MemberProfile, type ModelBundleLine, type ModelBundleLineInput, NetworkError, NotFoundError, type Outcome, type OutcomeAdjustInput, type OutcomeBalance, type OutcomeCompletionInput, type OutcomeCompletionResult, type OutcomeInput, type OutcomeSignal, type OutcomeStep, type OutcomeStepInput, type OutcomeWithSteps, type PayLink, type PaymentDetail, type PaymentRow, type Plan, type PlanComponent, type PlanEntitlement, type PlanEntitlementInput, PlanError, type PlanKind, type PlanRef, type PlanType, type PortalToken, type PortalTokenInput, type Purchase, type PurchaseDetail, type PurchaseStatus, RateLimitError, type RecurringGrantInput, type RecurringGrantResult, type RemovedMember, type SerializedOutcomeAttribution, type SerializedRuleApplication, type SerializedUnitUsage, type SerializedUsageLog, ServerError, type Signal, type SignalDelivery, type SignalStatus, type SignalType, type Tax, type TaxBehavior, type Tokens, type TrackResult, type Unit, type UnitAdjustInput, type UnitBalance, type UnitInput, type UnitPricingType, type UnitTier, type UnitTrackResult, type UpdateCompositeInput, type UpdateCreditInput, type UpdateMemberInput, type UpdateOutcomeInput, type UpdatePlanInput, type UpdateTaxInput, type UpdateUnitInput, type UsageBalance, type UsageLogAppliedRule, type UsageLogEntry, type UsageLogListParams, type UsageLogOutcomeAttribution, type UsageLogPage, ValidationError, type WalletAdjustInput, type WalletInput, type WalletLedgerPage, type WalletLedgerParams, type WalletPool, type WalletSignal, type WalletTransaction, type WalletTransactionSource, signalToWire };
|
|
2627
|
+
export { type AddMemberInput, type AdjustResult, AllowanceError, type ApiCustomer, AuthError, type BillingCycle, type BillingMode, ClockNext, type ClockNextConfig, ClockNextError, type ClockNextErrorCode, type ComponentType, type Composite, type CompositeAdjustInput, type CompositeBalance, type CompositeCompletionInput, type CompositeCompletionResult, type CompositeItem, type CompositeTag, ConflictError, type CreateCompositeInput, type CreateCreditInput, type CreateCustomerInput, type CreateOutcomeInput, type CreatePlanInput, type CreatePurchaseInput, type CreateTaxInput, type CreateUnitInput, type Credit, type CreditAdjustInput, type CreditBalance, type CreditInput, type CreditSignal, type CustomerBalances, type CustomerList, type CustomerPlan, type CustomerPlanDetails, type CustomerProfileInput, type CustomerRef, type DropReason, type FetchLike, ForbiddenError, type Invoice, type InvoiceDetail, type InvoiceLineItem, type InvoiceListRow, type InvoiceParty, type InvoicePlanSnapshot, type InvoiceStatus, type Logger, type Member, type MemberProfile, type ModelBundleLine, type ModelBundleLineInput, NetworkError, NotFoundError, type Outcome, type OutcomeAdjustInput, type OutcomeBalance, type OutcomeCompletionInput, type OutcomeCompletionResult, type OutcomeInput, type OutcomeSignal, type OutcomeStep, type OutcomeStepInput, type OutcomeWithSteps, type PayLink, type PaymentDetail, type PaymentRow, type Plan, type PlanComponent, type PlanEntitlement, type PlanEntitlementInput, PlanError, type PlanKind, type PlanRef, type PlanType, type PortalToken, type PortalTokenInput, type Purchase, type PurchaseDetail, type PurchaseStatus, RateLimitError, type RecurringGrantInput, type RecurringGrantResult, type RemovedMember, type SerializedOutcomeAttribution, type SerializedRuleApplication, type SerializedUnitUsage, type SerializedUsageLog, ServerError, type Signal, type SignalDelivery, type SignalStatus, type SignalType, type Tax, type TaxBehavior, type Tokens, type TrackResult, type Unit, type UnitAdjustInput, type UnitBalance, type UnitInput, type UnitPricingType, type UnitTier, type UnitTrackResult, type UpdateCompositeInput, type UpdateCreditInput, type UpdateMemberInput, type UpdateOutcomeInput, type UpdatePlanInput, type UpdateTaxInput, type UpdateUnitInput, type UsageBalance, type UsageLogAppliedRule, type UsageLogEntry, type UsageLogListParams, type UsageLogLookupEntitlementType, type UsageLogLookupEntry, type UsageLogLookupResult, type UsageLogOutcomeAttribution, type UsageLogPage, ValidationError, type WalletAdjustInput, type WalletInput, type WalletLedgerPage, type WalletLedgerParams, type WalletPool, type WalletSignal, type WalletTransaction, type WalletTransactionSource, signalToWire };
|
package/dist/index.js
CHANGED
|
@@ -331,7 +331,7 @@ function sleep(ms) {
|
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
// src/http.ts
|
|
334
|
-
var SDK_VERSION = "0.19.
|
|
334
|
+
var SDK_VERSION = "0.19.1" ;
|
|
335
335
|
var Transport = class {
|
|
336
336
|
constructor(cfg) {
|
|
337
337
|
this.cfg = cfg;
|
|
@@ -1226,6 +1226,7 @@ var UNIT_PATH = "/api/v1/signal/unit";
|
|
|
1226
1226
|
var COMPOSITE_COMPLETE_PATH = "/api/v1/signal/composite/complete";
|
|
1227
1227
|
var OUTCOME_COMPLETE_PATH = "/api/v1/signal/outcome/complete";
|
|
1228
1228
|
var USAGE_LOG_PATH = "/api/v1/signal/usage-log";
|
|
1229
|
+
var USAGE_LOG_LOOKUP_PATH = "/api/v1/signal/usage-log/lookup";
|
|
1229
1230
|
function signalToWire(signal) {
|
|
1230
1231
|
const t = signal.tokens;
|
|
1231
1232
|
const body = {
|
|
@@ -1488,6 +1489,26 @@ var Signals = class {
|
|
|
1488
1489
|
}
|
|
1489
1490
|
});
|
|
1490
1491
|
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Fetches up to 100 usage-log rows by id, in one call.
|
|
1494
|
+
* `GET /api/v1/signal/usage-log/lookup`.
|
|
1495
|
+
*
|
|
1496
|
+
* Built for linking a wallet debit to its usage: pass the `usageLogId`s
|
|
1497
|
+
* from `customers.wallet()` instead of paging through
|
|
1498
|
+
* {@link usageLog}. Scoped to your org, not to one customer — every row
|
|
1499
|
+
* carries its own `customerId`.
|
|
1500
|
+
*
|
|
1501
|
+
* Rows come back in the order of `ids`; duplicates are removed. Ids that
|
|
1502
|
+
* match nothing in your org are listed in `notFound`. More than 100
|
|
1503
|
+
* distinct ids is a 400.
|
|
1504
|
+
*/
|
|
1505
|
+
lookupUsageLogs(ids) {
|
|
1506
|
+
return this.transport.request({
|
|
1507
|
+
method: "GET",
|
|
1508
|
+
path: USAGE_LOG_LOOKUP_PATH,
|
|
1509
|
+
query: { ids: ids.join(",") }
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1491
1512
|
};
|
|
1492
1513
|
|
|
1493
1514
|
// src/resources/units.ts
|