@faable/auth-sdk 2.6.16 → 2.6.18

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.
@@ -2165,6 +2165,19 @@ export declare abstract class GeneratedFaableAuthApi extends FaableApi {
2165
2165
  updatedAt?: string | undefined;
2166
2166
  }>>;
2167
2167
  };
2168
+ /**
2169
+ * `GET /internal/usage/sms` — operationId: `internal/smsUsage`
2170
+ *
2171
+ * SMS sent per tenant in a month (platform)
2172
+ */
2173
+ internalSmsUsage(params?: OpQuery<"internal/smsUsage">): Promise<{
2174
+ month: string;
2175
+ rows: {
2176
+ account_id: string;
2177
+ team: string | null;
2178
+ sent: number;
2179
+ }[];
2180
+ }>;
2168
2181
  /**
2169
2182
  * `GET /log/{log_id}` — operationId: `log/get`
2170
2183
  *
@@ -4285,6 +4298,7 @@ export declare abstract class GeneratedFaableAuthApi extends FaableApi {
4285
4298
  createdAt: string;
4286
4299
  expires_at: string;
4287
4300
  ttl: number;
4301
+ channel: string;
4288
4302
  link?: string | undefined;
4289
4303
  }[];
4290
4304
  }>;
@@ -4297,6 +4311,7 @@ export declare abstract class GeneratedFaableAuthApi extends FaableApi {
4297
4311
  status: "sent";
4298
4312
  credential_id: string;
4299
4313
  ticket_id: string;
4314
+ channel: "email" | "sms" | "whatsapp" | "factor";
4300
4315
  }>;
4301
4316
  /**
4302
4317
  * `POST /user/{user_id}/tickets/{ticket_id}/revoke` — operationId: `user/revokeTicket`
@@ -412,6 +412,14 @@ export class GeneratedFaableAuthApi extends FaableApi {
412
412
  identityList(params) {
413
413
  return this.paginator({ url: `/identity`, params });
414
414
  }
415
+ /**
416
+ * `GET /internal/usage/sms` — operationId: `internal/smsUsage`
417
+ *
418
+ * SMS sent per tenant in a month (platform)
419
+ */
420
+ internalSmsUsage(params) {
421
+ return this.fetcher.request({ method: "GET", url: `/internal/usage/sms`, params });
422
+ }
415
423
  /**
416
424
  * `GET /log/{log_id}` — operationId: `log/get`
417
425
  *
@@ -148,6 +148,26 @@ export interface paths {
148
148
  patch?: never;
149
149
  trace?: never;
150
150
  };
151
+ "/internal/usage/sms": {
152
+ parameters: {
153
+ query?: never;
154
+ header?: never;
155
+ path?: never;
156
+ cookie?: never;
157
+ };
158
+ /**
159
+ * SMS sent per tenant in a month (platform)
160
+ * @description Per-account count of recovery/verification SMS sent in the given month, read from the monthly quota counters. Consumed by the billing usage job. Platform token with `read:usage`.
161
+ */
162
+ get: operations["internal/smsUsage"];
163
+ put?: never;
164
+ post?: never;
165
+ delete?: never;
166
+ options?: never;
167
+ head?: never;
168
+ patch?: never;
169
+ trace?: never;
170
+ };
151
171
  "/connection": {
152
172
  parameters: {
153
173
  query?: never;
@@ -2793,6 +2813,46 @@ export interface paths {
2793
2813
  patch?: never;
2794
2814
  trace?: never;
2795
2815
  };
2816
+ "/reset-code/verify": {
2817
+ parameters: {
2818
+ query?: never;
2819
+ header?: never;
2820
+ path?: never;
2821
+ cookie?: never;
2822
+ };
2823
+ get?: never;
2824
+ put?: never;
2825
+ /**
2826
+ * Redeem a password-reset code sent by SMS/WhatsApp
2827
+ * @description Second entry point to the new-password screen, for a reset delivered as a 6-digit code instead of a link. Answers the same `redirect_url` that the emailed link would land on. Five wrong codes consume the ticket; the error is always `invalid_code` and reveals nothing about the account.
2828
+ */
2829
+ post: operations["reset_code_verify"];
2830
+ delete?: never;
2831
+ options?: never;
2832
+ head?: never;
2833
+ patch?: never;
2834
+ trace?: never;
2835
+ };
2836
+ "/dbconnections/recovery_options": {
2837
+ parameters: {
2838
+ query?: never;
2839
+ header?: never;
2840
+ path?: never;
2841
+ cookie?: never;
2842
+ };
2843
+ get?: never;
2844
+ put?: never;
2845
+ /**
2846
+ * Recovery channels to offer for an identifier
2847
+ * @description For the forgot-password screen. With the tenant's `visible` list empty (the default) it answers from configuration alone and never looks the account up. Otherwise it returns the channels the user can pick, with masked destinations.
2848
+ */
2849
+ post: operations["recovery_options"];
2850
+ delete?: never;
2851
+ options?: never;
2852
+ head?: never;
2853
+ patch?: never;
2854
+ trace?: never;
2855
+ };
2796
2856
  "/dbconnections/signup": {
2797
2857
  parameters: {
2798
2858
  query?: never;
@@ -5735,6 +5795,36 @@ export interface operations {
5735
5795
  };
5736
5796
  };
5737
5797
  };
5798
+ "internal/smsUsage": {
5799
+ parameters: {
5800
+ query: {
5801
+ /** @description YYYY-MM, UTC. Defaults to the current month. */
5802
+ month: string;
5803
+ };
5804
+ header?: never;
5805
+ path?: never;
5806
+ cookie?: never;
5807
+ };
5808
+ requestBody?: never;
5809
+ responses: {
5810
+ /** @description Default Response */
5811
+ 200: {
5812
+ headers: {
5813
+ [name: string]: unknown;
5814
+ };
5815
+ content: {
5816
+ "application/json": {
5817
+ month: string;
5818
+ rows: {
5819
+ account_id: string;
5820
+ team: string | null;
5821
+ sent: number;
5822
+ }[];
5823
+ };
5824
+ };
5825
+ };
5826
+ };
5827
+ };
5738
5828
  "connection/list": {
5739
5829
  parameters: {
5740
5830
  query?: {
@@ -7800,6 +7890,8 @@ export interface operations {
7800
7890
  "application/json": {
7801
7891
  /** @description Optional connection_name to disambiguate when the tenant has more than one database connection. Defaults to the tenant database connection. */
7802
7892
  connection?: string;
7893
+ /** @description How to deliver it: `email` (the link) or `sms` / `whatsapp` (a 6-digit code to the verified phone on file). Falls back to the tenant default when not available for this user; the response says which channel was used. */
7894
+ channel?: "email" | "sms" | "whatsapp" | "factor";
7803
7895
  };
7804
7896
  };
7805
7897
  };
@@ -7815,6 +7907,7 @@ export interface operations {
7815
7907
  status: "sent";
7816
7908
  credential_id: string;
7817
7909
  ticket_id: string;
7910
+ channel: "email" | "sms" | "whatsapp" | "factor";
7818
7911
  };
7819
7912
  };
7820
7913
  };
@@ -7846,6 +7939,8 @@ export interface operations {
7846
7939
  createdAt: string;
7847
7940
  expires_at: string;
7848
7941
  ttl: number;
7942
+ /** @description How this ticket reaches the person: `email` (the link), `sms` / `whatsapp` (a code), `factor`. Older tickets are `email`. */
7943
+ channel: string;
7849
7944
  /** @description The link from the ticket email. Present only while the ticket is usable — a dead link is noise, not a recovery path. */
7850
7945
  link?: string;
7851
7946
  }[];
@@ -13328,6 +13423,8 @@ export interface operations {
13328
13423
  content: {
13329
13424
  "application/json": {
13330
13425
  email: string;
13426
+ /** @description How to deliver the reset: `email` (link), `sms` / `whatsapp` (a 6-digit code to the verified phone on file). Silently falls back to the tenant default when the channel is not available for this user — the response never says which channels an account has. */
13427
+ channel?: "email" | "sms" | "whatsapp" | "factor";
13331
13428
  };
13332
13429
  };
13333
13430
  };
@@ -13391,6 +13488,69 @@ export interface operations {
13391
13488
  };
13392
13489
  };
13393
13490
  };
13491
+ reset_code_verify: {
13492
+ parameters: {
13493
+ query?: never;
13494
+ header?: never;
13495
+ path?: never;
13496
+ cookie?: never;
13497
+ };
13498
+ requestBody: {
13499
+ content: {
13500
+ "application/json": {
13501
+ email: string;
13502
+ code: string;
13503
+ };
13504
+ };
13505
+ };
13506
+ responses: {
13507
+ /** @description Default Response */
13508
+ 200: {
13509
+ headers: {
13510
+ [name: string]: unknown;
13511
+ };
13512
+ content: {
13513
+ "application/json": {
13514
+ redirect_url: string;
13515
+ };
13516
+ };
13517
+ };
13518
+ };
13519
+ };
13520
+ recovery_options: {
13521
+ parameters: {
13522
+ query?: never;
13523
+ header?: never;
13524
+ path?: never;
13525
+ cookie?: never;
13526
+ };
13527
+ requestBody: {
13528
+ content: {
13529
+ "application/json": {
13530
+ email: string;
13531
+ };
13532
+ };
13533
+ };
13534
+ responses: {
13535
+ /** @description Default Response */
13536
+ 200: {
13537
+ headers: {
13538
+ [name: string]: unknown;
13539
+ };
13540
+ content: {
13541
+ "application/json": {
13542
+ /** @description Whether the screen should offer a choice. False when the tenant keeps `visible` empty — then nothing here depends on the account existing. */
13543
+ picker: boolean;
13544
+ default: "email" | "sms" | "whatsapp" | "factor";
13545
+ channels: {
13546
+ channel: "email" | "sms" | "whatsapp" | "factor";
13547
+ destination_masked?: string;
13548
+ }[];
13549
+ };
13550
+ };
13551
+ };
13552
+ };
13553
+ };
13394
13554
  signup: {
13395
13555
  parameters: {
13396
13556
  query?: never;
package/dist/version.js CHANGED
@@ -9,13 +9,13 @@
9
9
  // login pages could not import the SDK at all. Same pattern as auth-js.
10
10
  //
11
11
  // The sentinels MUST stay byte-identical to the `from` values in `.releaserc`.
12
- export const version = "2.6.16";
12
+ export const version = "2.6.18";
13
13
  // Short git SHA of the released commit. The version dates a build; this names
14
14
  // the exact tree, so a canonical log line or an audit entry leads straight to
15
15
  // `git show <sha>`. Deliberately NOT hex: an unreleased build (dev, a local
16
16
  // link) cannot be mistaken for a real commit — auth only records values that
17
17
  // look like a SHA, and this one never will.
18
- export const commit = "c04402e";
18
+ export const commit = "5c6ffbe";
19
19
  // What this SDK writes in `x-faable-client`. Exported for a consumer that
20
20
  // builds a strategy on its own (outside `FaableAuthApi`) and still wants the
21
21
  // token request attributed — a bare `authClientCredentials` stamps only what
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/auth-sdk",
3
- "version": "2.6.16",
3
+ "version": "2.6.18",
4
4
  "author": "Marc Pomar <marc@faable.com>",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/spec/openapi.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "title": "@faablecloud/auth",
5
5
  "description": "Auth Platform made by Faable. Manage Users and Roles",
6
- "version": "2.17.0",
6
+ "version": "2.19.0",
7
7
  "license": {
8
8
  "name": "private",
9
9
  "url": "https://faable.com/docs/platform/privacy-policy"
@@ -10158,6 +10158,83 @@
10158
10158
  }
10159
10159
  }
10160
10160
  },
10161
+ "/internal/usage/sms": {
10162
+ "get": {
10163
+ "operationId": "internal/smsUsage",
10164
+ "summary": "SMS sent per tenant in a month (platform)",
10165
+ "tags": [
10166
+ "account"
10167
+ ],
10168
+ "description": "Per-account count of recovery/verification SMS sent in the given month, read from the monthly quota counters. Consumed by the billing usage job. Platform token with `read:usage`.",
10169
+ "parameters": [
10170
+ {
10171
+ "schema": {
10172
+ "type": "string",
10173
+ "pattern": "^\\d{4}-\\d{2}$"
10174
+ },
10175
+ "in": "query",
10176
+ "name": "month",
10177
+ "required": true,
10178
+ "description": "YYYY-MM, UTC. Defaults to the current month."
10179
+ }
10180
+ ],
10181
+ "security": [
10182
+ {
10183
+ "bearerAuth": []
10184
+ }
10185
+ ],
10186
+ "responses": {
10187
+ "200": {
10188
+ "description": "Default Response",
10189
+ "content": {
10190
+ "application/json": {
10191
+ "schema": {
10192
+ "type": "object",
10193
+ "required": [
10194
+ "month",
10195
+ "rows"
10196
+ ],
10197
+ "properties": {
10198
+ "month": {
10199
+ "type": "string"
10200
+ },
10201
+ "rows": {
10202
+ "type": "array",
10203
+ "items": {
10204
+ "type": "object",
10205
+ "required": [
10206
+ "account_id",
10207
+ "team",
10208
+ "sent"
10209
+ ],
10210
+ "properties": {
10211
+ "account_id": {
10212
+ "type": "string"
10213
+ },
10214
+ "team": {
10215
+ "anyOf": [
10216
+ {
10217
+ "type": "string"
10218
+ },
10219
+ {
10220
+ "type": "null"
10221
+ }
10222
+ ]
10223
+ },
10224
+ "sent": {
10225
+ "type": "integer"
10226
+ }
10227
+ }
10228
+ }
10229
+ }
10230
+ }
10231
+ }
10232
+ }
10233
+ }
10234
+ }
10235
+ }
10236
+ }
10237
+ },
10161
10238
  "/connection": {
10162
10239
  "get": {
10163
10240
  "operationId": "connection/list",
@@ -16713,6 +16790,39 @@
16713
16790
  "connection": {
16714
16791
  "type": "string",
16715
16792
  "description": "Optional connection_name to disambiguate when the tenant has more than one database connection. Defaults to the tenant database connection."
16793
+ },
16794
+ "channel": {
16795
+ "anyOf": [
16796
+ {
16797
+ "anyOf": [
16798
+ {
16799
+ "type": "string",
16800
+ "enum": [
16801
+ "email"
16802
+ ]
16803
+ },
16804
+ {
16805
+ "type": "string",
16806
+ "enum": [
16807
+ "sms"
16808
+ ]
16809
+ },
16810
+ {
16811
+ "type": "string",
16812
+ "enum": [
16813
+ "whatsapp"
16814
+ ]
16815
+ },
16816
+ {
16817
+ "type": "string",
16818
+ "enum": [
16819
+ "factor"
16820
+ ]
16821
+ }
16822
+ ]
16823
+ }
16824
+ ],
16825
+ "description": "How to deliver it: `email` (the link) or `sms` / `whatsapp` (a 6-digit code to the verified phone on file). Falls back to the tenant default when not available for this user; the response says which channel was used."
16716
16826
  }
16717
16827
  },
16718
16828
  "additionalProperties": false
@@ -16745,7 +16855,8 @@
16745
16855
  "required": [
16746
16856
  "status",
16747
16857
  "credential_id",
16748
- "ticket_id"
16858
+ "ticket_id",
16859
+ "channel"
16749
16860
  ],
16750
16861
  "properties": {
16751
16862
  "status": {
@@ -16759,6 +16870,34 @@
16759
16870
  },
16760
16871
  "ticket_id": {
16761
16872
  "type": "string"
16873
+ },
16874
+ "channel": {
16875
+ "anyOf": [
16876
+ {
16877
+ "type": "string",
16878
+ "enum": [
16879
+ "email"
16880
+ ]
16881
+ },
16882
+ {
16883
+ "type": "string",
16884
+ "enum": [
16885
+ "sms"
16886
+ ]
16887
+ },
16888
+ {
16889
+ "type": "string",
16890
+ "enum": [
16891
+ "whatsapp"
16892
+ ]
16893
+ },
16894
+ {
16895
+ "type": "string",
16896
+ "enum": [
16897
+ "factor"
16898
+ ]
16899
+ }
16900
+ ]
16762
16901
  }
16763
16902
  }
16764
16903
  }
@@ -16813,7 +16952,8 @@
16813
16952
  "email",
16814
16953
  "createdAt",
16815
16954
  "expires_at",
16816
- "ttl"
16955
+ "ttl",
16956
+ "channel"
16817
16957
  ],
16818
16958
  "properties": {
16819
16959
  "id": {
@@ -16856,6 +16996,10 @@
16856
16996
  "ttl": {
16857
16997
  "type": "number"
16858
16998
  },
16999
+ "channel": {
17000
+ "type": "string",
17001
+ "description": "How this ticket reaches the person: `email` (the link), `sms` / `whatsapp` (a code), `factor`. Older tickets are `email`."
17002
+ },
16859
17003
  "link": {
16860
17004
  "type": "string",
16861
17005
  "description": "The link from the ticket email. Present only while the ticket is usable — a dead link is noise, not a recovery path."
@@ -33840,6 +33984,39 @@
33840
33984
  "properties": {
33841
33985
  "email": {
33842
33986
  "type": "string"
33987
+ },
33988
+ "channel": {
33989
+ "anyOf": [
33990
+ {
33991
+ "anyOf": [
33992
+ {
33993
+ "type": "string",
33994
+ "enum": [
33995
+ "email"
33996
+ ]
33997
+ },
33998
+ {
33999
+ "type": "string",
34000
+ "enum": [
34001
+ "sms"
34002
+ ]
34003
+ },
34004
+ {
34005
+ "type": "string",
34006
+ "enum": [
34007
+ "whatsapp"
34008
+ ]
34009
+ },
34010
+ {
34011
+ "type": "string",
34012
+ "enum": [
34013
+ "factor"
34014
+ ]
34015
+ }
34016
+ ]
34017
+ }
34018
+ ],
34019
+ "description": "How to deliver the reset: `email` (link), `sms` / `whatsapp` (a 6-digit code to the verified phone on file). Silently falls back to the tenant default when the channel is not available for this user — the response never says which channels an account has."
33843
34020
  }
33844
34021
  }
33845
34022
  }
@@ -33934,6 +34111,183 @@
33934
34111
  }
33935
34112
  }
33936
34113
  },
34114
+ "/reset-code/verify": {
34115
+ "post": {
34116
+ "operationId": "reset_code_verify",
34117
+ "summary": "Redeem a password-reset code sent by SMS/WhatsApp",
34118
+ "tags": [
34119
+ "dbconnection"
34120
+ ],
34121
+ "description": "Second entry point to the new-password screen, for a reset delivered as a 6-digit code instead of a link. Answers the same `redirect_url` that the emailed link would land on. Five wrong codes consume the ticket; the error is always `invalid_code` and reveals nothing about the account.",
34122
+ "requestBody": {
34123
+ "required": true,
34124
+ "content": {
34125
+ "application/json": {
34126
+ "schema": {
34127
+ "type": "object",
34128
+ "required": [
34129
+ "email",
34130
+ "code"
34131
+ ],
34132
+ "properties": {
34133
+ "email": {
34134
+ "type": "string"
34135
+ },
34136
+ "code": {
34137
+ "type": "string",
34138
+ "minLength": 4,
34139
+ "maxLength": 12
34140
+ }
34141
+ },
34142
+ "additionalProperties": false
34143
+ }
34144
+ }
34145
+ }
34146
+ },
34147
+ "responses": {
34148
+ "200": {
34149
+ "description": "Default Response",
34150
+ "content": {
34151
+ "application/json": {
34152
+ "schema": {
34153
+ "type": "object",
34154
+ "required": [
34155
+ "redirect_url"
34156
+ ],
34157
+ "properties": {
34158
+ "redirect_url": {
34159
+ "type": "string"
34160
+ }
34161
+ }
34162
+ }
34163
+ }
34164
+ }
34165
+ }
34166
+ }
34167
+ }
34168
+ },
34169
+ "/dbconnections/recovery_options": {
34170
+ "post": {
34171
+ "operationId": "recovery_options",
34172
+ "summary": "Recovery channels to offer for an identifier",
34173
+ "tags": [
34174
+ "dbconnection"
34175
+ ],
34176
+ "description": "For the forgot-password screen. With the tenant's `visible` list empty (the default) it answers from configuration alone and never looks the account up. Otherwise it returns the channels the user can pick, with masked destinations.",
34177
+ "requestBody": {
34178
+ "required": true,
34179
+ "content": {
34180
+ "application/json": {
34181
+ "schema": {
34182
+ "type": "object",
34183
+ "required": [
34184
+ "email"
34185
+ ],
34186
+ "properties": {
34187
+ "email": {
34188
+ "type": "string"
34189
+ }
34190
+ },
34191
+ "additionalProperties": false
34192
+ }
34193
+ }
34194
+ }
34195
+ },
34196
+ "responses": {
34197
+ "200": {
34198
+ "description": "Default Response",
34199
+ "content": {
34200
+ "application/json": {
34201
+ "schema": {
34202
+ "type": "object",
34203
+ "required": [
34204
+ "picker",
34205
+ "default",
34206
+ "channels"
34207
+ ],
34208
+ "properties": {
34209
+ "picker": {
34210
+ "type": "boolean",
34211
+ "description": "Whether the screen should offer a choice. False when the tenant keeps `visible` empty — then nothing here depends on the account existing."
34212
+ },
34213
+ "default": {
34214
+ "anyOf": [
34215
+ {
34216
+ "type": "string",
34217
+ "enum": [
34218
+ "email"
34219
+ ]
34220
+ },
34221
+ {
34222
+ "type": "string",
34223
+ "enum": [
34224
+ "sms"
34225
+ ]
34226
+ },
34227
+ {
34228
+ "type": "string",
34229
+ "enum": [
34230
+ "whatsapp"
34231
+ ]
34232
+ },
34233
+ {
34234
+ "type": "string",
34235
+ "enum": [
34236
+ "factor"
34237
+ ]
34238
+ }
34239
+ ]
34240
+ },
34241
+ "channels": {
34242
+ "type": "array",
34243
+ "items": {
34244
+ "type": "object",
34245
+ "required": [
34246
+ "channel"
34247
+ ],
34248
+ "properties": {
34249
+ "channel": {
34250
+ "anyOf": [
34251
+ {
34252
+ "type": "string",
34253
+ "enum": [
34254
+ "email"
34255
+ ]
34256
+ },
34257
+ {
34258
+ "type": "string",
34259
+ "enum": [
34260
+ "sms"
34261
+ ]
34262
+ },
34263
+ {
34264
+ "type": "string",
34265
+ "enum": [
34266
+ "whatsapp"
34267
+ ]
34268
+ },
34269
+ {
34270
+ "type": "string",
34271
+ "enum": [
34272
+ "factor"
34273
+ ]
34274
+ }
34275
+ ]
34276
+ },
34277
+ "destination_masked": {
34278
+ "type": "string"
34279
+ }
34280
+ }
34281
+ }
34282
+ }
34283
+ }
34284
+ }
34285
+ }
34286
+ }
34287
+ }
34288
+ }
34289
+ }
34290
+ },
33937
34291
  "/dbconnections/signup": {
33938
34292
  "post": {
33939
34293
  "operationId": "signup",