@terminal3/t3n-sdk 4.18.0 → 4.19.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 CHANGED
@@ -2968,6 +2968,56 @@ interface OrgContractGrants {
2968
2968
  * here would create maintenance churn against benign field additions.
2969
2969
  */
2970
2970
  declare function isOrgContractGrants(value: unknown): value is OrgContractGrants;
2971
+ /**
2972
+ * One grant inside a role: a {@link UserGrant} body (without the
2973
+ * grantee, which is bound at assignment time) plus the target contract.
2974
+ * Mirrors the org-data `RoleGrant` wire shape.
2975
+ */
2976
+ interface RoleGrant {
2977
+ /** Target contract (canonical name, e.g. `"tee:z-payroll/contracts"`). */
2978
+ contract_id: string;
2979
+ /** WIT function names this grant confers. */
2980
+ functions: string[];
2981
+ /** Data scope paths this grant confers (canonicalised lowercase). */
2982
+ scopes: string[];
2983
+ }
2984
+ /**
2985
+ * A role: a named bundle of grants and/or composed sub-roles.
2986
+ * Mirrors the org-data `RoleDefinition` wire shape.
2987
+ */
2988
+ interface RoleDefinition {
2989
+ /** Org-unique role identifier (slug; function-name grammar). */
2990
+ role_id: string;
2991
+ /** Human-facing label. */
2992
+ label: string;
2993
+ /** Composite: other role ids in the same org whose grants this role confers. */
2994
+ includes: string[];
2995
+ /** Grants this role confers directly. */
2996
+ grants: RoleGrant[];
2997
+ }
2998
+ /**
2999
+ * The roles assigned to one grantee within one org.
3000
+ * Mirrors the org-data `RoleAssignments` wire shape.
3001
+ */
3002
+ interface RoleAssignments {
3003
+ /** Assigned role ids. */
3004
+ roles: string[];
3005
+ }
3006
+ /** Response for `org-role-get`; `role` is `null` when the id is unknown. */
3007
+ interface RoleGetResponse {
3008
+ role: RoleDefinition | null;
3009
+ }
3010
+ /** Shallow runtime guard for {@link RoleGetResponse}. */
3011
+ declare function isRoleGetResponse(value: unknown): value is RoleGetResponse;
3012
+ /** Response for `org-role-assignments-get`. */
3013
+ interface RoleAssignmentsResponse {
3014
+ /** Echoed back so callers don't need to track which request this answers. */
3015
+ grantee_did: string;
3016
+ /** The grantee's assigned role ids (empty when none). */
3017
+ roles: string[];
3018
+ }
3019
+ /** Shallow runtime guard for {@link RoleAssignmentsResponse}. */
3020
+ declare function isRoleAssignmentsResponse(value: unknown): value is RoleAssignmentsResponse;
2971
3021
  /** Response for `org-data-list`. */
2972
3022
  interface DataListResponse {
2973
3023
  /** Hex-encoded entry IDs for this page. */
@@ -3100,6 +3150,27 @@ interface DeleteGrantsInput {
3100
3150
  orgDid: string;
3101
3151
  contractId: string;
3102
3152
  }
3153
+ interface SetRoleInput {
3154
+ orgDid: string;
3155
+ role: RoleDefinition;
3156
+ }
3157
+ interface RoleIdInput {
3158
+ orgDid: string;
3159
+ roleId: string;
3160
+ }
3161
+ interface AssignRolesInput {
3162
+ orgDid: string;
3163
+ granteeDid: string;
3164
+ /** Full replacement set of role ids; an empty list clears the assignment. */
3165
+ roles: string[];
3166
+ }
3167
+ /** An (org, grantee) pair — the read/clear key for role assignments. */
3168
+ interface GranteeInput {
3169
+ orgDid: string;
3170
+ granteeDid: string;
3171
+ }
3172
+ /** Alias of {@link GranteeInput} — named for the `unassignRoles` call site. */
3173
+ type UnassignRolesInput = GranteeInput;
3103
3174
  interface WriteDataInputBase {
3104
3175
  orgDid: string;
3105
3176
  scope: string;
@@ -3289,6 +3360,21 @@ declare class OrgDataClient {
3289
3360
  * Delete the grant entry for a contract entirely.
3290
3361
  */
3291
3362
  deleteGrants(input: DeleteGrantsInput): Promise<MutationResponse>;
3363
+ /** Upsert a role definition (org-admin only). */
3364
+ setRole(input: SetRoleInput): Promise<MutationResponse>;
3365
+ /** Delete a role definition (org-admin only). */
3366
+ deleteRole(input: RoleIdInput): Promise<MutationResponse>;
3367
+ /** Read one role definition (org-admin only); `role` is `null` if unknown. */
3368
+ getRole(input: RoleIdInput): Promise<RoleGetResponse>;
3369
+ /**
3370
+ * Set a grantee's assigned roles (full replacement; empty list clears).
3371
+ * Org-admin only.
3372
+ */
3373
+ assignRoles(input: AssignRolesInput): Promise<MutationResponse>;
3374
+ /** Clear a grantee's role assignments (org-admin only). */
3375
+ unassignRoles(input: UnassignRolesInput): Promise<MutationResponse>;
3376
+ /** Read a grantee's assigned role ids (org-admin only). */
3377
+ getRoleAssignments(input: GranteeInput): Promise<RoleAssignmentsResponse>;
3292
3378
  /**
3293
3379
  * Write a data entry to the org's scope.
3294
3380
  *
@@ -3436,6 +3522,21 @@ declare class SessionOrgDataClient {
3436
3522
  setGrants(input: SetGrantsInput): Promise<MutationResponse>;
3437
3523
  /** Mirrors {@link OrgDataClient.deleteGrants}. */
3438
3524
  deleteGrants(input: DeleteGrantsInput): Promise<MutationResponse>;
3525
+ /** Upsert a role definition (org-admin only). */
3526
+ setRole(input: SetRoleInput): Promise<MutationResponse>;
3527
+ /** Delete a role definition (org-admin only). */
3528
+ deleteRole(input: RoleIdInput): Promise<MutationResponse>;
3529
+ /** Read one role definition (org-admin only); `role` is `null` if unknown. */
3530
+ getRole(input: RoleIdInput): Promise<RoleGetResponse>;
3531
+ /**
3532
+ * Set a grantee's assigned roles (full replacement; empty list clears).
3533
+ * Org-admin only.
3534
+ */
3535
+ assignRoles(input: AssignRolesInput): Promise<MutationResponse>;
3536
+ /** Clear a grantee's role assignments (org-admin only). */
3537
+ unassignRoles(input: UnassignRolesInput): Promise<MutationResponse>;
3538
+ /** Read a grantee's assigned role ids (org-admin only). */
3539
+ getRoleAssignments(input: GranteeInput): Promise<RoleAssignmentsResponse>;
3439
3540
  /** Mirrors {@link OrgDataClient.writeData}. */
3440
3541
  writeData(input: WriteDataInput): Promise<MutationResponse>;
3441
3542
  /** Mirrors {@link OrgDataClient.deleteData}. */
@@ -4283,5 +4384,5 @@ declare function tenantDidHex(tenantDid: string): string;
4283
4384
  declare function validateTail(tail: string): string;
4284
4385
  declare function canonicalTenantName(tenantDid: string, tail: string): string;
4285
4386
 
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 };
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 };
4387
+ 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, isRoleAssignmentsResponse, isRoleGetResponse, 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 };
4388
+ export type { AdmitForOrgOptions, AgentAuthEntry, AgentAuthMergeResult, AgentAuthPolicy, AgentAuthScriptGrant, AgentAuthUpdateInput, AgentCardRefInput, AgentCardResponse, AgentCardSetInput, AssignRolesInput, 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, GranteeInput, 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, RoleAssignments, RoleAssignmentsResponse, RoleDefinition, RoleGetResponse, RoleGrant, RoleIdInput, SdkConfig, SessionCrypto, SessionId, SetGrantsInput, SetRoleInput, SetWritersInput, StringEncoding, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantContractSetDescriptorInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TenantTargetOptions, TokenTxKind, Transport, TrustAnchor, TrustAnchorOrUnsafe, UnassignRolesInput, UnsafeTrustServer, UpdateMetaInput, UsageEntry, UsagePage, UsageReportSignature, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WireBlock, WorkloadAuthInput, WriteDataInput, WriterSet, WritersGetInput };