@terminal3/t3n-sdk 4.16.1 → 4.18.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/cli/index.js +1 -1
- package/dist/index.d.ts +156 -6
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2004,15 +2004,19 @@ declare class T3nClient {
|
|
|
2004
2004
|
* returned exactly once here and is never persisted or recoverable
|
|
2005
2005
|
* afterwards, so the caller must capture it immediately.
|
|
2006
2006
|
*
|
|
2007
|
-
* Atomic
|
|
2008
|
-
*
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
2011
|
-
* agent in the org's `agent-cards` scope. The card body is
|
|
2007
|
+
* Atomic provisioning + card hosting: the SAME transaction mints the
|
|
2008
|
+
* agent, writes the agent-registry record (owner binding + the org's
|
|
2009
|
+
* publish-consent link), and — unless `options.defaultCard === false` —
|
|
2010
|
+
* hosts a PRIVATE card in the org's `agent-cards` scope. The card body is
|
|
2012
2011
|
* `options.card` when given (object or pre-serialised JSON string);
|
|
2013
2012
|
* otherwise the CONTRACT builds and hosts its default (which can even
|
|
2014
2013
|
* name the agent DID, minted inside the same transaction).
|
|
2015
2014
|
*
|
|
2015
|
+
* `options.agentUri` is **optional**: a T3N-hosted card is served at
|
|
2016
|
+
* `/api/agent-card/<did>`, so an agent needs no external URI. Pass one
|
|
2017
|
+
* only to record an external endpoint in the DID document's
|
|
2018
|
+
* `AgentService`; the card is hosted either way.
|
|
2019
|
+
*
|
|
2016
2020
|
* The card is deliberately NOT published: an org-bound agent must not
|
|
2017
2021
|
* become world-discoverable as a side effect of provisioning. Publish
|
|
2018
2022
|
* explicitly with `agentCardPublish` (one call — the consent link
|
|
@@ -2041,6 +2045,124 @@ declare class T3nClient {
|
|
|
2041
2045
|
agentUri?: string;
|
|
2042
2046
|
cardEntryId?: string;
|
|
2043
2047
|
}>;
|
|
2048
|
+
/**
|
|
2049
|
+
* Normalise an organisation / user DID to the bare 40-hex form the
|
|
2050
|
+
* `tee:organisation` contract's `organisation_did` / `user_did` fields
|
|
2051
|
+
* expect (those take a hex string, not the `did:t3n:` display form).
|
|
2052
|
+
* Accepts `did:t3n:<40 hex>` or bare 40 hex.
|
|
2053
|
+
*/
|
|
2054
|
+
private static didToCompactHex;
|
|
2055
|
+
/**
|
|
2056
|
+
* Dispatch a `tee:organisation/contracts` function over the authenticated
|
|
2057
|
+
* `action.execute` path (org-scoped writes are gated in-contract on the
|
|
2058
|
+
* caller's org-admin membership). Shared glue for the
|
|
2059
|
+
* organisation-lifecycle wrappers below.
|
|
2060
|
+
*/
|
|
2061
|
+
private executeOrganisationContract;
|
|
2062
|
+
/**
|
|
2063
|
+
* Rename or change the status of an organisation the caller administers.
|
|
2064
|
+
* Dispatches `organisation-update`; the contract gates on the caller being
|
|
2065
|
+
* an org-admin of `orgDid`. Omitted fields are left unchanged.
|
|
2066
|
+
*
|
|
2067
|
+
* @param orgDid - the target organisation (`did:t3n:<hex>` or bare hex)
|
|
2068
|
+
* @param updates - `name` and/or `status` (`"Active"` | `"Suspended"`)
|
|
2069
|
+
*/
|
|
2070
|
+
updateOrganisation(orgDid: string, updates: {
|
|
2071
|
+
name?: string;
|
|
2072
|
+
status?: "Active" | "Suspended";
|
|
2073
|
+
}): Promise<void>;
|
|
2074
|
+
/**
|
|
2075
|
+
* Delete an organisation the caller administers, footprint and all.
|
|
2076
|
+
*
|
|
2077
|
+
* A single `organisation-delete` dispatch tears down both stores the org
|
|
2078
|
+
* spans: the contract removes the `OrganisationRecord`, memberships, and
|
|
2079
|
+
* `OrgPolicyMeta`, and purges the org's `tee:org-data` footprint (every
|
|
2080
|
+
* grant, writer list, data entry, and index row keyed under the org DID)
|
|
2081
|
+
* in-contract, in the same consensus tx. Purge and delete therefore commit
|
|
2082
|
+
* or roll back together — a purge failure aborts the whole delete, so a
|
|
2083
|
+
* successful call never strands org-data.
|
|
2084
|
+
*
|
|
2085
|
+
* The org record's emptiness guards still apply (the org must have no
|
|
2086
|
+
* non-admin members and no children).
|
|
2087
|
+
*
|
|
2088
|
+
* @param orgDid - the target organisation (`did:t3n:<hex>` or bare hex)
|
|
2089
|
+
* @throws if the session is not authenticated, or if `organisation-delete`
|
|
2090
|
+
* refuses (including a refused in-contract org-data purge)
|
|
2091
|
+
*/
|
|
2092
|
+
deleteOrganisation(orgDid: string): Promise<void>;
|
|
2093
|
+
/**
|
|
2094
|
+
* Dispatch a `tee:org-data/contracts` mutation on the authenticated session
|
|
2095
|
+
* and require a `MutationResponse` back. A successful mutation returns a
|
|
2096
|
+
* `MutationResponse` object; a refusal surfaces as a `"Code: message"` string
|
|
2097
|
+
* on an otherwise-2xx response. This surfaces the refusal reason verbatim and
|
|
2098
|
+
* then requires the success shape via `assertShape`, so any non-success
|
|
2099
|
+
* (refusal string, or any other malformed payload) throws rather than being
|
|
2100
|
+
* treated as success — letting callers abort a multi-step teardown.
|
|
2101
|
+
*/
|
|
2102
|
+
private executeOrgDataMutation;
|
|
2103
|
+
/**
|
|
2104
|
+
* Attach an existing registered user to an organisation the caller
|
|
2105
|
+
* administers. Dispatches `user-add-organisation-attribution` (org-admin
|
|
2106
|
+
* gated).
|
|
2107
|
+
*
|
|
2108
|
+
* @param orgDid - the target organisation
|
|
2109
|
+
* @param userDid - the user to attach
|
|
2110
|
+
* @param opts.setAsOriginator - when the user has no originator yet, also
|
|
2111
|
+
* stamp this org as their write-once originator (backfill; ignored if one
|
|
2112
|
+
* is already set)
|
|
2113
|
+
*/
|
|
2114
|
+
addOrganisationMember(orgDid: string, userDid: string, opts?: {
|
|
2115
|
+
setAsOriginator?: boolean;
|
|
2116
|
+
}): Promise<void>;
|
|
2117
|
+
/**
|
|
2118
|
+
* Detach a member from an organisation the caller administers (an org-admin
|
|
2119
|
+
* "kick") and revoke their standing org-data capability (detach cascade):
|
|
2120
|
+
*
|
|
2121
|
+
* 1. `user-remove-organisation-attribution` — drop the membership edge
|
|
2122
|
+
* (org-admin gated; idempotent on an already-absent membership). The host
|
|
2123
|
+
* membership gate makes the detach effective immediately.
|
|
2124
|
+
* 2. `org-remove-member-grants` — sweep the member from the org's
|
|
2125
|
+
* per-contract `UserGrant` lists, so the capability does not silently
|
|
2126
|
+
* reactivate if the member later rejoins.
|
|
2127
|
+
*
|
|
2128
|
+
* The member's `agent_auth` delegations are self-scoped (`AGENT_AUTH_MAP` is a
|
|
2129
|
+
* per-user document an admin cannot reach), so this cannot sweep them; the host
|
|
2130
|
+
* membership gate denies them regardless, and the member's own session can run
|
|
2131
|
+
* {@link revokeAgentAuthForOrg} for full cleanup.
|
|
2132
|
+
*
|
|
2133
|
+
* @param orgDid - the organisation
|
|
2134
|
+
* @param userDid - the member to detach
|
|
2135
|
+
*/
|
|
2136
|
+
removeOrganisationMember(orgDid: string, userDid: string): Promise<void>;
|
|
2137
|
+
/**
|
|
2138
|
+
* Leave an organisation the caller is a member of (self-detach) and revoke
|
|
2139
|
+
* the caller's own standing capability for it (detach cascade):
|
|
2140
|
+
*
|
|
2141
|
+
* 1. `user-remove-organisation-attribution` with the caller's own DID as the
|
|
2142
|
+
* target — the contract's self-leave branch (`caller == target`) admits it
|
|
2143
|
+
* without org-admin rights. The host membership gate makes the detach
|
|
2144
|
+
* effective immediately.
|
|
2145
|
+
* 2. `org-remove-member-grants` — sweep the caller's own grants for the org
|
|
2146
|
+
* (the self-revocation branch, `caller == member`).
|
|
2147
|
+
* 3. `agent-auth-revoke-org` — drop the caller's own org-scoped agent
|
|
2148
|
+
* delegations.
|
|
2149
|
+
*
|
|
2150
|
+
* Steps 2–3 leave no stale capability rows that would reactivate on a rejoin.
|
|
2151
|
+
*
|
|
2152
|
+
* @param orgDid - the organisation to leave
|
|
2153
|
+
*/
|
|
2154
|
+
leaveOrganisation(orgDid: string): Promise<void>;
|
|
2155
|
+
/**
|
|
2156
|
+
* Revoke the caller's own agent delegations scoped to one org
|
|
2157
|
+
* (detach-cascade `agent_auth` half). Dispatches
|
|
2158
|
+
* `agent-auth-revoke-org` on `tee:user/contracts` (**SelfOnly**): every
|
|
2159
|
+
* `ScriptGrant` targeting a `z:<orgTid>:*` contract is removed from the
|
|
2160
|
+
* caller's own agent-auth document.
|
|
2161
|
+
*
|
|
2162
|
+
* @param orgTid - the org's z-space tenant id (`did:t3n:<hex>` or bare
|
|
2163
|
+
* 40-hex) — i.e. the `<tid>` in the org's `z:<tid>:…` contract names
|
|
2164
|
+
*/
|
|
2165
|
+
revokeAgentAuthForOrg(orgTid: string): Promise<void>;
|
|
2044
2166
|
/**
|
|
2045
2167
|
* Read the authenticated user's own agent-auth policy — the standing
|
|
2046
2168
|
* grants delegated to agents. Dispatches `agent-auth-get` on
|
|
@@ -3020,6 +3142,14 @@ interface DeleteScopeInput {
|
|
|
3020
3142
|
orgDid: string;
|
|
3021
3143
|
scope: string;
|
|
3022
3144
|
}
|
|
3145
|
+
interface PurgeOrgInput {
|
|
3146
|
+
orgDid: string;
|
|
3147
|
+
}
|
|
3148
|
+
interface RemoveMemberGrantsInput {
|
|
3149
|
+
orgDid: string;
|
|
3150
|
+
/** DID (`did:t3n:<40-hex>` or bare hex) to drop from every grant list. */
|
|
3151
|
+
memberDid: string;
|
|
3152
|
+
}
|
|
3023
3153
|
interface PolicyGetInput {
|
|
3024
3154
|
orgDid: string;
|
|
3025
3155
|
}
|
|
@@ -3175,6 +3305,22 @@ declare class OrgDataClient {
|
|
|
3175
3305
|
* Requires admin access (unlike `deleteData` which requires writer access).
|
|
3176
3306
|
*/
|
|
3177
3307
|
deleteScope(input: DeleteScopeInput): Promise<MutationResponse>;
|
|
3308
|
+
/**
|
|
3309
|
+
* Full teardown of an org's org-data footprint — every
|
|
3310
|
+
* grant, writer list, data entry, and index row keyed under the org DID.
|
|
3311
|
+
* Org-admin-gated. Run this **before** `T3nClient.deleteOrganisation`,
|
|
3312
|
+
* which removes the `OrgPolicyMeta` this call authorises against — together
|
|
3313
|
+
* they leave the org with no org-data residue. `deleted_entries` reports the
|
|
3314
|
+
* row count cleared.
|
|
3315
|
+
*/
|
|
3316
|
+
purgeOrg(input: PurgeOrgInput): Promise<MutationResponse>;
|
|
3317
|
+
/**
|
|
3318
|
+
* Detach-cascade grant sweep: drop `memberDid` from every
|
|
3319
|
+
* one of the org's per-contract `UserGrant` lists. Authorised for an
|
|
3320
|
+
* org-admin of the subject, or the member removing their own grants.
|
|
3321
|
+
* `deleted_entries` reports how many contract grant lists were rewritten.
|
|
3322
|
+
*/
|
|
3323
|
+
removeMemberGrants(input: RemoveMemberGrantsInput): Promise<MutationResponse>;
|
|
3178
3324
|
/** Read the policy metadata for an org (admin-only). */
|
|
3179
3325
|
policyGet(input: PolicyGetInput): Promise<OrgPolicyMeta>;
|
|
3180
3326
|
/**
|
|
@@ -3296,6 +3442,10 @@ declare class SessionOrgDataClient {
|
|
|
3296
3442
|
deleteData(input: DeleteDataInput): Promise<MutationResponse>;
|
|
3297
3443
|
/** Mirrors {@link OrgDataClient.deleteScope}. */
|
|
3298
3444
|
deleteScope(input: DeleteScopeInput): Promise<MutationResponse>;
|
|
3445
|
+
/** Mirrors {@link OrgDataClient.purgeOrg}. */
|
|
3446
|
+
purgeOrg(input: PurgeOrgInput): Promise<MutationResponse>;
|
|
3447
|
+
/** Mirrors {@link OrgDataClient.removeMemberGrants}. */
|
|
3448
|
+
removeMemberGrants(input: RemoveMemberGrantsInput): Promise<MutationResponse>;
|
|
3299
3449
|
/** Mirrors {@link OrgDataClient.policyGet}. */
|
|
3300
3450
|
policyGet(input: PolicyGetInput): Promise<OrgPolicyMeta>;
|
|
3301
3451
|
/** Mirrors {@link OrgDataClient.policyView}. */
|
|
@@ -4134,4 +4284,4 @@ declare function validateTail(tail: string): string;
|
|
|
4134
4284
|
declare function canonicalTenantName(tenantDid: string, tail: string): string;
|
|
4135
4285
|
|
|
4136
4286
|
export { AGENT_CARDS_SCOPE, AuthMethod, AuthenticationError, BASE_UNITS_PER_TOKEN, ContractResponseError, DEFAULT_ENVIRONMENT, DEFAULT_INDIVIDUAL_THRESHOLD_CENTS, DEFAULT_KYC_POLL_CADENCE, HandshakeError, HttpTransport, KycStatusTimeoutError, LogLevel, MockTransport, NODE_URLS, OrgDataClient, OtpRateLimitedError, RpcError, SessionExpiredError, SessionOrgDataClient, SessionStateError, SessionStatus, SessionUsageReportClient, T3nClient, T3nError, TERMINAL_KYC_STATUSES, TOKEN_DECIMALS, TenantClient, TenantContractsNamespace, TenantMapsNamespace, TenantNamespace, TenantSdkValidationError, TenantTokenNamespace, UnsupportedTenantSdkOperationError, UserUpsertError, WasmError, WireEncodingError, Z_PAYROLL_AUDIT_READ_FUNCTIONS, Z_PAYROLL_RUN_FUNCTIONS, _b64uEncode, assertShape, b64uDecodeStrict, b64uEncodeBytes, bytesToString, canonicalTenantName, clearKeyCache, compactDidFromBytes, createDefaultHandlers, createEmailOtpAuthInput, createEthAuthInput, createLogger, createMlKemPublicKeyHandler, createOidcAuthInput, createOrgDataClientFromSession, createRandomHandler, createUsageReportClientFromSession, createWorkloadAuthInput, decodeWasmErrorMessage, deriveAgentCardEntryId, eth_get_address, extractWasmError, fetchDkgAttestation, fetchMlKemPublicKey, formatTokens, generateRandomString, generateUUID, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, getScriptVersion, isAgentCardResponse, isDataGetResponse, isDataListResponse, isMutationResponse, isObject, isOrgAdminStatus, isOrgContractGrants, isOrgPolicyMeta, isOrgPolicyView, isOrgUsageReport, isOrgWriters, isUnsafeTrustServer, loadConfig, loadWasmComponent, maskKeyMaterial, mergeAgentAuthEntries, mergeDiscoverDids, metamask_get_address, metamask_sign, parseAgentAuthGet, parseAgentAuthPolicy, parseContractResponse, redactSecrets, redactSecretsFromJson, requestToWire, setEnvironment, setGlobalLogLevel, setNodeUrl, stringToBytes, tenantDidHex, toAgentAuthUpdateWire, toBaseUnits, validateConfig, validateTail, verifyDkgAttestation, verifyTdxQuote };
|
|
4137
|
-
export type { AdmitForOrgOptions, AgentAuthEntry, AgentAuthMergeResult, AgentAuthPolicy, AgentAuthScriptGrant, AgentAuthUpdateInput, AgentCardRefInput, AgentCardResponse, AgentCardSetInput, AuthInput, BalanceRow, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractExecuteInput, ContractKind, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, ContractSetDescriptorInput, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationGrantKind, DelegationGrantRef, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, Did, Direction, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, GetUsageOptions, GrantCheckParams, GrantCheckResult, GrantsGetInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, ListContractsParams, ListContractsResult, ListContractsScope, ListedContract, Logger, MapCreateInput, MapLifecycleStatus, MapResponse, MapUpdateInput, MapVisibility, MutationResponse, OidcAuthInput, OidcCredentials, OrgAdminStatus, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgPolicyMeta, OrgPolicyView, OrgUsageReport, OrgUsageReportInput, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, QuoteVerifyResult, ReaderSet, SdkConfig, SessionCrypto, SessionId, SetGrantsInput, SetWritersInput, StringEncoding, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantContractSetDescriptorInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, TrustAnchor, TrustAnchorOrUnsafe, UnsafeTrustServer, UpdateMetaInput, UsageEntry, UsagePage, UsageReportSignature, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WireBlock, WorkloadAuthInput, WriteDataInput, WriterSet, WritersGetInput };
|
|
4287
|
+
export type { AdmitForOrgOptions, AgentAuthEntry, AgentAuthMergeResult, AgentAuthPolicy, AgentAuthScriptGrant, AgentAuthUpdateInput, AgentCardRefInput, AgentCardResponse, AgentCardSetInput, AuthInput, BalanceRow, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractExecuteInput, ContractKind, ContractPublishInput, ContractRegisterResult, ContractResponseSchema, ContractSetDescriptorInput, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationGrantKind, DelegationGrantRef, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, Did, Direction, DkgAttestation, DkgVerifyResult, EmailOtpAuthInput, EmailOtpCredentials, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, GetUsageOptions, GrantCheckParams, GrantCheckResult, GrantsGetInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, ListContractsParams, ListContractsResult, ListContractsScope, ListedContract, Logger, MapCreateInput, MapLifecycleStatus, MapResponse, MapUpdateInput, MapVisibility, MutationResponse, OidcAuthInput, OidcCredentials, OrgAdminStatus, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgPolicyMeta, OrgPolicyView, OrgUsageReport, OrgUsageReportInput, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, PurgeOrgInput, QuoteVerifyResult, ReaderSet, RemoveMemberGrantsInput, SdkConfig, SessionCrypto, SessionId, SetGrantsInput, SetWritersInput, StringEncoding, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantContractSetDescriptorInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, TrustAnchor, TrustAnchorOrUnsafe, UnsafeTrustServer, UpdateMetaInput, UsageEntry, UsagePage, UsageReportSignature, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WireBlock, WorkloadAuthInput, WriteDataInput, WriterSet, WritersGetInput };
|