@terminal3/t3n-sdk 3.12.7 → 3.14.0
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.d.ts +68 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -725,6 +725,29 @@ declare class UserUpsertError extends T3nError {
|
|
|
725
725
|
*/
|
|
726
726
|
static fromWire(raw: string): UserUpsertError | null;
|
|
727
727
|
}
|
|
728
|
+
/** One contract-scoped grant for an agent. Wire form is snake_case
|
|
729
|
+
* (`script_name` / `version_req` / `allowed_hosts`); `agentAuthUpdate`
|
|
730
|
+
* performs the conversion. */
|
|
731
|
+
interface AgentScriptGrant {
|
|
732
|
+
scriptName: string;
|
|
733
|
+
/** SemVer requirement (e.g. `"^1.0.0"`). Omit / null = any version. */
|
|
734
|
+
versionReq?: string | null;
|
|
735
|
+
/** Allowed function names. Omit / null = all functions. */
|
|
736
|
+
functions?: string[] | null;
|
|
737
|
+
/** Allowed outbound HTTP hosts. Omit = none. */
|
|
738
|
+
allowedHosts?: string[];
|
|
739
|
+
}
|
|
740
|
+
/** Per-agent authorisation grant binding an agent DID to its script grants. */
|
|
741
|
+
interface AgentGrantInput {
|
|
742
|
+
agentDid: string;
|
|
743
|
+
scripts: AgentScriptGrant[];
|
|
744
|
+
}
|
|
745
|
+
/** Input to {@link T3nClient.agentAuthUpdate}. The document IS the new state:
|
|
746
|
+
* an empty `agents` list revokes all agent access. Mirrors the contract
|
|
747
|
+
* `AgentAuthPolicy`. */
|
|
748
|
+
interface AgentAuthUpdateInput {
|
|
749
|
+
agents: AgentGrantInput[];
|
|
750
|
+
}
|
|
728
751
|
|
|
729
752
|
/**
|
|
730
753
|
* Org-data wire types mirroring the org-data contract wire shapes.
|
|
@@ -1970,6 +1993,20 @@ declare class T3nClient {
|
|
|
1970
1993
|
* @throws {RpcError} for non-typed transport / decode failures.
|
|
1971
1994
|
*/
|
|
1972
1995
|
submitUserInput(input: SubmitUserInputArgs): Promise<SubmitUserInputResult>;
|
|
1996
|
+
/**
|
|
1997
|
+
* Replace this user's agent-authorisation policy (`tee:user/contracts` →
|
|
1998
|
+
* `agent-auth-update`). The supplied document IS the new state: an empty
|
|
1999
|
+
* `agents` array revokes all agent access.
|
|
2000
|
+
*
|
|
2001
|
+
* Typed wrapper over the raw contract call: callers pass
|
|
2002
|
+
* camelCase input; the SDK emits the canonical snake_case wire
|
|
2003
|
+
* (`agent_did` / `script_name` / `version_req` / `allowed_hosts`), so it no
|
|
2004
|
+
* longer relies on the contract's compatibility aliases.
|
|
2005
|
+
*
|
|
2006
|
+
* @throws {RpcError} if the contract rejects the policy (validation failure,
|
|
2007
|
+
* too many agents/grants).
|
|
2008
|
+
*/
|
|
2009
|
+
agentAuthUpdate(input: AgentAuthUpdateInput): Promise<void>;
|
|
1973
2010
|
/**
|
|
1974
2011
|
* Convenience helper: run the explicit OTP roundtrip and submit
|
|
1975
2012
|
* the slim user-upsert in one call.
|
|
@@ -3307,6 +3344,14 @@ interface MapCreateInput {
|
|
|
3307
3344
|
tail: string;
|
|
3308
3345
|
visibility: MapVisibility;
|
|
3309
3346
|
writers: WriterSet;
|
|
3347
|
+
/**
|
|
3348
|
+
* Who may read the map. **Optional, but omitting it is a footgun:**
|
|
3349
|
+
* the runtime defaults an unspecified `readers` to a *deny-all* policy, so the
|
|
3350
|
+
* map is created successfully yet nobody — not even the creator — can read it,
|
|
3351
|
+
* with no error. `maps.create` emits a `console.warn` when this is omitted.
|
|
3352
|
+
* Set it explicitly: `"all"` for public reads, `{ only: [contractId, ...] }`
|
|
3353
|
+
* to scope reads, or `{ only: [] }` to deliberately make the map write-only.
|
|
3354
|
+
*/
|
|
3310
3355
|
readers?: ReaderSet;
|
|
3311
3356
|
keyValidator?: unknown;
|
|
3312
3357
|
}
|
|
@@ -3344,6 +3389,17 @@ interface ContractExecuteInput {
|
|
|
3344
3389
|
functionName: string;
|
|
3345
3390
|
input?: unknown;
|
|
3346
3391
|
}
|
|
3392
|
+
/**
|
|
3393
|
+
* Result of a successful {@link TenantContractsNamespace.register} /
|
|
3394
|
+
* {@link TenantContractsNamespace.publish}. Mirrors the tenant contract's
|
|
3395
|
+
* `RegisterResponse` wire shape.
|
|
3396
|
+
*/
|
|
3397
|
+
interface ContractRegisterResult {
|
|
3398
|
+
/** Canonical `z:<tid>:<tail>` name the contract was registered under. */
|
|
3399
|
+
name: string;
|
|
3400
|
+
/** Stable monotonic numeric contract id assigned at registration time. */
|
|
3401
|
+
contract_id: number;
|
|
3402
|
+
}
|
|
3347
3403
|
|
|
3348
3404
|
type JsonObject = Record<string, unknown>;
|
|
3349
3405
|
interface TenantExecutionSession {
|
|
@@ -3416,8 +3472,8 @@ declare class TenantMapsNamespace {
|
|
|
3416
3472
|
declare class TenantContractsNamespace {
|
|
3417
3473
|
private readonly client;
|
|
3418
3474
|
constructor(client: TenantClient);
|
|
3419
|
-
publish(input: ContractPublishInput, opts?: TenantTargetOptions): Promise<
|
|
3420
|
-
register(input: ContractPublishInput, opts?: TenantTargetOptions): Promise<
|
|
3475
|
+
publish(input: ContractPublishInput, opts?: TenantTargetOptions): Promise<ContractRegisterResult>;
|
|
3476
|
+
register(input: ContractPublishInput, opts?: TenantTargetOptions): Promise<ContractRegisterResult>;
|
|
3421
3477
|
disable(tail: string, opts?: TenantTargetOptions): Promise<unknown>;
|
|
3422
3478
|
enable(tail: string, opts?: TenantTargetOptions): Promise<unknown>;
|
|
3423
3479
|
unregister(tail: string, opts?: TenantTargetOptions): Promise<unknown>;
|
|
@@ -3474,6 +3530,15 @@ declare class TenantClient {
|
|
|
3474
3530
|
readonly contracts: TenantContractsNamespace;
|
|
3475
3531
|
readonly token: TenantTokenNamespace;
|
|
3476
3532
|
constructor(config: TenantClientConfig);
|
|
3533
|
+
/**
|
|
3534
|
+
* Validate up front that every config field an operation needs is present,
|
|
3535
|
+
* throwing ONE error naming all missing fields instead of
|
|
3536
|
+
* discovering them one runtime error at a time. All `TenantClientConfig`
|
|
3537
|
+
* fields are optional by design (a control-plane-only client legitimately
|
|
3538
|
+
* omits some), so validation is per-operation against that op's true
|
|
3539
|
+
* dependency set — never an eager constructor check.
|
|
3540
|
+
*/
|
|
3541
|
+
requireConfig(op: string, fields: Array<keyof TenantClientConfig>): void;
|
|
3477
3542
|
/**
|
|
3478
3543
|
* Admit an org-owned tenant via the cluster-admin `tenant.admit-for-org`
|
|
3479
3544
|
* action.
|
|
@@ -3517,4 +3582,4 @@ declare function validateTail(tail: string): string;
|
|
|
3517
3582
|
declare function canonicalTenantName(tenantDid: string, tail: string): string;
|
|
3518
3583
|
|
|
3519
3584
|
export { AGENT_PUBKEY_LEN, AuthMethod, AuthenticationError, BASE_UNITS_PER_TOKEN, ContractResponseError, DEFAULT_INDIVIDUAL_THRESHOLD_CENTS, DEFAULT_KYC_POLL_CADENCE, DELEGATION_CREDENTIAL_DOMAIN, DELEGATION_INVOCATION_DOMAIN, DelegationCustodialClient, ETH_SIG_LEN, HandshakeError, HttpTransport, KycStatusTimeoutError, LogLevel, MAX_FUNCTIONS_PER_CREDENTIAL, MockTransport, NODE_URLS, NONCE_LEN, OrgDataClient, OtpRateLimitedError, REQUEST_HASH_LEN, RpcError, SessionExpiredError, SessionOrgDataClient, SessionStateError, SessionStatus, T3nClient, T3nError, TERMINAL_KYC_STATUSES, TOKEN_DECIMALS, TenantClient, TenantContractsNamespace, TenantMapsNamespace, TenantNamespace, TenantSdkValidationError, TenantTokenNamespace, UnsupportedTenantSdkOperationError, UserUpsertError, VC_ID_LEN, WasmError, Z_PAYROLL_AUDIT_READ_FUNCTIONS, Z_PAYROLL_RUN_FUNCTIONS, _b64uEncode, assertShape, b64uDecodeStrict, b64uEncodeBytes, buildDelegationCredential, buildInvocationPreimage, buildPayrollDirectInvocation, buildPayrollInvocation, bytesToString, canonicalTenantName, canonicaliseCredential, canonicaliseRequest, clearKeyCache, compactDidFromBytes, createDefaultHandlers, createEmailOtpAuthInput, createEthAuthInput, createLogger, createMlKemPublicKeyHandler, createOidcAuthInput, createOrgDataClientFromSession, createRandomHandler, decodeWasmErrorMessage, eip191Digest, ethRecoverEip191, eth_get_address, extractWasmError, fetchDkgAttestation, fetchMlKemPublicKey, formatTokens, generateRandomString, generateUUID, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, getScriptVersion, isDataGetResponse, isDataListResponse, isMutationResponse, isObject, isOrgContractGrants, isOrgPolicyMeta, isOrgPolicyView, isOrgWriters, loadConfig, loadWasmComponent, maskKeyMaterial, metamask_get_address, metamask_sign, parseContractResponse, redactSecrets, redactSecretsFromJson, requestHash, revokeDelegation, setEnvironment, setGlobalLogLevel, setNodeUrl, signAgentInvocation, signCredential, stringToBytes, tenantDidHex, toBaseUnits, validateConfig, validateCredentialBody, validateTail, verifyDkgAttestation, verifyTdxQuote };
|
|
3520
|
-
export type { AdmitForOrgOptions, AuthInput, BalanceRow, BuildDelegationCredentialOpts, BuildPayrollDirectInvocationOpts, BuildPayrollInvocationOpts, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractExecuteInput, ContractPublishInput, ContractResponseSchema, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationCredential, DelegationCustodialClientOpts, DelegationEnvelope, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, Did, Direction, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, GetUsageOptions, GrantsGetInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, Logger, MapCreateInput, MapResponse, MapUpdateInput, MapVisibility, MutationResponse, OidcAuthInput, OidcCredentials, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgPolicyMeta, OrgPolicyView, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollInvocation, PayrollInvocationDelegated, PayrollInvocationDirect, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, QuoteVerifyResult, ReaderSet, RevokeDelegationOpts, RevokeDelegationResult, SdkConfig, SessionCrypto, SessionId, SetGrantsInput, SetWritersInput, SignCustodialResult, SignDelegationResponse, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, UpdateMetaInput, UsageEntry, UsagePage, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WriteDataInput, WriterSet, WritersGetInput };
|
|
3585
|
+
export type { AdmitForOrgOptions, AgentAuthUpdateInput, AgentGrantInput, AgentScriptGrant, AuthInput, BalanceRow, BuildDelegationCredentialOpts, BuildPayrollDirectInvocationOpts, BuildPayrollInvocationOpts, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractExecuteInput, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationCredential, DelegationCustodialClientOpts, DelegationEnvelope, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, Did, Direction, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, GetUsageOptions, GrantsGetInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, Logger, MapCreateInput, MapResponse, MapUpdateInput, MapVisibility, MutationResponse, OidcAuthInput, OidcCredentials, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgPolicyMeta, OrgPolicyView, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollInvocation, PayrollInvocationDelegated, PayrollInvocationDirect, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, QuoteVerifyResult, ReaderSet, RevokeDelegationOpts, RevokeDelegationResult, SdkConfig, SessionCrypto, SessionId, SetGrantsInput, SetWritersInput, SignCustodialResult, SignDelegationResponse, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, UpdateMetaInput, UsageEntry, UsagePage, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WriteDataInput, WriterSet, WritersGetInput };
|