@terminal3/t3n-sdk 2.11.0 → 2.12.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.
@@ -370,6 +370,12 @@ export declare class T3nClient {
370
370
  organisationDid?: string;
371
371
  attestations?: unknown;
372
372
  keys?: Record<string, unknown>;
373
+ /**
374
+ * MAT-1618 testnet self-admit, propagated to the inner
375
+ * {@link submitUserInput} call. Inspect `result.tenantAdmit` for
376
+ * the outcome.
377
+ */
378
+ becomeDevTenant?: boolean;
373
379
  getOtpCode: (contact: string, channel: OtpChannel) => Promise<string> | string;
374
380
  }): Promise<SubmitUserInputResult>;
375
381
  /**
@@ -18,7 +18,7 @@ export type { SessionId, Did, OidcCredentials, AuthInput, EthAuthInput, OidcAuth
18
18
  export { SessionStatus, AuthMethod, createEthAuthInput, createOidcAuthInput, } from "./types";
19
19
  export type { KycStatus, KycStatusKind, KycPollOptions, KycPollCadence, } from "./types/kyc";
20
20
  export { DEFAULT_KYC_POLL_CADENCE, TERMINAL_KYC_STATUSES, KycStatusTimeoutError, } from "./types/kyc";
21
- export type { OtpChannel, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, OtpMergeSuggestion, UserInputProfile, SubmitUserInputArgs, SubmitUserInputResult, UserUpsertErrorKind, } from "./types/user";
21
+ export type { OtpChannel, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, OtpMergeSuggestion, UserInputProfile, SubmitUserInputArgs, SubmitUserInputResult, TenantAdmitProjection, TenantAdmitStatus, UserUpsertErrorKind, } from "./types/user";
22
22
  export { UserUpsertError } from "./types/user";
23
23
  export { OrgDataClient, SessionOrgDataClient, createOrgDataClientFromSession, } from "./client/org-data";
24
24
  export type { OrgDataClientOptions, CreatePolicyInput, UpdateMetaInput, SetWritersInput, SetGrantsInput, DeleteGrantsInput, WriteDataInput, DeleteDataInput, DeleteScopeInput, PolicyGetInput, WritersGetInput, GrantsGetInput, DataListInput, DataGetInput, ExecuteOrgDataActionOptions, } from "./client/org-data";
@@ -138,6 +138,41 @@ export interface SubmitUserInputArgs {
138
138
  * Most callers should leave this `undefined`.
139
139
  */
140
140
  requireExistingUser?: boolean;
141
+ /**
142
+ * MAT-1618 testnet self-admit. When `true`, the contract additionally
143
+ * runs the self-admit side-effect after the profile commit: writes
144
+ * the caller's DID into `idx:_tenants` + `idx:_tenant_quotas` and
145
+ * mints any operator-configured welcome credits. Inspect the
146
+ * `tenantAdmit` field on the response for the outcome.
147
+ *
148
+ * Testnet-only. Production clusters return
149
+ * `tenantAdmit.status = "refused"` with
150
+ * `reason = "not_testnet" | "self_admit_disabled" | "not_eth_derived"`.
151
+ * The profile commit always succeeds regardless of the inner outcome.
152
+ *
153
+ * Most callers should leave this `undefined`.
154
+ */
155
+ becomeDevTenant?: boolean;
156
+ }
157
+ /**
158
+ * MAT-1618 self-admit projection from `user-upsert`. Present only
159
+ * when the caller set `becomeDevTenant: true` on the request.
160
+ *
161
+ * - `status: "admitted"` — first call for this DID; tenant record
162
+ * committed and (if configured) welcome credits minted into
163
+ * `grantedCredits`.
164
+ * - `status: "already-admitted"` — replay; idempotent no-op.
165
+ * - `status: "refused"` — the cluster declined the self-admit;
166
+ * `reason` is the machine-readable cause (`not_testnet`,
167
+ * `self_admit_disabled`, `not_eth_derived`), `detail` is a
168
+ * human-readable string.
169
+ */
170
+ export type TenantAdmitStatus = "admitted" | "already-admitted" | "refused";
171
+ export interface TenantAdmitProjection {
172
+ status: TenantAdmitStatus;
173
+ grantedCredits?: string;
174
+ reason?: string;
175
+ detail?: string;
141
176
  }
142
177
  /**
143
178
  * Response shape returned by the slim `user-upsert`. Carries the
@@ -150,6 +185,11 @@ export interface SubmitUserInputResult {
150
185
  refusedFields?: string[];
151
186
  mergeSuggestion?: OtpMergeSuggestion;
152
187
  userFound?: boolean;
188
+ /**
189
+ * MAT-1618 self-admit projection. Present only when the caller
190
+ * set `becomeDevTenant: true` on the request.
191
+ */
192
+ tenantAdmit?: TenantAdmitProjection;
153
193
  }
154
194
  /**
155
195
  * Discriminator for {@link UserUpsertError}. Mirrors the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terminal3/t3n-sdk",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "type": "module",
5
5
  "description": "T3n TypeScript SDK - A minimal SDK that mirrors the server's RPC handler approach",
6
6
  "main": "dist/index.js",
@@ -45,6 +45,7 @@
45
45
  "demo:tenant:setup": "tsx --tsconfig tsconfig.demo.json tenant-demo.ts --cmd setup",
46
46
  "demo:tenant:search": "tsx --tsconfig tsconfig.demo.json tenant-demo.ts --cmd search",
47
47
  "demo:tenant:book": "tsx --tsconfig tsconfig.demo.json tenant-demo.ts --cmd book",
48
+ "demo:tenant:self-admit": "tsx --tsconfig tsconfig.demo.json demo-tenant-self-admit.ts",
48
49
  "verify:pack": "node scripts/verify-pack.js",
49
50
  "prepublishOnly": "pnpm run build:public && pnpm run verify:pack",
50
51
  "release": "node scripts/release.js release",