@productcraft/auth 1.0.0 → 1.1.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/README.md +33 -2
- package/api.md +547 -230
- package/dist/index.cjs +868 -231
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37246 -0
- package/dist/index.d.ts +1058 -263
- package/dist/index.js +868 -231
- package/dist/index.js.map +1 -1
- package/dist/testing.d.cts +32 -0
- package/manifest.json +210 -210
- package/package.json +25 -8
package/dist/index.cjs
CHANGED
|
@@ -40,6 +40,11 @@ var AppsResource = class extends APIResource {
|
|
|
40
40
|
*
|
|
41
41
|
* The new app starts with emails to its users turned on: they go out from the workspace default sender chosen in Mail, and the default verification, welcome, password-reset, invite and sign-in code templates are created in the workspace's Mail templates (an existing template with the same name is reused). Change or turn this off with `PATCH /v1/apps/{appId}/notification-settings`.
|
|
42
42
|
*
|
|
43
|
+
* **Sign-up starts off.** A new app has `signup_enabled: false`, so `POST /{app_slug}/v1/auth/signup` answers 403 `FORBIDDEN` ("Signup is disabled for this app") until you turn it on with `PATCH /v1/apps/{app_id}/auth-config` and `{ "signup_enabled": true }`. Sign-in, invites and admin-created users work either way.
|
|
44
|
+
*
|
|
45
|
+
* Credential: `workspace_key`.
|
|
46
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
47
|
+
*
|
|
43
48
|
* @param params - `Auth.AppCreateParams`.
|
|
44
49
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
45
50
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (slug, display name, or workspaceId).
|
|
@@ -64,6 +69,9 @@ var AppsResource = class extends APIResource {
|
|
|
64
69
|
/**
|
|
65
70
|
* Delete an app permanently
|
|
66
71
|
*
|
|
72
|
+
* Credential: `workspace_key`.
|
|
73
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
74
|
+
*
|
|
67
75
|
* @param appId - Id of the app.
|
|
68
76
|
* @param options - Per-request options.
|
|
69
77
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -74,7 +82,7 @@ var AppsResource = class extends APIResource {
|
|
|
74
82
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id
|
|
75
83
|
* @example
|
|
76
84
|
* ```ts
|
|
77
|
-
* await auth.apps.delete("
|
|
85
|
+
* await auth.apps.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
78
86
|
* ```
|
|
79
87
|
*/
|
|
80
88
|
delete(appId, options) {
|
|
@@ -83,6 +91,9 @@ var AppsResource = class extends APIResource {
|
|
|
83
91
|
/**
|
|
84
92
|
* List apps in workspaces the caller is a member of. Pass `workspace_id` to scope the result to a single workspace — required from the per-workspace console page so cross-tenant memberships do not leak.
|
|
85
93
|
*
|
|
94
|
+
* Credential: `workspace_key`.
|
|
95
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
96
|
+
*
|
|
86
97
|
* @param params - `Auth.AppListParams`.
|
|
87
98
|
* @param options - Per-request options.
|
|
88
99
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid pagination cursor.
|
|
@@ -104,6 +115,9 @@ var AppsResource = class extends APIResource {
|
|
|
104
115
|
/**
|
|
105
116
|
* Get app details
|
|
106
117
|
*
|
|
118
|
+
* Credential: `workspace_key`.
|
|
119
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
120
|
+
*
|
|
107
121
|
* @param appId - Id of the app.
|
|
108
122
|
* @param options - Per-request options.
|
|
109
123
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -114,7 +128,7 @@ var AppsResource = class extends APIResource {
|
|
|
114
128
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id
|
|
115
129
|
* @example
|
|
116
130
|
* ```ts
|
|
117
|
-
* const app = await auth.apps.retrieve("
|
|
131
|
+
* const app = await auth.apps.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
118
132
|
* ```
|
|
119
133
|
*/
|
|
120
134
|
retrieve(appId, options) {
|
|
@@ -123,6 +137,9 @@ var AppsResource = class extends APIResource {
|
|
|
123
137
|
/**
|
|
124
138
|
* Update app display name, slug, metadata, and retention settings
|
|
125
139
|
*
|
|
140
|
+
* Credential: `workspace_key`.
|
|
141
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
142
|
+
*
|
|
126
143
|
* @param appId - Id of the app.
|
|
127
144
|
* @param params - `Auth.AppUpdateParams`.
|
|
128
145
|
* @param options - Per-request options.
|
|
@@ -133,7 +150,7 @@ var AppsResource = class extends APIResource {
|
|
|
133
150
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id
|
|
134
151
|
* @example
|
|
135
152
|
* ```ts
|
|
136
|
-
* const app = await auth.apps.update("
|
|
153
|
+
* const app = await auth.apps.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { audit_retention_days: 365 });
|
|
137
154
|
* ```
|
|
138
155
|
*/
|
|
139
156
|
update(appId, params, options) {
|
|
@@ -146,6 +163,9 @@ var StatsResource = class extends APIResource {
|
|
|
146
163
|
*
|
|
147
164
|
* Returns total Auth apps owned by workspaces the caller is a member of, end-users across those apps, and active API keys across those apps. Pass `workspace_id` to scope the counts to a single workspace — required from the dashboard so cross-tenant data does not bleed into the totals.
|
|
148
165
|
*
|
|
166
|
+
* Credential: `workspace_key`.
|
|
167
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
168
|
+
*
|
|
149
169
|
* @param params - `Auth.StatsMeParams`.
|
|
150
170
|
* @param options - Per-request options.
|
|
151
171
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -169,6 +189,9 @@ var StatsResource = class extends APIResource {
|
|
|
169
189
|
*
|
|
170
190
|
* Days are UTC. Counts only: no end-user identifiers. Cached for up to 60 seconds (`generated_at`).
|
|
171
191
|
*
|
|
192
|
+
* Credential: `workspace_key`.
|
|
193
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
194
|
+
*
|
|
172
195
|
* @param params - `Auth.StatsRetrieveParams`.
|
|
173
196
|
* @param options - Per-request options.
|
|
174
197
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `workspaceId` is not a UUID or `window` is not one of 1d, 7d, 30d.
|
|
@@ -206,6 +229,16 @@ var WebhooksResource = class extends APIResource {
|
|
|
206
229
|
unwrap(params) {
|
|
207
230
|
return this._client.unwrapWebhook(params, "PRODUCTCRAFT_AUTH_WEBHOOK_SECRET");
|
|
208
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Sign a test event the way ProductCraft signs deliveries (Standard Webhooks), so a handler
|
|
234
|
+
* test can call `unwrap` without a live delivery. Returns the exact body and the headers.
|
|
235
|
+
*
|
|
236
|
+
* @param params - The event (an object is JSON-encoded), and optionally the secret, `id` and `timestamp`.
|
|
237
|
+
* @throws {ConfigurationError} No secret was passed or configured.
|
|
238
|
+
*/
|
|
239
|
+
sign(params) {
|
|
240
|
+
return this._client.signWebhook(params, "PRODUCTCRAFT_AUTH_WEBHOOK_SECRET");
|
|
241
|
+
}
|
|
209
242
|
};
|
|
210
243
|
var AuthResources = class extends APIResource {
|
|
211
244
|
#apps;
|
|
@@ -225,6 +258,9 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
225
258
|
/**
|
|
226
259
|
* Mint a new hdk_live_* API key with an explicit permission scope. The raw key is returned ONCE.
|
|
227
260
|
*
|
|
261
|
+
* Credential: `workspace_key`.
|
|
262
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
263
|
+
*
|
|
228
264
|
* @param params - `Auth.ApiKeyCreateParams`.
|
|
229
265
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
230
266
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (name, empty `permissions`, a permission not matching `resource.action`, unsupported `expiresInDays`), or a malformed `Idempotency-Key`.
|
|
@@ -237,7 +273,7 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
237
273
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-api-keys
|
|
238
274
|
* @example
|
|
239
275
|
* ```ts
|
|
240
|
-
* const createApiKey = await auth.admin.app("
|
|
276
|
+
* const createApiKey = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").apiKeys.create({ name: "CI deploy bot", permissions: ["user.read", "user.list"] });
|
|
241
277
|
* ```
|
|
242
278
|
*/
|
|
243
279
|
create(params, options) {
|
|
@@ -246,6 +282,9 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
246
282
|
/**
|
|
247
283
|
* Revoke an API key. The key stops authenticating immediately; the row is kept (soft delete) so the list and the audit trail can still answer who revoked it and when.
|
|
248
284
|
*
|
|
285
|
+
* Credential: `workspace_key`.
|
|
286
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
287
|
+
*
|
|
249
288
|
* @param keyId - Id of the key.
|
|
250
289
|
* @param options - Per-request options.
|
|
251
290
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -255,7 +294,7 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
255
294
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-api-keys-key-id
|
|
256
295
|
* @example
|
|
257
296
|
* ```ts
|
|
258
|
-
* await auth.admin.app("
|
|
297
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").apiKeys.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
259
298
|
* ```
|
|
260
299
|
*/
|
|
261
300
|
delete(keyId, options) {
|
|
@@ -264,6 +303,9 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
264
303
|
/**
|
|
265
304
|
* List API keys for an app (no raw secret), newest first. Cursor-paginated: 20/page by default, 100 max.
|
|
266
305
|
*
|
|
306
|
+
* Credential: `workspace_key`.
|
|
307
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
308
|
+
*
|
|
267
309
|
* @param params - `Auth.ApiKeyListParams`.
|
|
268
310
|
* @param options - Per-request options.
|
|
269
311
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Malformed `cursor`.
|
|
@@ -273,10 +315,10 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
273
315
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-api-keys
|
|
274
316
|
* @example
|
|
275
317
|
* ```ts
|
|
276
|
-
* for await (const apiKey of auth.admin.app("
|
|
318
|
+
* for await (const apiKey of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").apiKeys.list()) {
|
|
277
319
|
* console.log(apiKey);
|
|
278
320
|
* }
|
|
279
|
-
* const page = await auth.admin.app("
|
|
321
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").apiKeys.list({}, { timeout: 5_000 });
|
|
280
322
|
* ```
|
|
281
323
|
*/
|
|
282
324
|
list(params, options) {
|
|
@@ -285,6 +327,9 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
285
327
|
/**
|
|
286
328
|
* Mint a replacement for an existing key, carrying its name and permissions over. The outgoing key keeps working for `grace_hours` (24 by default) so a fleet can roll over without downtime. The raw key is returned ONCE.
|
|
287
329
|
*
|
|
330
|
+
* Credential: `workspace_key`.
|
|
331
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
332
|
+
*
|
|
288
333
|
* @param keyId - Id of the key.
|
|
289
334
|
* @param params - `Auth.ApiKeyRotateParams`.
|
|
290
335
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -296,7 +341,7 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
296
341
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-api-keys-key-id-rotate
|
|
297
342
|
* @example
|
|
298
343
|
* ```ts
|
|
299
|
-
* const rotateApiKey = await auth.admin.app("
|
|
344
|
+
* const rotateApiKey = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").apiKeys.rotate("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { grace_hours: 24 });
|
|
300
345
|
* ```
|
|
301
346
|
*/
|
|
302
347
|
rotate(keyId, params, options) {
|
|
@@ -309,6 +354,9 @@ var AppAuditLogsResource = class extends APIResource {
|
|
|
309
354
|
*
|
|
310
355
|
* The response is streamed: rows are walked in keyset batches and written as they are read, so neither the service nor the client has to hold the whole result set. Works on both lanes — a platform bearer token and a `pcft_live_*` Platform API Key with `auth.audit.read` hit the same route. Hard cap of 1,000,000 rows per call; a wider request is refused with 413 before any body is written, so a truncated file can never masquerade as a complete one.
|
|
311
356
|
*
|
|
357
|
+
* Credential: `workspace_key`.
|
|
358
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
359
|
+
*
|
|
312
360
|
* @param params - `Auth.AuditLogExportParams`.
|
|
313
361
|
* @param options - Per-request options.
|
|
314
362
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `format`, or malformed `since` / `until`.
|
|
@@ -321,7 +369,7 @@ var AppAuditLogsResource = class extends APIResource {
|
|
|
321
369
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-audit-logs-export
|
|
322
370
|
* @example
|
|
323
371
|
* ```ts
|
|
324
|
-
* const response = await auth.admin.app("
|
|
372
|
+
* const response = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditLogs.export();
|
|
325
373
|
* const text = await response.text();
|
|
326
374
|
* ```
|
|
327
375
|
*/
|
|
@@ -331,6 +379,9 @@ var AppAuditLogsResource = class extends APIResource {
|
|
|
331
379
|
/**
|
|
332
380
|
* Append-only audit log for this app, newest first. Filter by `?action=`, `?actor_id=`, and/or the `?since=` / `?until=` date range. 20/page (max 100), cursor-paginated.
|
|
333
381
|
*
|
|
382
|
+
* Credential: `workspace_key`.
|
|
383
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
384
|
+
*
|
|
334
385
|
* @param params - `Auth.AuditLogListParams`.
|
|
335
386
|
* @param options - Per-request options.
|
|
336
387
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Malformed `cursor`, `since`, or `until`.
|
|
@@ -342,10 +393,10 @@ var AppAuditLogsResource = class extends APIResource {
|
|
|
342
393
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-audit-logs
|
|
343
394
|
* @example
|
|
344
395
|
* ```ts
|
|
345
|
-
* for await (const auditLog of auth.admin.app("
|
|
396
|
+
* for await (const auditLog of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditLogs.list()) {
|
|
346
397
|
* console.log(auditLog);
|
|
347
398
|
* }
|
|
348
|
-
* const page = await auth.admin.app("
|
|
399
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditLogs.list({}, { timeout: 5_000 });
|
|
349
400
|
* ```
|
|
350
401
|
*/
|
|
351
402
|
list(params, options) {
|
|
@@ -356,6 +407,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
356
407
|
/**
|
|
357
408
|
* Remove the audit sink. Shipping stops immediately; the audit log itself is untouched.
|
|
358
409
|
*
|
|
410
|
+
* Credential: `workspace_key`.
|
|
411
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
412
|
+
*
|
|
359
413
|
* @param options - Per-request options.
|
|
360
414
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
361
415
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.update`.
|
|
@@ -365,7 +419,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
365
419
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-audit-sink
|
|
366
420
|
* @example
|
|
367
421
|
* ```ts
|
|
368
|
-
* await auth.admin.app("
|
|
422
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.disconnect();
|
|
369
423
|
* ```
|
|
370
424
|
*/
|
|
371
425
|
disconnect(options) {
|
|
@@ -376,6 +430,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
376
430
|
*
|
|
377
431
|
* Audit rows are POSTed in batches of up to 100, signed with the same `X-Auth-Signature: t=<unix>,v1=<hex>` HMAC header as the outbound webhooks. Delivery is at-least-once: the cursor advances only after a 2xx, so a batch that times out after the receiver processed it is re-sent. Every record carries its immutable `audit_log` id, so dedupe on that. A new sink starts from the moment it is created — configuring one does not replay the existing history into your SIEM. Replacing an existing sink clears the auto-disabled state (the same "I fixed my receiver" signal a webhook PUT carries) but does NOT rewind the cursor.
|
|
378
432
|
*
|
|
433
|
+
* Credential: `workspace_key`.
|
|
434
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
435
|
+
*
|
|
379
436
|
* @param params - `Auth.AuditSinkReplaceParams`.
|
|
380
437
|
* @param options - Per-request options.
|
|
381
438
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: URL is not HTTPS, or the SSRF guard refused it (private address, unresolvable host, non-public TLD).
|
|
@@ -387,7 +444,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
387
444
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-audit-sink
|
|
388
445
|
* @example
|
|
389
446
|
* ```ts
|
|
390
|
-
* const auditSinkWithSecret = await auth.admin.app("
|
|
447
|
+
* const auditSinkWithSecret = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.replace({ url: "https://siem.customer.example.com/ingest/productcraft-auth" });
|
|
391
448
|
* ```
|
|
392
449
|
*/
|
|
393
450
|
replace(params, options) {
|
|
@@ -396,6 +453,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
396
453
|
/**
|
|
397
454
|
* Current audit sink for this app, or 404 when none is configured. Never returns the signing secret — only its last-4 hint.
|
|
398
455
|
*
|
|
456
|
+
* Credential: `workspace_key`.
|
|
457
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
458
|
+
*
|
|
399
459
|
* @param options - Per-request options.
|
|
400
460
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
401
461
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read`.
|
|
@@ -405,7 +465,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
405
465
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-audit-sink
|
|
406
466
|
* @example
|
|
407
467
|
* ```ts
|
|
408
|
-
* const auditSink = await auth.admin.app("
|
|
468
|
+
* const auditSink = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.retrieve();
|
|
409
469
|
* ```
|
|
410
470
|
*/
|
|
411
471
|
retrieve(options) {
|
|
@@ -416,6 +476,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
416
476
|
*
|
|
417
477
|
* The new secret signs every batch from now on; the old one stops at once. Update your receiver right away: batches it rejects in between are retried every minute (the position only moves after a 2xx), so nothing is lost, but export stops after 20 failures in a row. Clears the receiver-test proof.
|
|
418
478
|
*
|
|
479
|
+
* Credential: `workspace_key`.
|
|
480
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
481
|
+
*
|
|
419
482
|
* @param options - Per-request options.
|
|
420
483
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
421
484
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.update`.
|
|
@@ -425,7 +488,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
425
488
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-audit-sink-rotate-secret
|
|
426
489
|
* @example
|
|
427
490
|
* ```ts
|
|
428
|
-
* const auditSinkWithSecret = await auth.admin.app("
|
|
491
|
+
* const auditSinkWithSecret = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.rotateSecret();
|
|
429
492
|
* ```
|
|
430
493
|
*/
|
|
431
494
|
rotateSecret(options) {
|
|
@@ -436,6 +499,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
436
499
|
*
|
|
437
500
|
* Rows, in order: `destination` (not_set until a sink exists), `test_batch` (pass once the receiver accepted a test batch with the current address and secret; blocked when the last test was refused; carries `test.action: audit_sink.test`, run with `POST /v1/apps/{appId}/audit-sink/test`), and `delivery` (blocked when export stopped after repeated failures, attention while paused or while recent batches fail). Computed from the stored sink on every request; answers 200 whether or not a sink exists.
|
|
438
501
|
*
|
|
502
|
+
* Credential: `workspace_key`.
|
|
503
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
504
|
+
*
|
|
439
505
|
* @param options - Per-request options.
|
|
440
506
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
441
507
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read`, or the app is suspended or archived.
|
|
@@ -445,7 +511,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
445
511
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-audit-sink-setup-status
|
|
446
512
|
* @example
|
|
447
513
|
* ```ts
|
|
448
|
-
* const setupStatus = await auth.admin.app("
|
|
514
|
+
* const setupStatus = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.setupStatus();
|
|
449
515
|
* ```
|
|
450
516
|
*/
|
|
451
517
|
setupStatus(options) {
|
|
@@ -456,6 +522,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
456
522
|
*
|
|
457
523
|
* POSTs one signed batch, shaped exactly like a real one (`type: audit.batch`, same headers and signature), with `test: true` and a single synthetic record whose `id` starts with `test_`. Works while export is paused or stopped, so a fix can be proven before export is turned back on. The outcome is recorded on the sink (`last_attempt_*`, `last_test_succeeded_at`) but never moves the position in the audit log or counts toward the automatic stop. A refused test is still a 200 with `delivered: false`. At most 20 tests per app per hour.
|
|
458
524
|
*
|
|
525
|
+
* Credential: `workspace_key`.
|
|
526
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
527
|
+
*
|
|
459
528
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
460
529
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
461
530
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.update`.
|
|
@@ -466,7 +535,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
466
535
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-audit-sink-test
|
|
467
536
|
* @example
|
|
468
537
|
* ```ts
|
|
469
|
-
* const auditSinkTestResult = await auth.admin.app("
|
|
538
|
+
* const auditSinkTestResult = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.test();
|
|
470
539
|
* ```
|
|
471
540
|
*/
|
|
472
541
|
test(options) {
|
|
@@ -477,6 +546,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
477
546
|
*
|
|
478
547
|
* Send `url`, `enabled` or both. `enabled: false` pauses export; `enabled: true` resumes it and clears a stop after repeated failures and the failure count. The position in the audit log is never moved: nothing is skipped and nothing is replayed twice on purpose. A new `url` is checked by the same address guard as `PUT`.
|
|
479
548
|
*
|
|
549
|
+
* Credential: `workspace_key`.
|
|
550
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
551
|
+
*
|
|
480
552
|
* @param params - `Auth.AuditSinkUpdateParams`.
|
|
481
553
|
* @param options - Per-request options.
|
|
482
554
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: URL is not HTTPS, or the address guard refused it (private address, unresolvable host).
|
|
@@ -488,7 +560,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
488
560
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-audit-sink
|
|
489
561
|
* @example
|
|
490
562
|
* ```ts
|
|
491
|
-
* const auditSink = await auth.admin.app("
|
|
563
|
+
* const auditSink = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.update({ enabled: true });
|
|
492
564
|
* ```
|
|
493
565
|
*/
|
|
494
566
|
update(params, options) {
|
|
@@ -501,6 +573,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
501
573
|
*
|
|
502
574
|
* Calls the provider's token endpoint with a dummy sign-in code. If the provider refuses the client (`invalid_client`, GitHub `incorrect_client_credentials` or `unknown_client`), the result is `credentials_rejected` and the provider shows as `blocked` with reason `credentials_rejected` until the credentials are fixed. If it only refuses the code (`invalid_grant`, `bad_verification_code`), the credentials are valid. Nobody is signed in. The result is saved on the provider (`last_check_*`). The same check runs automatically whenever the credentials are saved. Works for a provider that is saved but not switched on yet.
|
|
503
575
|
*
|
|
576
|
+
* Credential: `workspace_key`.
|
|
577
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
578
|
+
*
|
|
504
579
|
* @param provider - The sign-in provider: `google`, `github` or `apple`.
|
|
505
580
|
* @param options - Per-request options.
|
|
506
581
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown provider id, or the saved config can no longer be read.
|
|
@@ -512,7 +587,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
512
587
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-auth-config-providers-provider-check
|
|
513
588
|
* @example
|
|
514
589
|
* ```ts
|
|
515
|
-
* const providerCheck = await auth.admin.app("
|
|
590
|
+
* const providerCheck = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.check("google");
|
|
516
591
|
* ```
|
|
517
592
|
*/
|
|
518
593
|
check(provider, options) {
|
|
@@ -521,6 +596,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
521
596
|
/**
|
|
522
597
|
* Remove the config for an (app, provider). Existing identity rows (people who already signed in with this provider) stay; they just lose the ability to sign in again until config is re-uploaded.
|
|
523
598
|
*
|
|
599
|
+
* Credential: `workspace_key`.
|
|
600
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
601
|
+
*
|
|
524
602
|
* @param provider - The sign-in provider: `google`, `github` or `apple`.
|
|
525
603
|
* @param options - Per-request options.
|
|
526
604
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown provider id.
|
|
@@ -530,7 +608,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
530
608
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-auth-config-providers-provider
|
|
531
609
|
* @example
|
|
532
610
|
* ```ts
|
|
533
|
-
* await auth.admin.app("
|
|
611
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.delete("google");
|
|
534
612
|
* ```
|
|
535
613
|
*/
|
|
536
614
|
delete(provider, options) {
|
|
@@ -541,6 +619,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
541
619
|
*
|
|
542
620
|
* Each entry carries `status` (`ready` | `blocked` | `disabled` | `not_configured`) and `blocked_reasons`, computed on the server with the same rule the web sign-in flow enforces, so a provider shown as `ready` is one people can actually sign in with.
|
|
543
621
|
*
|
|
622
|
+
* Credential: `workspace_key`.
|
|
623
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
624
|
+
*
|
|
544
625
|
* @param options - Per-request options.
|
|
545
626
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
546
627
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -550,7 +631,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
550
631
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-auth-config-providers
|
|
551
632
|
* @example
|
|
552
633
|
* ```ts
|
|
553
|
-
* const result = await auth.admin.app("
|
|
634
|
+
* const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.list();
|
|
554
635
|
* ```
|
|
555
636
|
*/
|
|
556
637
|
list(options) {
|
|
@@ -559,6 +640,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
559
640
|
/**
|
|
560
641
|
* Write or replace the config for an (app, provider). Validates the body via the provider impl's `parseConfig` before encrypting; malformed config 400s. Default `enabled=false`.
|
|
561
642
|
*
|
|
643
|
+
* Credential: `workspace_key`.
|
|
644
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
645
|
+
*
|
|
562
646
|
* @param provider - The sign-in provider: `google`, `github` or `apple`.
|
|
563
647
|
* @param params - `Auth.AuthConfigProviderReplaceParams`.
|
|
564
648
|
* @param options - Per-request options.
|
|
@@ -569,7 +653,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
569
653
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-auth-config-providers-provider
|
|
570
654
|
* @example
|
|
571
655
|
* ```ts
|
|
572
|
-
* const providerDetail = await auth.admin.app("
|
|
656
|
+
* const providerDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.replace("google", { config: {} });
|
|
573
657
|
* ```
|
|
574
658
|
*/
|
|
575
659
|
replace(provider, params, options) {
|
|
@@ -578,6 +662,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
578
662
|
/**
|
|
579
663
|
* Get the config for one (app, provider). Secrets are redacted — `private_key_present: true` is the only acknowledgement that a private key is on file.
|
|
580
664
|
*
|
|
665
|
+
* Credential: `workspace_key`.
|
|
666
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
667
|
+
*
|
|
581
668
|
* @param provider - The sign-in provider: `google`, `github` or `apple`.
|
|
582
669
|
* @param options - Per-request options.
|
|
583
670
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown provider id.
|
|
@@ -588,7 +675,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
588
675
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-auth-config-providers-provider
|
|
589
676
|
* @example
|
|
590
677
|
* ```ts
|
|
591
|
-
* const providerDetail = await auth.admin.app("
|
|
678
|
+
* const providerDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.retrieve("google");
|
|
592
679
|
* ```
|
|
593
680
|
*/
|
|
594
681
|
retrieve(provider, options) {
|
|
@@ -597,6 +684,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
597
684
|
/**
|
|
598
685
|
* Partially update the config for an (app, provider). Only top-level keys present in `config` are changed; omitted keys — secrets included — keep their stored values. The merged config is validated by the provider impl's `parseConfig`; 404 if the provider is not configured yet (create it with PUT).
|
|
599
686
|
*
|
|
687
|
+
* Credential: `workspace_key`.
|
|
688
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
689
|
+
*
|
|
600
690
|
* @param provider - The sign-in provider: `google`, `github` or `apple`.
|
|
601
691
|
* @param params - `Auth.AuthConfigProviderUpdateParams`.
|
|
602
692
|
* @param options - Per-request options.
|
|
@@ -608,7 +698,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
608
698
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-auth-config-providers-provider
|
|
609
699
|
* @example
|
|
610
700
|
* ```ts
|
|
611
|
-
* const providerDetail = await auth.admin.app("
|
|
701
|
+
* const providerDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.update("google", { config: {} });
|
|
612
702
|
* ```
|
|
613
703
|
*/
|
|
614
704
|
update(provider, params, options) {
|
|
@@ -623,6 +713,9 @@ var AppAuthConfigResource = class extends APIResource {
|
|
|
623
713
|
/**
|
|
624
714
|
* Get the per-app auth config (signup, signin, password policy, sessions).
|
|
625
715
|
*
|
|
716
|
+
* Credential: `workspace_key`.
|
|
717
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
718
|
+
*
|
|
626
719
|
* @param options - Per-request options.
|
|
627
720
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
628
721
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -632,7 +725,7 @@ var AppAuthConfigResource = class extends APIResource {
|
|
|
632
725
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-auth-config
|
|
633
726
|
* @example
|
|
634
727
|
* ```ts
|
|
635
|
-
* const authConfig = await auth.admin.app("
|
|
728
|
+
* const authConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.retrieve();
|
|
636
729
|
* ```
|
|
637
730
|
*/
|
|
638
731
|
retrieve(options) {
|
|
@@ -641,6 +734,9 @@ var AppAuthConfigResource = class extends APIResource {
|
|
|
641
734
|
/**
|
|
642
735
|
* Update the per-app auth config. Only fields you pass are changed.
|
|
643
736
|
*
|
|
737
|
+
* Credential: `workspace_key`.
|
|
738
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
739
|
+
*
|
|
644
740
|
* @param params - `Auth.AuthConfigUpdateParams`.
|
|
645
741
|
* @param options - Per-request options.
|
|
646
742
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure — a value out of range (password length, token/session lifetimes, lockout threshold, max sessions, MFA grace days, unverified-account window), an unknown enum value, a `signup_default_role` that does not exist in this app, or a `bot_protection` change that cannot stand: no provider or site key on first setup, a hostname that is not a hostname, or `enabled: true` with no secret stored or sent.
|
|
@@ -653,7 +749,7 @@ var AppAuthConfigResource = class extends APIResource {
|
|
|
653
749
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-auth-config
|
|
654
750
|
* @example
|
|
655
751
|
* ```ts
|
|
656
|
-
* const authConfig = await auth.admin.app("
|
|
752
|
+
* const authConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.update({ access_token_minutes: 60 });
|
|
657
753
|
* ```
|
|
658
754
|
*/
|
|
659
755
|
update(params, options) {
|
|
@@ -672,6 +768,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
672
768
|
/**
|
|
673
769
|
* Create a new M2M client
|
|
674
770
|
*
|
|
771
|
+
* Credential: `workspace_key`.
|
|
772
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
773
|
+
*
|
|
675
774
|
* @param params - `Auth.CredentialCreateParams`.
|
|
676
775
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
677
776
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (missing or invalid name).
|
|
@@ -684,7 +783,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
684
783
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-credentials
|
|
685
784
|
* @example
|
|
686
785
|
* ```ts
|
|
687
|
-
* const m2mClientCreate = await auth.admin.app("
|
|
786
|
+
* const m2mClientCreate = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.create({ name: "CI Pipeline" });
|
|
688
787
|
* ```
|
|
689
788
|
*/
|
|
690
789
|
create(params, options) {
|
|
@@ -693,6 +792,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
693
792
|
/**
|
|
694
793
|
* Delete an M2M client
|
|
695
794
|
*
|
|
795
|
+
* Credential: `workspace_key`.
|
|
796
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
797
|
+
*
|
|
696
798
|
* @param clientId - Id of the client.
|
|
697
799
|
* @param options - Per-request options.
|
|
698
800
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -703,7 +805,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
703
805
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-credentials-client-id
|
|
704
806
|
* @example
|
|
705
807
|
* ```ts
|
|
706
|
-
* await auth.admin.app("
|
|
808
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.delete("m2m_a1b2c3d4e5f6");
|
|
707
809
|
* ```
|
|
708
810
|
*/
|
|
709
811
|
delete(clientId, options) {
|
|
@@ -712,6 +814,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
712
814
|
/**
|
|
713
815
|
* List M2M clients
|
|
714
816
|
*
|
|
817
|
+
* Credential: `workspace_key`.
|
|
818
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
819
|
+
*
|
|
715
820
|
* @param params - `Auth.CredentialListParams`.
|
|
716
821
|
* @param options - Per-request options.
|
|
717
822
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -722,10 +827,10 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
722
827
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-credentials
|
|
723
828
|
* @example
|
|
724
829
|
* ```ts
|
|
725
|
-
* for await (const credential of auth.admin.app("
|
|
830
|
+
* for await (const credential of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.list()) {
|
|
726
831
|
* console.log(credential);
|
|
727
832
|
* }
|
|
728
|
-
* const page = await auth.admin.app("
|
|
833
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.list({}, { timeout: 5_000 });
|
|
729
834
|
* ```
|
|
730
835
|
*/
|
|
731
836
|
list(params, options) {
|
|
@@ -734,6 +839,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
734
839
|
/**
|
|
735
840
|
* Get M2M client details
|
|
736
841
|
*
|
|
842
|
+
* Credential: `workspace_key`.
|
|
843
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
844
|
+
*
|
|
737
845
|
* @param clientId - Id of the client.
|
|
738
846
|
* @param options - Per-request options.
|
|
739
847
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -744,7 +852,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
744
852
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-credentials-client-id
|
|
745
853
|
* @example
|
|
746
854
|
* ```ts
|
|
747
|
-
* const m2mClientDetail = await auth.admin.app("
|
|
855
|
+
* const m2mClientDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.retrieve("m2m_a1b2c3d4e5f6");
|
|
748
856
|
* ```
|
|
749
857
|
*/
|
|
750
858
|
retrieve(clientId, options) {
|
|
@@ -753,6 +861,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
753
861
|
/**
|
|
754
862
|
* Rotate M2M client secret
|
|
755
863
|
*
|
|
864
|
+
* Credential: `workspace_key`.
|
|
865
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
866
|
+
*
|
|
756
867
|
* @param clientId - Id of the client.
|
|
757
868
|
* @param options - Per-request options.
|
|
758
869
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -763,7 +874,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
763
874
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-credentials-client-id-rotate
|
|
764
875
|
* @example
|
|
765
876
|
* ```ts
|
|
766
|
-
* const m2mRotateSecret = await auth.admin.app("
|
|
877
|
+
* const m2mRotateSecret = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.rotate("m2m_a1b2c3d4e5f6");
|
|
767
878
|
* ```
|
|
768
879
|
*/
|
|
769
880
|
rotate(clientId, options) {
|
|
@@ -772,6 +883,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
772
883
|
/**
|
|
773
884
|
* Update M2M client status
|
|
774
885
|
*
|
|
886
|
+
* Credential: `workspace_key`.
|
|
887
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
888
|
+
*
|
|
775
889
|
* @param clientId - Id of the client.
|
|
776
890
|
* @param params - `Auth.CredentialUpdateParams`.
|
|
777
891
|
* @param options - Per-request options.
|
|
@@ -784,7 +898,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
784
898
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-credentials-client-id
|
|
785
899
|
* @example
|
|
786
900
|
* ```ts
|
|
787
|
-
* const m2mClientDetail = await auth.admin.app("
|
|
901
|
+
* const m2mClientDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.update("m2m_a1b2c3d4e5f6", { is_active: true });
|
|
788
902
|
* ```
|
|
789
903
|
*/
|
|
790
904
|
update(clientId, params, options) {
|
|
@@ -793,6 +907,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
793
907
|
/**
|
|
794
908
|
* Set scopes for an M2M client
|
|
795
909
|
*
|
|
910
|
+
* Credential: `workspace_key`.
|
|
911
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
912
|
+
*
|
|
796
913
|
* @param clientId - Id of the client.
|
|
797
914
|
* @param params - `Auth.CredentialUpdateScopesParams`.
|
|
798
915
|
* @param options - Per-request options.
|
|
@@ -805,7 +922,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
805
922
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-credentials-client-id-scopes
|
|
806
923
|
* @example
|
|
807
924
|
* ```ts
|
|
808
|
-
* const result = await auth.admin.app("
|
|
925
|
+
* const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.updateScopes("m2m_a1b2c3d4e5f6", { permissions: ["user.read", "app.read"] });
|
|
809
926
|
* ```
|
|
810
927
|
*/
|
|
811
928
|
updateScopes(clientId, params, options) {
|
|
@@ -842,6 +959,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
842
959
|
*
|
|
843
960
|
* Reads the zone through the provider's API and plans both records: `create`, or `skip` when already there. Nothing is ever changed or deleted, and only names at or under the custom host are written (Cloudflare records are DNS-only, not proxied). Anything in the way (another CNAME at the host, A/MX/TXT records where the CNAME must go) refuses the whole apply with 409 and the plan, before anything is written. `dry_run: true` returns the plan and changes nothing; `dry_run: false` writes exactly that plan and runs a check straight away (the records are usually `propagating` for a few minutes). The token is used for this request only: never stored, logged, queued or returned; revoke it afterwards (`warnings` says so when it could see more than this zone).
|
|
844
961
|
*
|
|
962
|
+
* Credential: `workspace_key`.
|
|
963
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
964
|
+
*
|
|
845
965
|
* @param domainId - Id of the domain.
|
|
846
966
|
* @param params - `Auth.CustomDomainApplyParams`.
|
|
847
967
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -856,7 +976,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
856
976
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-custom-domains-domain-id-apply
|
|
857
977
|
* @example
|
|
858
978
|
* ```ts
|
|
859
|
-
* const customDomainApplyResult = await auth.admin.app("
|
|
979
|
+
* const customDomainApplyResult = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.apply("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { dry_run: true, provider: "cloudflare", token: "cf-token-from-your-dashboard" });
|
|
860
980
|
* ```
|
|
861
981
|
*/
|
|
862
982
|
apply(domainId, params, options) {
|
|
@@ -867,6 +987,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
867
987
|
*
|
|
868
988
|
* Asks the zone's own nameservers and a public resolver for both records, stores each record's state and conflicts, and moves the status: `active` once both are verified; an active domain turns `failing` only when a record is definitely gone or blocked (a DNS outage never takes a working domain down). Safe to repeat.
|
|
869
989
|
*
|
|
990
|
+
* Credential: `workspace_key`.
|
|
991
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
992
|
+
*
|
|
870
993
|
* @param domainId - Id of the domain.
|
|
871
994
|
* @param options - Per-request options.
|
|
872
995
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `domainId` is not a UUID.
|
|
@@ -878,7 +1001,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
878
1001
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-custom-domains-domain-id-check
|
|
879
1002
|
* @example
|
|
880
1003
|
* ```ts
|
|
881
|
-
* const customDomain = await auth.admin.app("
|
|
1004
|
+
* const customDomain = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.check("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
882
1005
|
* ```
|
|
883
1006
|
*/
|
|
884
1007
|
check(domainId, options) {
|
|
@@ -889,6 +1012,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
889
1012
|
*
|
|
890
1013
|
* Returns the two records to publish: a CNAME from the host to `edge_target`, and a TXT token at `_productcraft-auth.<host>` that proves the domain is yours. The zone and its DNS provider are detected, and the first check runs straight away, so `records[].state` and `conflicts` already say what is missing or in the way. Publish the records by hand, import `…/export`, or let `…/apply` write them with a short-lived provider token. The domain turns `active` once both records are seen. Sign-in tokens keep the canonical issuer (`https://api.auth.productcraft.co/{slug}`), so nothing changes for code that verifies them. One custom domain per app. While the feature is in early access it is switched on per workspace.
|
|
891
1014
|
*
|
|
1015
|
+
* Credential: `workspace_key`.
|
|
1016
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1017
|
+
*
|
|
892
1018
|
* @param params - `Auth.CustomDomainCreateParams`.
|
|
893
1019
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
894
1020
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR, INVALID_HOSTNAME, HOSTNAME_RESERVED, APEX_NOT_SUPPORTED: Not a usable host name (`INVALID_HOSTNAME`), one of ours (`HOSTNAME_RESERVED`), or the root of a DNS zone, which cannot hold a CNAME (`APEX_NOT_SUPPORTED`).
|
|
@@ -901,7 +1027,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
901
1027
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-custom-domains
|
|
902
1028
|
* @example
|
|
903
1029
|
* ```ts
|
|
904
|
-
* const customDomain = await auth.admin.app("
|
|
1030
|
+
* const customDomain = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.create({ hostname: "auth.acme.com" });
|
|
905
1031
|
* ```
|
|
906
1032
|
*/
|
|
907
1033
|
create(params, options) {
|
|
@@ -912,6 +1038,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
912
1038
|
*
|
|
913
1039
|
* The host stops serving this app at once and its certificate is no longer renewed. Your DNS records are not touched: delete the CNAME and the `_productcraft-auth` TXT record at your DNS provider. Sign-ins on the canonical host are unaffected.
|
|
914
1040
|
*
|
|
1041
|
+
* Credential: `workspace_key`.
|
|
1042
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1043
|
+
*
|
|
915
1044
|
* @param domainId - Id of the domain.
|
|
916
1045
|
* @param options - Per-request options.
|
|
917
1046
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `domainId` is not a UUID.
|
|
@@ -923,7 +1052,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
923
1052
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-custom-domains-domain-id
|
|
924
1053
|
* @example
|
|
925
1054
|
* ```ts
|
|
926
|
-
* await auth.admin.app("
|
|
1055
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
927
1056
|
* ```
|
|
928
1057
|
*/
|
|
929
1058
|
delete(domainId, options) {
|
|
@@ -934,6 +1063,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
934
1063
|
*
|
|
935
1064
|
* `format=bind`: a zone-file fragment (`$ORIGIN <zone>.`, `$TTL 3600`, names relative to the zone, a comment per record with its purpose and any conflict) that Cloudflare and Route 53 import directly. `format=csv`: `type,name,value,priority,ttl,purpose,required`, fully qualified names. By default only records not verified yet; `all=true` for both. Served as an attachment.
|
|
936
1065
|
*
|
|
1066
|
+
* Credential: `workspace_key`.
|
|
1067
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1068
|
+
*
|
|
937
1069
|
* @param domainId - Id of the domain.
|
|
938
1070
|
* @param params - `Auth.CustomDomainExportParams`.
|
|
939
1071
|
* @param options - Per-request options.
|
|
@@ -946,7 +1078,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
946
1078
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-custom-domains-domain-id-export
|
|
947
1079
|
* @example
|
|
948
1080
|
* ```ts
|
|
949
|
-
* const response = await auth.admin.app("
|
|
1081
|
+
* const response = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.export("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { format: "bind" });
|
|
950
1082
|
* const text = await response.text();
|
|
951
1083
|
* ```
|
|
952
1084
|
*/
|
|
@@ -958,6 +1090,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
958
1090
|
*
|
|
959
1091
|
* Each with its status and the last check of its records, plus `available`: whether custom domains are switched on for the workspace. Always a single page.
|
|
960
1092
|
*
|
|
1093
|
+
* Credential: `workspace_key`.
|
|
1094
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1095
|
+
*
|
|
961
1096
|
* @param options - Per-request options.
|
|
962
1097
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
963
1098
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -967,7 +1102,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
967
1102
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-custom-domains
|
|
968
1103
|
* @example
|
|
969
1104
|
* ```ts
|
|
970
|
-
* for await (const customDomain of auth.admin.app("
|
|
1105
|
+
* for await (const customDomain of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.list()) {
|
|
971
1106
|
* console.log(customDomain);
|
|
972
1107
|
* }
|
|
973
1108
|
* ```
|
|
@@ -980,6 +1115,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
980
1115
|
*
|
|
981
1116
|
* Reads stored state only; `POST …/check` runs a new DNS check.
|
|
982
1117
|
*
|
|
1118
|
+
* Credential: `workspace_key`.
|
|
1119
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1120
|
+
*
|
|
983
1121
|
* @param domainId - Id of the domain.
|
|
984
1122
|
* @param options - Per-request options.
|
|
985
1123
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `domainId` is not a UUID.
|
|
@@ -991,7 +1129,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
991
1129
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-custom-domains-domain-id
|
|
992
1130
|
* @example
|
|
993
1131
|
* ```ts
|
|
994
|
-
* const customDomain = await auth.admin.app("
|
|
1132
|
+
* const customDomain = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
995
1133
|
* ```
|
|
996
1134
|
*/
|
|
997
1135
|
retrieve(domainId, options) {
|
|
@@ -1002,6 +1140,9 @@ var AppEndUserInsightsUsersResource = class extends APIResource {
|
|
|
1002
1140
|
/**
|
|
1003
1141
|
* One end-user's recorded activity: their audit trail, their sessions with device/IP, and their enrolled factors. `noActivityRecorded` distinguishes "nothing happened" from "no data".
|
|
1004
1142
|
*
|
|
1143
|
+
* Credential: `workspace_key`.
|
|
1144
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1145
|
+
*
|
|
1005
1146
|
* @param userId - Id of the user.
|
|
1006
1147
|
* @param options - Per-request options.
|
|
1007
1148
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `appId` or `userId` is not a UUID.
|
|
@@ -1013,7 +1154,7 @@ var AppEndUserInsightsUsersResource = class extends APIResource {
|
|
|
1013
1154
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-user-insights-users-user-id
|
|
1014
1155
|
* @example
|
|
1015
1156
|
* ```ts
|
|
1016
|
-
* const endUserDetailInsights = await auth.admin.app("
|
|
1157
|
+
* const endUserDetailInsights = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUserInsights.users.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1017
1158
|
* ```
|
|
1018
1159
|
*/
|
|
1019
1160
|
retrieve(userId, options) {
|
|
@@ -1028,6 +1169,9 @@ var AppEndUserInsightsResource = class extends APIResource {
|
|
|
1028
1169
|
/**
|
|
1029
1170
|
* Auth health for this app over the last 30 days: verification completion, sign-in failure rate, MFA adoption, password-reset follow-through, and session counts. Rates are null when there is nothing to divide by.
|
|
1030
1171
|
*
|
|
1172
|
+
* Credential: `workspace_key`.
|
|
1173
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1174
|
+
*
|
|
1031
1175
|
* @param options - Per-request options.
|
|
1032
1176
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `appId` is not a UUID.
|
|
1033
1177
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -1037,7 +1181,7 @@ var AppEndUserInsightsResource = class extends APIResource {
|
|
|
1037
1181
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-user-insights
|
|
1038
1182
|
* @example
|
|
1039
1183
|
* ```ts
|
|
1040
|
-
* const endUserInsights = await auth.admin.app("
|
|
1184
|
+
* const endUserInsights = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUserInsights.retrieve();
|
|
1041
1185
|
* ```
|
|
1042
1186
|
*/
|
|
1043
1187
|
retrieve(options) {
|
|
@@ -1048,6 +1192,9 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1048
1192
|
/**
|
|
1049
1193
|
* Add a contact for an end-user (unverified).
|
|
1050
1194
|
*
|
|
1195
|
+
* Credential: `workspace_key`.
|
|
1196
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1197
|
+
*
|
|
1051
1198
|
* @param userId - Id of the user.
|
|
1052
1199
|
* @param params - `Auth.EndUserContactCreateParams`.
|
|
1053
1200
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -1061,7 +1208,7 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1061
1208
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-contacts
|
|
1062
1209
|
* @example
|
|
1063
1210
|
* ```ts
|
|
1064
|
-
* const accountContact = await auth.admin.app("
|
|
1211
|
+
* const accountContact = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.contacts.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { type: "email", value: "ada@example.com" });
|
|
1065
1212
|
* ```
|
|
1066
1213
|
*/
|
|
1067
1214
|
create(userId, params, options) {
|
|
@@ -1070,6 +1217,9 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1070
1217
|
/**
|
|
1071
1218
|
* Delete a contact from an end-user.
|
|
1072
1219
|
*
|
|
1220
|
+
* Credential: `workspace_key`.
|
|
1221
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1222
|
+
*
|
|
1073
1223
|
* @param userId - Id of the user.
|
|
1074
1224
|
* @param contactId - Id of the contact.
|
|
1075
1225
|
* @param options - Per-request options.
|
|
@@ -1082,7 +1232,7 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1082
1232
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-end-users-user-id-contacts-contact-id
|
|
1083
1233
|
* @example
|
|
1084
1234
|
* ```ts
|
|
1085
|
-
* await auth.admin.app("
|
|
1235
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.contacts.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1086
1236
|
* ```
|
|
1087
1237
|
*/
|
|
1088
1238
|
delete(userId, contactId, options) {
|
|
@@ -1091,6 +1241,9 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1091
1241
|
/**
|
|
1092
1242
|
* List an end-user's contacts.
|
|
1093
1243
|
*
|
|
1244
|
+
* Credential: `workspace_key`.
|
|
1245
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1246
|
+
*
|
|
1094
1247
|
* @param userId - Id of the user.
|
|
1095
1248
|
* @param options - Per-request options.
|
|
1096
1249
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1101,7 +1254,7 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1101
1254
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users-user-id-contacts
|
|
1102
1255
|
* @example
|
|
1103
1256
|
* ```ts
|
|
1104
|
-
* const accountContactList = await auth.admin.app("
|
|
1257
|
+
* const accountContactList = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.contacts.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1105
1258
|
* ```
|
|
1106
1259
|
*/
|
|
1107
1260
|
list(userId, options) {
|
|
@@ -1110,6 +1263,9 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1110
1263
|
/**
|
|
1111
1264
|
* Promote a verified contact to primary.
|
|
1112
1265
|
*
|
|
1266
|
+
* Credential: `workspace_key`.
|
|
1267
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1268
|
+
*
|
|
1113
1269
|
* @param userId - Id of the user.
|
|
1114
1270
|
* @param contactId - Id of the contact.
|
|
1115
1271
|
* @param options - Per-request options.
|
|
@@ -1122,7 +1278,7 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1122
1278
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-contacts-contact-id-promote
|
|
1123
1279
|
* @example
|
|
1124
1280
|
* ```ts
|
|
1125
|
-
* await auth.admin.app("
|
|
1281
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.contacts.promote("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1126
1282
|
* ```
|
|
1127
1283
|
*/
|
|
1128
1284
|
promote(userId, contactId, options) {
|
|
@@ -1131,6 +1287,9 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1131
1287
|
/**
|
|
1132
1288
|
* Reissue a verification code for a contact.
|
|
1133
1289
|
*
|
|
1290
|
+
* Credential: `workspace_key`.
|
|
1291
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1292
|
+
*
|
|
1134
1293
|
* @param userId - Id of the user.
|
|
1135
1294
|
* @param contactId - Id of the contact.
|
|
1136
1295
|
* @param options - Per-request options.
|
|
@@ -1143,7 +1302,7 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1143
1302
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-contacts-contact-id-resend-verification
|
|
1144
1303
|
* @example
|
|
1145
1304
|
* ```ts
|
|
1146
|
-
* const issuedVerificationCode = await auth.admin.app("
|
|
1305
|
+
* const issuedVerificationCode = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.contacts.resendVerification("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1147
1306
|
* ```
|
|
1148
1307
|
*/
|
|
1149
1308
|
resendVerification(userId, contactId, options) {
|
|
@@ -1156,6 +1315,9 @@ var AppEndUsersImportsResource = class extends APIResource {
|
|
|
1156
1315
|
*
|
|
1157
1316
|
* Row fields: `email` (required), `username`, `display_name`, `role`, `tenant_slugs` (array), `external_id`, `metadata`, `email_verified`, and `password_hash` + `password_hash_algorithm`. `password_hash_algorithm` is `argon2id` or `bcrypt`. **argon2id** hashes are accepted at any parameters. **bcrypt** hashes (`$2a$`, `$2b$`, `$2y$` — Auth0, PHP `password_hash`, Spring, node `bcrypt`, Devise / Rails, Laravel, Django) are accepted at any valid cost (4-31), verified on the user's first signin and replaced by an argon2id hash of the same password in that request, so the user keeps their password and never notices. Signin pads a bcrypt verify up to the argon2id floor, so at cost 10 and below an imported account cannot be told apart by timing; at cost 11 and above the verify is slower than the floor and answers when it finishes — a small timing difference on migrated accounts only, gone after each one's first signin. A re-run is idempotent: rows match on `external_id` first, then the primary email, and update rather than duplicate. An existing password, an already-verified address and an existing member's role are never overwritten — see the module docs for why each one.
|
|
1158
1317
|
*
|
|
1318
|
+
* Credential: `workspace_key`.
|
|
1319
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1320
|
+
*
|
|
1159
1321
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
1160
1322
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Body is empty or contains no NDJSON rows.
|
|
1161
1323
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -1167,7 +1329,7 @@ var AppEndUsersImportsResource = class extends APIResource {
|
|
|
1167
1329
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-import
|
|
1168
1330
|
* @example
|
|
1169
1331
|
* ```ts
|
|
1170
|
-
* const importJob = await auth.admin.app("
|
|
1332
|
+
* const importJob = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.imports.create();
|
|
1171
1333
|
* ```
|
|
1172
1334
|
*/
|
|
1173
1335
|
create(options) {
|
|
@@ -1178,6 +1340,9 @@ var AppEndUsersImportsResource = class extends APIResource {
|
|
|
1178
1340
|
*
|
|
1179
1341
|
* `status: succeeded` means the job RAN TO COMPLETION, not that every row landed — read `failed_count` and `errors` for that. `errors` is capped at the first 500 entries; the counts stay exact.
|
|
1180
1342
|
*
|
|
1343
|
+
* Credential: `workspace_key`.
|
|
1344
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1345
|
+
*
|
|
1181
1346
|
* @param jobId - Id of the job.
|
|
1182
1347
|
* @param options - Per-request options.
|
|
1183
1348
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -1188,7 +1353,7 @@ var AppEndUsersImportsResource = class extends APIResource {
|
|
|
1188
1353
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users-import-job-id
|
|
1189
1354
|
* @example
|
|
1190
1355
|
* ```ts
|
|
1191
|
-
* const importJob = await auth.admin.app("
|
|
1356
|
+
* const importJob = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.imports.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1192
1357
|
* ```
|
|
1193
1358
|
*/
|
|
1194
1359
|
retrieve(jobId, options) {
|
|
@@ -1199,6 +1364,9 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1199
1364
|
/**
|
|
1200
1365
|
* Pre-allocate an EndUser invite. Dispatches an invitation email via the workspace's Mail sender.
|
|
1201
1366
|
*
|
|
1367
|
+
* Credential: `workspace_key`.
|
|
1368
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1369
|
+
*
|
|
1202
1370
|
* @param params - `Auth.EndUserInviteCreateParams`.
|
|
1203
1371
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
1204
1372
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown role, or maxUses / expiresInHours out of range.
|
|
@@ -1209,7 +1377,7 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1209
1377
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-invites
|
|
1210
1378
|
* @example
|
|
1211
1379
|
* ```ts
|
|
1212
|
-
* const endUserInvite = await auth.admin.app("
|
|
1380
|
+
* const endUserInvite = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.invites.create({ email: "alice@example.com" });
|
|
1213
1381
|
* ```
|
|
1214
1382
|
*/
|
|
1215
1383
|
create(params, options) {
|
|
@@ -1218,6 +1386,9 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1218
1386
|
/**
|
|
1219
1387
|
* Revoke an EndUser invite (soft-delete).
|
|
1220
1388
|
*
|
|
1389
|
+
* Credential: `workspace_key`.
|
|
1390
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1391
|
+
*
|
|
1221
1392
|
* @param inviteId - Id of the invite.
|
|
1222
1393
|
* @param options - Per-request options.
|
|
1223
1394
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1228,7 +1399,7 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1228
1399
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-end-users-invites-invite-id
|
|
1229
1400
|
* @example
|
|
1230
1401
|
* ```ts
|
|
1231
|
-
* await auth.admin.app("
|
|
1402
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.invites.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1232
1403
|
* ```
|
|
1233
1404
|
*/
|
|
1234
1405
|
delete(inviteId, options) {
|
|
@@ -1237,6 +1408,9 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1237
1408
|
/**
|
|
1238
1409
|
* List EndUser invites for this app, newest first. Filter by `?status=`.
|
|
1239
1410
|
*
|
|
1411
|
+
* Credential: `workspace_key`.
|
|
1412
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1413
|
+
*
|
|
1240
1414
|
* @param params - `Auth.EndUserInviteListParams`.
|
|
1241
1415
|
* @param options - Per-request options.
|
|
1242
1416
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `status` value.
|
|
@@ -1246,10 +1420,10 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1246
1420
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users-invites
|
|
1247
1421
|
* @example
|
|
1248
1422
|
* ```ts
|
|
1249
|
-
* for await (const invite of auth.admin.app("
|
|
1423
|
+
* for await (const invite of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.invites.list()) {
|
|
1250
1424
|
* console.log(invite);
|
|
1251
1425
|
* }
|
|
1252
|
-
* const page = await auth.admin.app("
|
|
1426
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.invites.list({}, { timeout: 5_000 });
|
|
1253
1427
|
* ```
|
|
1254
1428
|
*/
|
|
1255
1429
|
list(params, options) {
|
|
@@ -1262,6 +1436,9 @@ var AppEndUsersMfaResource = class extends APIResource {
|
|
|
1262
1436
|
*
|
|
1263
1437
|
* Disables every enabled factor on the account, destroys its recovery codes, and revokes every live session. The next sign-in on an app running `auth_config.mfa: "required"` returns `mfa_enrollment_required` and the user must enrol a new factor before a session is minted. On an app running `mfa: "optional"` the user simply ends up with no MFA, which is the pre-existing meaning of deleting their factors. All three steps matter: leaving the recovery codes alive would let whoever holds the old printout complete `/auth/mfa/recover` and skip enrolment entirely. Audited, and emits `user.mfa.factor_disabled` per factor plus one `user.mfa.reenrollment_required`. Idempotent.
|
|
1264
1438
|
*
|
|
1439
|
+
* Credential: `workspace_key`.
|
|
1440
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1441
|
+
*
|
|
1265
1442
|
* @param userId - Id of the user.
|
|
1266
1443
|
* @param options - Per-request options.
|
|
1267
1444
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -1272,7 +1449,7 @@ var AppEndUsersMfaResource = class extends APIResource {
|
|
|
1272
1449
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-mfa-require-reenrollment
|
|
1273
1450
|
* @example
|
|
1274
1451
|
* ```ts
|
|
1275
|
-
* const requireMfaReenrollment = await auth.admin.app("
|
|
1452
|
+
* const requireMfaReenrollment = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.mfa.requireReenrollment("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1276
1453
|
* ```
|
|
1277
1454
|
*/
|
|
1278
1455
|
requireReenrollment(userId, options) {
|
|
@@ -1283,6 +1460,9 @@ var AppEndUsersSessionsResource = class extends APIResource {
|
|
|
1283
1460
|
/**
|
|
1284
1461
|
* Revoke every active session for an end-user.
|
|
1285
1462
|
*
|
|
1463
|
+
* Credential: `workspace_key`.
|
|
1464
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1465
|
+
*
|
|
1286
1466
|
* @param userId - Id of the user.
|
|
1287
1467
|
* @param options - Per-request options.
|
|
1288
1468
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1293,7 +1473,7 @@ var AppEndUsersSessionsResource = class extends APIResource {
|
|
|
1293
1473
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-sessions-revoke-all
|
|
1294
1474
|
* @example
|
|
1295
1475
|
* ```ts
|
|
1296
|
-
* await auth.admin.app("
|
|
1476
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.sessions.revokeAll("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1297
1477
|
* ```
|
|
1298
1478
|
*/
|
|
1299
1479
|
revokeAll(userId, options) {
|
|
@@ -1326,6 +1506,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1326
1506
|
*
|
|
1327
1507
|
* Deletes every matched account in one transaction. Each deleted account gets an `auth.account.deleted` audit row (`via: platform_bulk`) whose metadata carries the `selection` (`{ mode: "ids" }`, or `{ mode: "filter", filter }`), so a filter sweep reads as one. The workspace audit log gets one `auth.end_users.deleted` row with the count. `user.deleted` (`via: "platform_bulk"`) fires per account only when 100 or fewer were deleted.
|
|
1328
1508
|
*
|
|
1509
|
+
* Credential: `workspace_key`.
|
|
1510
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1511
|
+
*
|
|
1329
1512
|
* @param params - `Auth.EndUserBulkDeleteParams`.
|
|
1330
1513
|
* @param options - Per-request options.
|
|
1331
1514
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid `selection` body, or an unfiltered selection without `confirm_all_in_app: true` (including more than 5,000 ids).
|
|
@@ -1337,7 +1520,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1337
1520
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-bulk-delete
|
|
1338
1521
|
* @example
|
|
1339
1522
|
* ```ts
|
|
1340
|
-
* const bulkAffectedUsers = await auth.admin.app("
|
|
1523
|
+
* const bulkAffectedUsers = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.bulkDelete({ selection: { mode: "ids" } });
|
|
1341
1524
|
* ```
|
|
1342
1525
|
*/
|
|
1343
1526
|
bulkDelete(params, options) {
|
|
@@ -1346,6 +1529,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1346
1529
|
/**
|
|
1347
1530
|
* Bulk-revoke sessions across a selection.
|
|
1348
1531
|
*
|
|
1532
|
+
* Credential: `workspace_key`.
|
|
1533
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1534
|
+
*
|
|
1349
1535
|
* @param params - `Auth.EndUserBulkRevokeSessionsParams`.
|
|
1350
1536
|
* @param options - Per-request options.
|
|
1351
1537
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid `selection` body (including more than 5,000 ids).
|
|
@@ -1357,7 +1543,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1357
1543
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-bulk-revoke-sessions
|
|
1358
1544
|
* @example
|
|
1359
1545
|
* ```ts
|
|
1360
|
-
* const bulkAffectedUsers = await auth.admin.app("
|
|
1546
|
+
* const bulkAffectedUsers = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.bulkRevokeSessions({ selection: { mode: "ids" } });
|
|
1361
1547
|
* ```
|
|
1362
1548
|
*/
|
|
1363
1549
|
bulkRevokeSessions(params, options) {
|
|
@@ -1366,6 +1552,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1366
1552
|
/**
|
|
1367
1553
|
* Bulk-assign a role across a selection.
|
|
1368
1554
|
*
|
|
1555
|
+
* Credential: `workspace_key`.
|
|
1556
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1557
|
+
*
|
|
1369
1558
|
* @param params - `Auth.EndUserBulkUpdateRoleParams`.
|
|
1370
1559
|
* @param options - Per-request options.
|
|
1371
1560
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid `selection` body or empty `roleName`.
|
|
@@ -1377,7 +1566,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1377
1566
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-bulk-update-role
|
|
1378
1567
|
* @example
|
|
1379
1568
|
* ```ts
|
|
1380
|
-
* const bulkAffectedUsers = await auth.admin.app("
|
|
1569
|
+
* const bulkAffectedUsers = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.bulkUpdateRole({ role_name: "member", selection: { mode: "ids" } });
|
|
1381
1570
|
* ```
|
|
1382
1571
|
*/
|
|
1383
1572
|
bulkUpdateRole(params, options) {
|
|
@@ -1386,6 +1575,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1386
1575
|
/**
|
|
1387
1576
|
* Bulk-update status across a selection.
|
|
1388
1577
|
*
|
|
1578
|
+
* Credential: `workspace_key`.
|
|
1579
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1580
|
+
*
|
|
1389
1581
|
* @param params - `Auth.EndUserBulkUpdateStatusParams`.
|
|
1390
1582
|
* @param options - Per-request options.
|
|
1391
1583
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid `selection` body, or `status` is not one of active, suspended, deactivated.
|
|
@@ -1397,7 +1589,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1397
1589
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-bulk-update-status
|
|
1398
1590
|
* @example
|
|
1399
1591
|
* ```ts
|
|
1400
|
-
* const bulkAffectedUsers = await auth.admin.app("
|
|
1592
|
+
* const bulkAffectedUsers = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.bulkUpdateStatus({ selection: { mode: "ids" }, status: "suspended" });
|
|
1401
1593
|
* ```
|
|
1402
1594
|
*/
|
|
1403
1595
|
bulkUpdateStatus(params, options) {
|
|
@@ -1408,6 +1600,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1408
1600
|
*
|
|
1409
1601
|
* Removes the account with its contacts, sessions and tenant memberships. Writes one `auth.account.deleted` audit row (`via: platform`) in the same transaction, mirrors the deletion into the workspace audit log as `auth.end_users.deleted`, and fires `user.deleted` with `via: "platform"`.
|
|
1410
1602
|
*
|
|
1603
|
+
* Credential: `workspace_key`.
|
|
1604
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1605
|
+
*
|
|
1411
1606
|
* @param userId - Id of the user.
|
|
1412
1607
|
* @param options - Per-request options.
|
|
1413
1608
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1418,7 +1613,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1418
1613
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-end-users-user-id
|
|
1419
1614
|
* @example
|
|
1420
1615
|
* ```ts
|
|
1421
|
-
* await auth.admin.app("
|
|
1616
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1422
1617
|
* ```
|
|
1423
1618
|
*/
|
|
1424
1619
|
delete(userId, options) {
|
|
@@ -1429,6 +1624,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1429
1624
|
*
|
|
1430
1625
|
* Streamed in keyset batches — neither the service nor the client holds the whole directory. Ordered oldest-first by `(created_at, id)` so a re-run is stable. Gated on `auth.user.export`, which is escalation class: this hands over every address in the directory in one call, where `auth.list` pages it. Hard cap of 1,000,000 rows; a wider request is refused with 413 before any body is written.
|
|
1431
1626
|
*
|
|
1627
|
+
* Credential: `workspace_key`.
|
|
1628
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1629
|
+
*
|
|
1432
1630
|
* @param params - `Auth.EndUserExportParams`.
|
|
1433
1631
|
* @param options - Per-request options.
|
|
1434
1632
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `format`.
|
|
@@ -1441,7 +1639,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1441
1639
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users-export
|
|
1442
1640
|
* @example
|
|
1443
1641
|
* ```ts
|
|
1444
|
-
* const response = await auth.admin.app("
|
|
1642
|
+
* const response = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.export();
|
|
1445
1643
|
* const text = await response.text();
|
|
1446
1644
|
* ```
|
|
1447
1645
|
*/
|
|
@@ -1451,6 +1649,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1451
1649
|
/**
|
|
1452
1650
|
* List end-users in this app (cursor-paginated).
|
|
1453
1651
|
*
|
|
1652
|
+
* Credential: `workspace_key`.
|
|
1653
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1654
|
+
*
|
|
1454
1655
|
* @param params - `Auth.EndUserListParams`.
|
|
1455
1656
|
* @param options - Per-request options.
|
|
1456
1657
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `signal` / `sort` / `order`, or a `cursor` minted under a different ordering than the one requested.
|
|
@@ -1460,10 +1661,10 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1460
1661
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users
|
|
1461
1662
|
* @example
|
|
1462
1663
|
* ```ts
|
|
1463
|
-
* for await (const endUser of auth.admin.app("
|
|
1664
|
+
* for await (const endUser of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.list()) {
|
|
1464
1665
|
* console.log(endUser);
|
|
1465
1666
|
* }
|
|
1466
|
-
* const page = await auth.admin.app("
|
|
1667
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.list({}, { timeout: 5_000 });
|
|
1467
1668
|
* ```
|
|
1468
1669
|
*/
|
|
1469
1670
|
list(params, options) {
|
|
@@ -1472,6 +1673,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1472
1673
|
/**
|
|
1473
1674
|
* Resend verification to the primary email contact.
|
|
1474
1675
|
*
|
|
1676
|
+
* Credential: `workspace_key`.
|
|
1677
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1678
|
+
*
|
|
1475
1679
|
* @param userId - Id of the user.
|
|
1476
1680
|
* @param options - Per-request options.
|
|
1477
1681
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1483,7 +1687,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1483
1687
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-resend-verification
|
|
1484
1688
|
* @example
|
|
1485
1689
|
* ```ts
|
|
1486
|
-
* const issuedVerificationCode = await auth.admin.app("
|
|
1690
|
+
* const issuedVerificationCode = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.resendVerification("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1487
1691
|
* ```
|
|
1488
1692
|
*/
|
|
1489
1693
|
resendVerification(userId, options) {
|
|
@@ -1492,6 +1696,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1492
1696
|
/**
|
|
1493
1697
|
* Get one end-user.
|
|
1494
1698
|
*
|
|
1699
|
+
* Credential: `workspace_key`.
|
|
1700
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1701
|
+
*
|
|
1495
1702
|
* @param userId - Id of the user.
|
|
1496
1703
|
* @param options - Per-request options.
|
|
1497
1704
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1502,7 +1709,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1502
1709
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users-user-id
|
|
1503
1710
|
* @example
|
|
1504
1711
|
* ```ts
|
|
1505
|
-
* const endUserSummary = await auth.admin.app("
|
|
1712
|
+
* const endUserSummary = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1506
1713
|
* ```
|
|
1507
1714
|
*/
|
|
1508
1715
|
retrieve(userId, options) {
|
|
@@ -1511,6 +1718,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1511
1718
|
/**
|
|
1512
1719
|
* Update end-user display name, primary email, or metadata keys (merged).
|
|
1513
1720
|
*
|
|
1721
|
+
* Credential: `workspace_key`.
|
|
1722
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1723
|
+
*
|
|
1514
1724
|
* @param userId - Id of the user.
|
|
1515
1725
|
* @param params - `Auth.EndUserUpdateParams`.
|
|
1516
1726
|
* @param options - Per-request options.
|
|
@@ -1523,7 +1733,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1523
1733
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-end-users-user-id
|
|
1524
1734
|
* @example
|
|
1525
1735
|
* ```ts
|
|
1526
|
-
* const endUserSummary = await auth.admin.app("
|
|
1736
|
+
* const endUserSummary = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { display_name: "Ada Lovelace" });
|
|
1527
1737
|
* ```
|
|
1528
1738
|
*/
|
|
1529
1739
|
update(userId, params, options) {
|
|
@@ -1532,6 +1742,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1532
1742
|
/**
|
|
1533
1743
|
* Assign an end-user a role.
|
|
1534
1744
|
*
|
|
1745
|
+
* Credential: `workspace_key`.
|
|
1746
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1747
|
+
*
|
|
1535
1748
|
* @param userId - Id of the user.
|
|
1536
1749
|
* @param params - `Auth.EndUserUpdateRoleParams`.
|
|
1537
1750
|
* @param options - Per-request options.
|
|
@@ -1544,7 +1757,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1544
1757
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-end-users-user-id-role
|
|
1545
1758
|
* @example
|
|
1546
1759
|
* ```ts
|
|
1547
|
-
* const endUserRoleAssignment = await auth.admin.app("
|
|
1760
|
+
* const endUserRoleAssignment = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.updateRole("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "admin" });
|
|
1548
1761
|
* ```
|
|
1549
1762
|
*/
|
|
1550
1763
|
updateRole(userId, params, options) {
|
|
@@ -1553,6 +1766,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1553
1766
|
/**
|
|
1554
1767
|
* Change end-user status (active / suspended / deactivated).
|
|
1555
1768
|
*
|
|
1769
|
+
* Credential: `workspace_key`.
|
|
1770
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1771
|
+
*
|
|
1556
1772
|
* @param userId - Id of the user.
|
|
1557
1773
|
* @param params - `Auth.EndUserUpdateStatusParams`.
|
|
1558
1774
|
* @param options - Per-request options.
|
|
@@ -1565,7 +1781,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1565
1781
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-end-users-user-id-status
|
|
1566
1782
|
* @example
|
|
1567
1783
|
* ```ts
|
|
1568
|
-
* const endUserSummary = await auth.admin.app("
|
|
1784
|
+
* const endUserSummary = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.updateStatus("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { status: "suspended" });
|
|
1569
1785
|
* ```
|
|
1570
1786
|
*/
|
|
1571
1787
|
updateStatus(userId, params, options) {
|
|
@@ -1618,6 +1834,9 @@ var AppMembersResource = class extends APIResource {
|
|
|
1618
1834
|
/**
|
|
1619
1835
|
* Remove a member from the app
|
|
1620
1836
|
*
|
|
1837
|
+
* Credential: `workspace_key`.
|
|
1838
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1839
|
+
*
|
|
1621
1840
|
* @param accountId - Id of the account.
|
|
1622
1841
|
* @param options - Per-request options.
|
|
1623
1842
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1628,7 +1847,7 @@ var AppMembersResource = class extends APIResource {
|
|
|
1628
1847
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-members-account-id
|
|
1629
1848
|
* @example
|
|
1630
1849
|
* ```ts
|
|
1631
|
-
* await auth.admin.app("
|
|
1850
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").members.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1632
1851
|
* ```
|
|
1633
1852
|
*/
|
|
1634
1853
|
delete(accountId, options) {
|
|
@@ -1637,6 +1856,9 @@ var AppMembersResource = class extends APIResource {
|
|
|
1637
1856
|
/**
|
|
1638
1857
|
* List app members (PlatformUser view of EndUser memberships)
|
|
1639
1858
|
*
|
|
1859
|
+
* Credential: `workspace_key`.
|
|
1860
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1861
|
+
*
|
|
1640
1862
|
* @param params - `Auth.MemberListParams`.
|
|
1641
1863
|
* @param options - Per-request options.
|
|
1642
1864
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid pagination cursor.
|
|
@@ -1648,10 +1870,10 @@ var AppMembersResource = class extends APIResource {
|
|
|
1648
1870
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-members
|
|
1649
1871
|
* @example
|
|
1650
1872
|
* ```ts
|
|
1651
|
-
* for await (const member of auth.admin.app("
|
|
1873
|
+
* for await (const member of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").members.list()) {
|
|
1652
1874
|
* console.log(member);
|
|
1653
1875
|
* }
|
|
1654
|
-
* const page = await auth.admin.app("
|
|
1876
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").members.list({}, { timeout: 5_000 });
|
|
1655
1877
|
* ```
|
|
1656
1878
|
*/
|
|
1657
1879
|
list(params, options) {
|
|
@@ -1672,6 +1894,9 @@ var AppNotificationSettingsResource = class extends APIResource {
|
|
|
1672
1894
|
*
|
|
1673
1895
|
* `effective_sender` is the sender emails actually go out from, checked live in Mail with your own access (the workspace default sender, or the app's custom address).
|
|
1674
1896
|
*
|
|
1897
|
+
* Credential: `workspace_key`.
|
|
1898
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1899
|
+
*
|
|
1675
1900
|
* @param options - Per-request options.
|
|
1676
1901
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
1677
1902
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -1681,7 +1906,7 @@ var AppNotificationSettingsResource = class extends APIResource {
|
|
|
1681
1906
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-notification-settings
|
|
1682
1907
|
* @example
|
|
1683
1908
|
* ```ts
|
|
1684
|
-
* const appNotificationSettings = await auth.admin.app("
|
|
1909
|
+
* const appNotificationSettings = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").notificationSettings.retrieve();
|
|
1685
1910
|
* ```
|
|
1686
1911
|
*/
|
|
1687
1912
|
retrieve(options) {
|
|
@@ -1692,6 +1917,9 @@ var AppNotificationSettingsResource = class extends APIResource {
|
|
|
1692
1917
|
*
|
|
1693
1918
|
* Turning `notifications_via_envoi` on (from off) creates the default template of every empty slot in the workspace's Mail templates (`auth-verification`, `auth-welcome`, `auth-password-reset`, `auth-invite`, `auth-mfa-code`), reusing a template that already has that name, and fills the slot. Templates are created with your own Mail access; a slot that could not be created stays empty. A slot you clear later is not refilled until emails are switched off and on again.
|
|
1694
1919
|
*
|
|
1920
|
+
* Credential: `workspace_key`.
|
|
1921
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1922
|
+
*
|
|
1695
1923
|
* @param params - `Auth.NotificationSettingUpdateParams`.
|
|
1696
1924
|
* @param options - Per-request options.
|
|
1697
1925
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid payload.
|
|
@@ -1704,7 +1932,7 @@ var AppNotificationSettingsResource = class extends APIResource {
|
|
|
1704
1932
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-notification-settings
|
|
1705
1933
|
* @example
|
|
1706
1934
|
* ```ts
|
|
1707
|
-
* const appNotificationSettings = await auth.admin.app("
|
|
1935
|
+
* const appNotificationSettings = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").notificationSettings.update({ default_sender_address: "ada@example.com" });
|
|
1708
1936
|
* ```
|
|
1709
1937
|
*/
|
|
1710
1938
|
update(params, options) {
|
|
@@ -1717,6 +1945,9 @@ var AppNotificationsResource = class extends APIResource {
|
|
|
1717
1945
|
*
|
|
1718
1946
|
* Sends the slot's real Mail template, with this app's real sender (the workspace default or the custom address) and example values for every variable, to your own verified account address. It cannot be sent anywhere else. It uses your own Mail access, goes through the same send path as real emails, and shows up in Mail > Emails. At most 10 tests per person per hour. Not available to API keys (a key has no inbox).
|
|
1719
1947
|
*
|
|
1948
|
+
* Credential: `workspace_key`.
|
|
1949
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1950
|
+
*
|
|
1720
1951
|
* @param slot - The email to test.
|
|
1721
1952
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
1722
1953
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `slot`.
|
|
@@ -1732,7 +1963,7 @@ var AppNotificationsResource = class extends APIResource {
|
|
|
1732
1963
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-notifications-slot-test
|
|
1733
1964
|
* @example
|
|
1734
1965
|
* ```ts
|
|
1735
|
-
* const notificationTest = await auth.admin.app("
|
|
1966
|
+
* const notificationTest = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").notifications.test("verification");
|
|
1736
1967
|
* ```
|
|
1737
1968
|
*/
|
|
1738
1969
|
test(slot, options) {
|
|
@@ -1745,6 +1976,9 @@ var AppPermissionsEnforcementResource = class extends APIResource {
|
|
|
1745
1976
|
*
|
|
1746
1977
|
* Returns the deduplicated set of permission strings that any handler in this users-api build gates via `@RequireAppPermission`. Drives the console "Enforced" badge — a customer who binds `user.delete` to a role can see whether any route in this deploy actually checks for it. App-agnostic in shape; the path parameter is included for URN symmetry with the rest of the per-app surface, not to narrow the response.
|
|
1747
1978
|
*
|
|
1979
|
+
* Credential: `workspace_key`.
|
|
1980
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
1981
|
+
*
|
|
1748
1982
|
* @param options - Per-request options.
|
|
1749
1983
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
1750
1984
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -1754,7 +1988,7 @@ var AppPermissionsEnforcementResource = class extends APIResource {
|
|
|
1754
1988
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-permissions-enforcement
|
|
1755
1989
|
* @example
|
|
1756
1990
|
* ```ts
|
|
1757
|
-
* const enforcedPermissions = await auth.admin.app("
|
|
1991
|
+
* const enforcedPermissions = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").permissions.enforcement.list();
|
|
1758
1992
|
* ```
|
|
1759
1993
|
*/
|
|
1760
1994
|
list(options) {
|
|
@@ -1769,6 +2003,9 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1769
2003
|
/**
|
|
1770
2004
|
* Create a custom permission
|
|
1771
2005
|
*
|
|
2006
|
+
* Credential: `workspace_key`.
|
|
2007
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2008
|
+
*
|
|
1772
2009
|
* @param params - `Auth.AppScopedPermissionCreateParams`.
|
|
1773
2010
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
1774
2011
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (`resource` / `action` segment format, or `description` over 256 chars).
|
|
@@ -1781,7 +2018,7 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1781
2018
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-permissions
|
|
1782
2019
|
* @example
|
|
1783
2020
|
* ```ts
|
|
1784
|
-
* const permission = await auth.admin.app("
|
|
2021
|
+
* const permission = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").permissions.create({ action: "read", resource: "project" });
|
|
1785
2022
|
* ```
|
|
1786
2023
|
*/
|
|
1787
2024
|
create(params, options) {
|
|
@@ -1790,6 +2027,9 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1790
2027
|
/**
|
|
1791
2028
|
* Delete a custom permission
|
|
1792
2029
|
*
|
|
2030
|
+
* Credential: `workspace_key`.
|
|
2031
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2032
|
+
*
|
|
1793
2033
|
* @param permissionKey - Permission key, `resource.action` (e.g. `invoice.read`).
|
|
1794
2034
|
* @param options - Per-request options.
|
|
1795
2035
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `permissionKey` is not in `resource.action` format.
|
|
@@ -1801,7 +2041,7 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1801
2041
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-permissions-permission-key
|
|
1802
2042
|
* @example
|
|
1803
2043
|
* ```ts
|
|
1804
|
-
* await auth.admin.app("
|
|
2044
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").permissions.delete("invoice.read");
|
|
1805
2045
|
* ```
|
|
1806
2046
|
*/
|
|
1807
2047
|
delete(permissionKey, options) {
|
|
@@ -1810,6 +2050,9 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1810
2050
|
/**
|
|
1811
2051
|
* List all permissions (system + custom)
|
|
1812
2052
|
*
|
|
2053
|
+
* Credential: `workspace_key`.
|
|
2054
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2055
|
+
*
|
|
1813
2056
|
* @param options - Per-request options.
|
|
1814
2057
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
1815
2058
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -1819,7 +2062,7 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1819
2062
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-permissions
|
|
1820
2063
|
* @example
|
|
1821
2064
|
* ```ts
|
|
1822
|
-
* const result = await auth.admin.app("
|
|
2065
|
+
* const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").permissions.list();
|
|
1823
2066
|
* ```
|
|
1824
2067
|
*/
|
|
1825
2068
|
list(options) {
|
|
@@ -1830,6 +2073,9 @@ var AppRolesPermissionsResource = class extends APIResource {
|
|
|
1830
2073
|
/**
|
|
1831
2074
|
* List all available permissions
|
|
1832
2075
|
*
|
|
2076
|
+
* Credential: `workspace_key`.
|
|
2077
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2078
|
+
*
|
|
1833
2079
|
* @param options - Per-request options.
|
|
1834
2080
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
1835
2081
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -1839,7 +2085,7 @@ var AppRolesPermissionsResource = class extends APIResource {
|
|
|
1839
2085
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-roles-permissions
|
|
1840
2086
|
* @example
|
|
1841
2087
|
* ```ts
|
|
1842
|
-
* const result = await auth.admin.app("
|
|
2088
|
+
* const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.permissions.list();
|
|
1843
2089
|
* ```
|
|
1844
2090
|
*/
|
|
1845
2091
|
list(options) {
|
|
@@ -1854,6 +2100,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1854
2100
|
/**
|
|
1855
2101
|
* Assign a role to a user
|
|
1856
2102
|
*
|
|
2103
|
+
* Credential: `workspace_key`.
|
|
2104
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2105
|
+
*
|
|
1857
2106
|
* @param params - `Auth.RoleAssignParams`.
|
|
1858
2107
|
* @param options - Per-request options.
|
|
1859
2108
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (`accountId` not a UUID, or `role` empty / over 64 chars).
|
|
@@ -1865,7 +2114,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1865
2114
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-roles-assign
|
|
1866
2115
|
* @example
|
|
1867
2116
|
* ```ts
|
|
1868
|
-
* const appMembership = await auth.admin.app("
|
|
2117
|
+
* const appMembership = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.assign({ account_id: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", role: "admin" });
|
|
1869
2118
|
* ```
|
|
1870
2119
|
*/
|
|
1871
2120
|
assign(params, options) {
|
|
@@ -1874,6 +2123,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1874
2123
|
/**
|
|
1875
2124
|
* Create a new role (no permissions yet — set them via PUT /:roleName/permissions)
|
|
1876
2125
|
*
|
|
2126
|
+
* Credential: `workspace_key`.
|
|
2127
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2128
|
+
*
|
|
1877
2129
|
* @param params - `Auth.AppScopedRoleCreateParams`.
|
|
1878
2130
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
1879
2131
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (`name` 1-64 chars, `description` up to 256).
|
|
@@ -1886,7 +2138,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1886
2138
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-roles
|
|
1887
2139
|
* @example
|
|
1888
2140
|
* ```ts
|
|
1889
|
-
* const role = await auth.admin.app("
|
|
2141
|
+
* const role = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.create({ name: "editor" });
|
|
1890
2142
|
* ```
|
|
1891
2143
|
*/
|
|
1892
2144
|
create(params, options) {
|
|
@@ -1895,6 +2147,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1895
2147
|
/**
|
|
1896
2148
|
* Delete a custom role
|
|
1897
2149
|
*
|
|
2150
|
+
* Credential: `workspace_key`.
|
|
2151
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2152
|
+
*
|
|
1898
2153
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
1899
2154
|
* @param options - Per-request options.
|
|
1900
2155
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1906,7 +2161,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1906
2161
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-roles-role-name
|
|
1907
2162
|
* @example
|
|
1908
2163
|
* ```ts
|
|
1909
|
-
* await auth.admin.app("
|
|
2164
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.delete("admin");
|
|
1910
2165
|
* ```
|
|
1911
2166
|
*/
|
|
1912
2167
|
delete(roleName, options) {
|
|
@@ -1915,6 +2170,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1915
2170
|
/**
|
|
1916
2171
|
* List all roles in an app. Filter by `?search=` on the role name.
|
|
1917
2172
|
*
|
|
2173
|
+
* Credential: `workspace_key`.
|
|
2174
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2175
|
+
*
|
|
1918
2176
|
* @param params - `Auth.AppScopedRoleListParams`.
|
|
1919
2177
|
* @param options - Per-request options.
|
|
1920
2178
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Malformed `cursor`.
|
|
@@ -1926,10 +2184,10 @@ var AppRolesResource = class extends APIResource {
|
|
|
1926
2184
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-roles
|
|
1927
2185
|
* @example
|
|
1928
2186
|
* ```ts
|
|
1929
|
-
* for await (const role of auth.admin.app("
|
|
2187
|
+
* for await (const role of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.list()) {
|
|
1930
2188
|
* console.log(role);
|
|
1931
2189
|
* }
|
|
1932
|
-
* const page = await auth.admin.app("
|
|
2190
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.list({}, { timeout: 5_000 });
|
|
1933
2191
|
* ```
|
|
1934
2192
|
*/
|
|
1935
2193
|
list(params, options) {
|
|
@@ -1938,6 +2196,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1938
2196
|
/**
|
|
1939
2197
|
* Get role details with permissions
|
|
1940
2198
|
*
|
|
2199
|
+
* Credential: `workspace_key`.
|
|
2200
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2201
|
+
*
|
|
1941
2202
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
1942
2203
|
* @param options - Per-request options.
|
|
1943
2204
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1948,7 +2209,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1948
2209
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-roles-role-name
|
|
1949
2210
|
* @example
|
|
1950
2211
|
* ```ts
|
|
1951
|
-
* const roleWithPermissions = await auth.admin.app("
|
|
2212
|
+
* const roleWithPermissions = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.retrieve("admin");
|
|
1952
2213
|
* ```
|
|
1953
2214
|
*/
|
|
1954
2215
|
retrieve(roleName, options) {
|
|
@@ -1957,6 +2218,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1957
2218
|
/**
|
|
1958
2219
|
* Update role name or description
|
|
1959
2220
|
*
|
|
2221
|
+
* Credential: `workspace_key`.
|
|
2222
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2223
|
+
*
|
|
1960
2224
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
1961
2225
|
* @param params - `Auth.AppScopedRoleUpdateParams`.
|
|
1962
2226
|
* @param options - Per-request options.
|
|
@@ -1969,7 +2233,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1969
2233
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-roles-role-name
|
|
1970
2234
|
* @example
|
|
1971
2235
|
* ```ts
|
|
1972
|
-
* const role = await auth.admin.app("
|
|
2236
|
+
* const role = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.update("admin", { description: "Updated description" });
|
|
1973
2237
|
* ```
|
|
1974
2238
|
*/
|
|
1975
2239
|
update(roleName, params, options) {
|
|
@@ -1978,6 +2242,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1978
2242
|
/**
|
|
1979
2243
|
* Set permissions for a role (caller-narrowed: caller must hold every requested permission)
|
|
1980
2244
|
*
|
|
2245
|
+
* Credential: `workspace_key`.
|
|
2246
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2247
|
+
*
|
|
1981
2248
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
1982
2249
|
* @param params - `Auth.AppScopedRoleUpdatePermissionsParams`.
|
|
1983
2250
|
* @param options - Per-request options.
|
|
@@ -1990,7 +2257,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1990
2257
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-roles-role-name-permissions
|
|
1991
2258
|
* @example
|
|
1992
2259
|
* ```ts
|
|
1993
|
-
* const result = await auth.admin.app("
|
|
2260
|
+
* const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.updatePermissions("admin", { permissions: ["user.read", "role.create"] });
|
|
1994
2261
|
* ```
|
|
1995
2262
|
*/
|
|
1996
2263
|
updatePermissions(roleName, params, options) {
|
|
@@ -2027,6 +2294,9 @@ var AppSetupStatusResource = class extends APIResource {
|
|
|
2027
2294
|
*
|
|
2028
2295
|
* Rows, in order: `signups` (attention while sign-ups are off), `redirect_origins` (blocked until at least one site may start sign-in), one `provider_<id>` row per switched-on sign-in provider (blocked while its status is blocked), `email` (sender chosen and a template for every email; attention while emails are off), `api_key` (attention until an active app key exists), `webhook` (attention until an endpoint has accepted a delivery), and `passkeys` (only while passkeys are on; blocked when no allowed redirect origin is on the passkey site). `complete` is true once no row is `not_set` or `blocked`. Each `fix.href` is a console path to the exact setting. Computed on every request from stored settings, plus the workspace default sender read from Mail with your own access when emails use it: nothing here calls DNS or a sign-in provider (a provider whose last credential check was rejected shows as blocked). A ready provider row carries `test.action: sign_in.try`: run it with `POST /v1/apps/{appId}/sign-in-tests` `{ method: "oauth", provider }`.
|
|
2029
2296
|
*
|
|
2297
|
+
* Credential: `workspace_key`.
|
|
2298
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2299
|
+
*
|
|
2030
2300
|
* @param options - Per-request options.
|
|
2031
2301
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
2032
2302
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -2036,7 +2306,7 @@ var AppSetupStatusResource = class extends APIResource {
|
|
|
2036
2306
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-setup-status
|
|
2037
2307
|
* @example
|
|
2038
2308
|
* ```ts
|
|
2039
|
-
* const setupStatus = await auth.admin.app("
|
|
2309
|
+
* const setupStatus = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").setupStatus.retrieve();
|
|
2040
2310
|
* ```
|
|
2041
2311
|
*/
|
|
2042
2312
|
retrieve(options) {
|
|
@@ -2049,6 +2319,9 @@ var AppSignInTestsResource = class extends APIResource {
|
|
|
2049
2319
|
*
|
|
2050
2320
|
* For `oauth`, the server first checks what it can on its own (an allowed redirect origin, saved credentials, and the provider credential check). If one fails, the test comes back `failed` at once with the fix. Otherwise open `start_url` in a popup: the person signs in at the provider, the provider returns to Auth, Auth resolves who it is exactly as a real sign-in would, records `would_sign_in_existing` or `would_create` (or the provider error mapped to its fix), creates no account and issues no token, then sends the popup to the console result page. Poll `GET …/sign-in-tests/{id}` until `state` is not `pending`. Works with a provider that is saved but not switched on yet. For `password` / `otp`, the test runs now: it checks the sign-up or sign-in rules for your own email and sends the real email to your own verified address. At most 20 tests per app per hour; tests are deleted after 24 hours.
|
|
2051
2321
|
*
|
|
2322
|
+
* Credential: `workspace_key`.
|
|
2323
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2324
|
+
*
|
|
2052
2325
|
* @param params - `Auth.SignInTestCreateParams`.
|
|
2053
2326
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2054
2327
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR, CUSTOM_DOMAIN_OAUTH_ONLY: Unknown `method` or provider, `provider` missing for `oauth`, or `custom_domain` on a `password` / `otp` test (`CUSTOM_DOMAIN_OAUTH_ONLY`).
|
|
@@ -2061,7 +2334,7 @@ var AppSignInTestsResource = class extends APIResource {
|
|
|
2061
2334
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-sign-in-tests
|
|
2062
2335
|
* @example
|
|
2063
2336
|
* ```ts
|
|
2064
|
-
* const signInTest = await auth.admin.app("
|
|
2337
|
+
* const signInTest = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").signInTests.create({ method: "oauth" });
|
|
2065
2338
|
* ```
|
|
2066
2339
|
*/
|
|
2067
2340
|
create(params, options) {
|
|
@@ -2072,6 +2345,9 @@ var AppSignInTestsResource = class extends APIResource {
|
|
|
2072
2345
|
*
|
|
2073
2346
|
* Poll this after opening `start_url`. `state` turns `succeeded` (with `outcome` and `identity`) or `failed` (with `error.fix`). A test that is never finished turns `failed` with code `expired` 15 minutes after it was created.
|
|
2074
2347
|
*
|
|
2348
|
+
* Credential: `workspace_key`.
|
|
2349
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2350
|
+
*
|
|
2075
2351
|
* @param testId - Id of the test.
|
|
2076
2352
|
* @param options - Per-request options.
|
|
2077
2353
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `testId` is not a UUID.
|
|
@@ -2083,7 +2359,7 @@ var AppSignInTestsResource = class extends APIResource {
|
|
|
2083
2359
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-sign-in-tests-test-id
|
|
2084
2360
|
* @example
|
|
2085
2361
|
* ```ts
|
|
2086
|
-
* const signInTest = await auth.admin.app("
|
|
2362
|
+
* const signInTest = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").signInTests.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2087
2363
|
* ```
|
|
2088
2364
|
*/
|
|
2089
2365
|
retrieve(testId, options) {
|
|
@@ -2096,6 +2372,9 @@ var AppTenantApiKeysConfigResource = class extends APIResource {
|
|
|
2096
2372
|
*
|
|
2097
2373
|
* Includes the platform kill switch `suspended`. Requires `auth.read` on the app.
|
|
2098
2374
|
*
|
|
2375
|
+
* Credential: `workspace_key`.
|
|
2376
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2377
|
+
*
|
|
2099
2378
|
* @param options - Per-request options.
|
|
2100
2379
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
2101
2380
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app.
|
|
@@ -2105,7 +2384,7 @@ var AppTenantApiKeysConfigResource = class extends APIResource {
|
|
|
2105
2384
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenant-api-keys-config
|
|
2106
2385
|
* @example
|
|
2107
2386
|
* ```ts
|
|
2108
|
-
* const tenantApiKeysConfig = await auth.admin.app("
|
|
2387
|
+
* const tenantApiKeysConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenantApiKeys.config.retrieve();
|
|
2109
2388
|
* ```
|
|
2110
2389
|
*/
|
|
2111
2390
|
retrieve(options) {
|
|
@@ -2116,6 +2395,9 @@ var AppTenantApiKeysConfigResource = class extends APIResource {
|
|
|
2116
2395
|
*
|
|
2117
2396
|
* Fields you leave out keep their stored value. `suspended: true` is the kill switch: introspection answers `{"active": false}` for every key of the app at once, and key management is refused, until you set it back to `false`. The app's own config push (`PUT /:appSlug/v1/tenant-api-keys/config`) can never change it. Requires `auth.update` on the app.
|
|
2118
2397
|
*
|
|
2398
|
+
* Credential: `workspace_key`.
|
|
2399
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2400
|
+
*
|
|
2119
2401
|
* @param params - `Auth.AppScopedTenantApiKeyConfigUpdateParams`.
|
|
2120
2402
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2121
2403
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR, TENANT_API_KEYS_SCOPE_INVALID, TENANT_API_KEYS_UNKNOWN_ROLE, TENANT_API_KEY_EXPIRY_INVALID, TENANT_API_KEYS_NO_SCOPES: `VALIDATION_ERROR`, `TENANT_API_KEYS_SCOPE_INVALID`, `TENANT_API_KEYS_UNKNOWN_ROLE`, `TENANT_API_KEY_EXPIRY_INVALID`, `TENANT_API_KEYS_NO_SCOPES`, or a malformed `Idempotency-Key`.
|
|
@@ -2128,7 +2410,7 @@ var AppTenantApiKeysConfigResource = class extends APIResource {
|
|
|
2128
2410
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-tenant-api-keys-config
|
|
2129
2411
|
* @example
|
|
2130
2412
|
* ```ts
|
|
2131
|
-
* const tenantApiKeysConfig = await auth.admin.app("
|
|
2413
|
+
* const tenantApiKeysConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenantApiKeys.config.update({ default_expiry_days: 7 });
|
|
2132
2414
|
* ```
|
|
2133
2415
|
*/
|
|
2134
2416
|
update(params, options) {
|
|
@@ -2145,6 +2427,9 @@ var AppTenantApiKeysResource = class extends APIResource {
|
|
|
2145
2427
|
*
|
|
2146
2428
|
* Immediate and final; recorded as revoked by you (`revoked_by_type: platform_user`) in the key and in the audit log. Idempotent: revoking a revoked key is a 204 that changes nothing. Requires `auth.revoke` on the app.
|
|
2147
2429
|
*
|
|
2430
|
+
* Credential: `workspace_key`.
|
|
2431
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2432
|
+
*
|
|
2148
2433
|
* @param keyId - Key id (UUID) or display id (`tak_…`).
|
|
2149
2434
|
* @param options - Per-request options.
|
|
2150
2435
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -2155,7 +2440,7 @@ var AppTenantApiKeysResource = class extends APIResource {
|
|
|
2155
2440
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-tenant-api-keys-key-id
|
|
2156
2441
|
* @example
|
|
2157
2442
|
* ```ts
|
|
2158
|
-
* await auth.admin.app("
|
|
2443
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenantApiKeys.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2159
2444
|
* ```
|
|
2160
2445
|
*/
|
|
2161
2446
|
delete(keyId, options) {
|
|
@@ -2166,6 +2451,9 @@ var AppTenantApiKeysResource = class extends APIResource {
|
|
|
2166
2451
|
*
|
|
2167
2452
|
* Every tenant of the app, newest first, cursor-paginated (20 per page, max 100). Secrets are never returned. Each key names its creator (`created_by`), and its `status` is `orphaned` when it is neither revoked nor expired but its creator left the tenant or the tenant is not active (introspection refuses it). Requires `auth.read` on the app.
|
|
2168
2453
|
*
|
|
2454
|
+
* Credential: `workspace_key`.
|
|
2455
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2456
|
+
*
|
|
2169
2457
|
* @param params - `Auth.AppScopedTenantApiKeyListParams`.
|
|
2170
2458
|
* @param options - Per-request options.
|
|
2171
2459
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `status` or malformed `cursor`.
|
|
@@ -2177,10 +2465,10 @@ var AppTenantApiKeysResource = class extends APIResource {
|
|
|
2177
2465
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenant-api-keys
|
|
2178
2466
|
* @example
|
|
2179
2467
|
* ```ts
|
|
2180
|
-
* for await (const tenantApiKey of auth.admin.app("
|
|
2468
|
+
* for await (const tenantApiKey of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenantApiKeys.list()) {
|
|
2181
2469
|
* console.log(tenantApiKey);
|
|
2182
2470
|
* }
|
|
2183
|
-
* const page = await auth.admin.app("
|
|
2471
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenantApiKeys.list({}, { timeout: 5_000 });
|
|
2184
2472
|
* ```
|
|
2185
2473
|
*/
|
|
2186
2474
|
list(params, options) {
|
|
@@ -2191,6 +2479,9 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2191
2479
|
/**
|
|
2192
2480
|
* Invite an email address into a tenant. Returns the plaintext code once; only its SHA-256 digest is stored.
|
|
2193
2481
|
*
|
|
2482
|
+
* Credential: `workspace_key`.
|
|
2483
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2484
|
+
*
|
|
2194
2485
|
* @param tenantId - Id of the tenant.
|
|
2195
2486
|
* @param params - `Auth.AppScopedTenantInviteCreateParams`.
|
|
2196
2487
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2203,7 +2494,7 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2203
2494
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-tenants-tenant-id-invites
|
|
2204
2495
|
* @example
|
|
2205
2496
|
* ```ts
|
|
2206
|
-
* const createTenantInvite = await auth.admin.app("
|
|
2497
|
+
* const createTenantInvite = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.invites.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { email: "alice@example.com", role_name: "member" });
|
|
2207
2498
|
* ```
|
|
2208
2499
|
*/
|
|
2209
2500
|
create(tenantId, params, options) {
|
|
@@ -2212,6 +2503,9 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2212
2503
|
/**
|
|
2213
2504
|
* Revoke a pending invite. Idempotent — a second revoke is a 204 no-op and fires no second webhook.
|
|
2214
2505
|
*
|
|
2506
|
+
* Credential: `workspace_key`.
|
|
2507
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2508
|
+
*
|
|
2215
2509
|
* @param tenantId - Id of the tenant.
|
|
2216
2510
|
* @param inviteId - Id of the invite.
|
|
2217
2511
|
* @param options - Per-request options.
|
|
@@ -2222,7 +2516,7 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2222
2516
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-tenants-tenant-id-invites-invite-id
|
|
2223
2517
|
* @example
|
|
2224
2518
|
* ```ts
|
|
2225
|
-
* await auth.admin.app("
|
|
2519
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.invites.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2226
2520
|
* ```
|
|
2227
2521
|
*/
|
|
2228
2522
|
delete(tenantId, inviteId, options) {
|
|
@@ -2231,6 +2525,9 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2231
2525
|
/**
|
|
2232
2526
|
* List a tenant's invites, newest first. Optional `?status=pending|revoked|expired|used`. Codes are never returned.
|
|
2233
2527
|
*
|
|
2528
|
+
* Credential: `workspace_key`.
|
|
2529
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2530
|
+
*
|
|
2234
2531
|
* @param tenantId - Id of the tenant.
|
|
2235
2532
|
* @param params - `Auth.AppScopedTenantInviteListParams`.
|
|
2236
2533
|
* @param options - Per-request options.
|
|
@@ -2242,10 +2539,10 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2242
2539
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenants-tenant-id-invites
|
|
2243
2540
|
* @example
|
|
2244
2541
|
* ```ts
|
|
2245
|
-
* for await (const invite of auth.admin.app("
|
|
2542
|
+
* for await (const invite of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.invites.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
|
|
2246
2543
|
* console.log(invite);
|
|
2247
2544
|
* }
|
|
2248
|
-
* const page = await auth.admin.app("
|
|
2545
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.invites.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
|
|
2249
2546
|
* ```
|
|
2250
2547
|
*/
|
|
2251
2548
|
list(tenantId, params, options) {
|
|
@@ -2256,6 +2553,9 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2256
2553
|
/**
|
|
2257
2554
|
* Add a member to a tenant.
|
|
2258
2555
|
*
|
|
2556
|
+
* Credential: `workspace_key`.
|
|
2557
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2558
|
+
*
|
|
2259
2559
|
* @param tenantId - Id of the tenant.
|
|
2260
2560
|
* @param params - `Auth.AppScopedTenantMemberCreateParams`.
|
|
2261
2561
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2269,7 +2569,7 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2269
2569
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-tenants-tenant-id-members
|
|
2270
2570
|
* @example
|
|
2271
2571
|
* ```ts
|
|
2272
|
-
* const addMember = await auth.admin.app("
|
|
2572
|
+
* const addMember = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.members.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "member" });
|
|
2273
2573
|
* ```
|
|
2274
2574
|
*/
|
|
2275
2575
|
create(tenantId, params, options) {
|
|
@@ -2278,6 +2578,9 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2278
2578
|
/**
|
|
2279
2579
|
* Remove a member from a tenant.
|
|
2280
2580
|
*
|
|
2581
|
+
* Credential: `workspace_key`.
|
|
2582
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2583
|
+
*
|
|
2281
2584
|
* @param tenantId - Id of the tenant.
|
|
2282
2585
|
* @param accountId - Id of the account.
|
|
2283
2586
|
* @param options - Per-request options.
|
|
@@ -2289,7 +2592,7 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2289
2592
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-tenants-tenant-id-members-account-id
|
|
2290
2593
|
* @example
|
|
2291
2594
|
* ```ts
|
|
2292
|
-
* await auth.admin.app("
|
|
2595
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.members.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2293
2596
|
* ```
|
|
2294
2597
|
*/
|
|
2295
2598
|
delete(tenantId, accountId, options) {
|
|
@@ -2298,6 +2601,9 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2298
2601
|
/**
|
|
2299
2602
|
* List members of a tenant, newest membership first. Filter by `?search=` and/or `?role=`.
|
|
2300
2603
|
*
|
|
2604
|
+
* Credential: `workspace_key`.
|
|
2605
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2606
|
+
*
|
|
2301
2607
|
* @param tenantId - Id of the tenant.
|
|
2302
2608
|
* @param params - `Auth.AppScopedTenantMemberListParams`.
|
|
2303
2609
|
* @param options - Per-request options.
|
|
@@ -2310,10 +2616,10 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2310
2616
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenants-tenant-id-members
|
|
2311
2617
|
* @example
|
|
2312
2618
|
* ```ts
|
|
2313
|
-
* for await (const member of auth.admin.app("
|
|
2619
|
+
* for await (const member of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.members.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
|
|
2314
2620
|
* console.log(member);
|
|
2315
2621
|
* }
|
|
2316
|
-
* const page = await auth.admin.app("
|
|
2622
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.members.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
|
|
2317
2623
|
* ```
|
|
2318
2624
|
*/
|
|
2319
2625
|
list(tenantId, params, options) {
|
|
@@ -2322,6 +2628,9 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2322
2628
|
/**
|
|
2323
2629
|
* Change a member's role inside a tenant.
|
|
2324
2630
|
*
|
|
2631
|
+
* Credential: `workspace_key`.
|
|
2632
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2633
|
+
*
|
|
2325
2634
|
* @param tenantId - Id of the tenant.
|
|
2326
2635
|
* @param accountId - Id of the account.
|
|
2327
2636
|
* @param params - `Auth.AppScopedTenantMemberUpdateParams`.
|
|
@@ -2335,7 +2644,7 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2335
2644
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-tenants-tenant-id-members-account-id
|
|
2336
2645
|
* @example
|
|
2337
2646
|
* ```ts
|
|
2338
|
-
* const tenantMembership = await auth.admin.app("
|
|
2647
|
+
* const tenantMembership = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.members.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "admin" });
|
|
2339
2648
|
* ```
|
|
2340
2649
|
*/
|
|
2341
2650
|
update(tenantId, accountId, params, options) {
|
|
@@ -2354,6 +2663,9 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2354
2663
|
/**
|
|
2355
2664
|
* Create a tenant in this app. Auth-admin lane; requires auth.tenant.create on the app URN.
|
|
2356
2665
|
*
|
|
2666
|
+
* Credential: `workspace_key`.
|
|
2667
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2668
|
+
*
|
|
2357
2669
|
* @param params - `Auth.AppScopedTenantCreateParams`.
|
|
2358
2670
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2359
2671
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid body, empty `displayName`, or `slug` not 1-64 chars of [a-z0-9-].
|
|
@@ -2366,7 +2678,7 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2366
2678
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-tenants
|
|
2367
2679
|
* @example
|
|
2368
2680
|
* ```ts
|
|
2369
|
-
* const tenant = await auth.admin.app("
|
|
2681
|
+
* const tenant = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.create({ display_name: "Acme Co" });
|
|
2370
2682
|
* ```
|
|
2371
2683
|
*/
|
|
2372
2684
|
create(params, options) {
|
|
@@ -2375,6 +2687,9 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2375
2687
|
/**
|
|
2376
2688
|
* Delete a tenant.
|
|
2377
2689
|
*
|
|
2690
|
+
* Credential: `workspace_key`.
|
|
2691
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2692
|
+
*
|
|
2378
2693
|
* @param tenantId - Id of the tenant.
|
|
2379
2694
|
* @param options - Per-request options.
|
|
2380
2695
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -2385,7 +2700,7 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2385
2700
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-tenants-tenant-id
|
|
2386
2701
|
* @example
|
|
2387
2702
|
* ```ts
|
|
2388
|
-
* await auth.admin.app("
|
|
2703
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2389
2704
|
* ```
|
|
2390
2705
|
*/
|
|
2391
2706
|
delete(tenantId, options) {
|
|
@@ -2394,6 +2709,9 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2394
2709
|
/**
|
|
2395
2710
|
* List tenants in this app, paginated by created_at desc.
|
|
2396
2711
|
*
|
|
2712
|
+
* Credential: `workspace_key`.
|
|
2713
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2714
|
+
*
|
|
2397
2715
|
* @param params - `Auth.AppScopedTenantListParams`.
|
|
2398
2716
|
* @param options - Per-request options.
|
|
2399
2717
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `status` value.
|
|
@@ -2405,10 +2723,10 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2405
2723
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenants
|
|
2406
2724
|
* @example
|
|
2407
2725
|
* ```ts
|
|
2408
|
-
* for await (const tenant of auth.admin.app("
|
|
2726
|
+
* for await (const tenant of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.list()) {
|
|
2409
2727
|
* console.log(tenant);
|
|
2410
2728
|
* }
|
|
2411
|
-
* const page = await auth.admin.app("
|
|
2729
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.list({}, { timeout: 5_000 });
|
|
2412
2730
|
* ```
|
|
2413
2731
|
*/
|
|
2414
2732
|
list(params, options) {
|
|
@@ -2417,6 +2735,9 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2417
2735
|
/**
|
|
2418
2736
|
* Get a single tenant by id or display id.
|
|
2419
2737
|
*
|
|
2738
|
+
* Credential: `workspace_key`.
|
|
2739
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2740
|
+
*
|
|
2420
2741
|
* @param tenantId - Id of the tenant.
|
|
2421
2742
|
* @param options - Per-request options.
|
|
2422
2743
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -2427,7 +2748,7 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2427
2748
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenants-tenant-id
|
|
2428
2749
|
* @example
|
|
2429
2750
|
* ```ts
|
|
2430
|
-
* const tenant = await auth.admin.app("
|
|
2751
|
+
* const tenant = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2431
2752
|
* ```
|
|
2432
2753
|
*/
|
|
2433
2754
|
retrieve(tenantId, options) {
|
|
@@ -2436,6 +2757,9 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2436
2757
|
/**
|
|
2437
2758
|
* Update a tenant (display_name, slug, status, metadata).
|
|
2438
2759
|
*
|
|
2760
|
+
* Credential: `workspace_key`.
|
|
2761
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2762
|
+
*
|
|
2439
2763
|
* @param tenantId - Id of the tenant.
|
|
2440
2764
|
* @param params - `Auth.AppScopedTenantUpdateParams`.
|
|
2441
2765
|
* @param options - Per-request options.
|
|
@@ -2449,7 +2773,7 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2449
2773
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-tenants-tenant-id
|
|
2450
2774
|
* @example
|
|
2451
2775
|
* ```ts
|
|
2452
|
-
* const tenant = await auth.admin.app("
|
|
2776
|
+
* const tenant = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { display_name: "Acme Inc" });
|
|
2453
2777
|
* ```
|
|
2454
2778
|
*/
|
|
2455
2779
|
update(tenantId, params, options) {
|
|
@@ -2460,6 +2784,9 @@ var AppUnverifiedAccountExpiryResource = class extends APIResource {
|
|
|
2460
2784
|
/**
|
|
2461
2785
|
* Get the unverified-account expiry setting and how many accounts it deleted in the last 30 days.
|
|
2462
2786
|
*
|
|
2787
|
+
* Credential: `workspace_key`.
|
|
2788
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2789
|
+
*
|
|
2463
2790
|
* @param options - Per-request options.
|
|
2464
2791
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
2465
2792
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -2469,7 +2796,7 @@ var AppUnverifiedAccountExpiryResource = class extends APIResource {
|
|
|
2469
2796
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-unverified-account-expiry
|
|
2470
2797
|
* @example
|
|
2471
2798
|
* ```ts
|
|
2472
|
-
* const unverifiedAccountExpiryStatus = await auth.admin.app("
|
|
2799
|
+
* const unverifiedAccountExpiryStatus = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").unverifiedAccountExpiry.retrieve();
|
|
2473
2800
|
* ```
|
|
2474
2801
|
*/
|
|
2475
2802
|
retrieve(options) {
|
|
@@ -2480,6 +2807,9 @@ var AppUnverifiedAccountExpiryResource = class extends APIResource {
|
|
|
2480
2807
|
*
|
|
2481
2808
|
* Permanently deletes every account that qualifies under the app's `unverified_account_ttl_days`, exactly as the nightly job does: each deletion is audited as `auth.account.expired_unverified` and fires `user.deleted` with `reason: "unverified_expired"`. Use `dry_run: true` to preview.
|
|
2482
2809
|
*
|
|
2810
|
+
* Credential: `workspace_key`.
|
|
2811
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2812
|
+
*
|
|
2483
2813
|
* @param params - `Auth.UnverifiedAccountExpiryRunParams`.
|
|
2484
2814
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2485
2815
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (`min_age_minutes` out of range).
|
|
@@ -2493,7 +2823,7 @@ var AppUnverifiedAccountExpiryResource = class extends APIResource {
|
|
|
2493
2823
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-unverified-account-expiry-run
|
|
2494
2824
|
* @example
|
|
2495
2825
|
* ```ts
|
|
2496
|
-
* const unverifiedAccountExpiryRun = await auth.admin.app("
|
|
2826
|
+
* const unverifiedAccountExpiryRun = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").unverifiedAccountExpiry.run({ dry_run: false });
|
|
2497
2827
|
* ```
|
|
2498
2828
|
*/
|
|
2499
2829
|
run(params, options) {
|
|
@@ -2506,6 +2836,9 @@ var AppWebauthnConfigResource = class extends APIResource {
|
|
|
2506
2836
|
*
|
|
2507
2837
|
* Returns defaults with `enabled: false` and a null `rp_id` when passkeys have never been configured for the app.
|
|
2508
2838
|
*
|
|
2839
|
+
* Credential: `workspace_key`.
|
|
2840
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2841
|
+
*
|
|
2509
2842
|
* @param options - Per-request options.
|
|
2510
2843
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
2511
2844
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -2515,7 +2848,7 @@ var AppWebauthnConfigResource = class extends APIResource {
|
|
|
2515
2848
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webauthn-config
|
|
2516
2849
|
* @example
|
|
2517
2850
|
* ```ts
|
|
2518
|
-
* const webauthnConfig = await auth.admin.app("
|
|
2851
|
+
* const webauthnConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webauthnConfig.retrieve();
|
|
2519
2852
|
* ```
|
|
2520
2853
|
*/
|
|
2521
2854
|
retrieve(options) {
|
|
@@ -2524,6 +2857,9 @@ var AppWebauthnConfigResource = class extends APIResource {
|
|
|
2524
2857
|
/**
|
|
2525
2858
|
* Set the per-app passkey (WebAuthn) relying-party settings.
|
|
2526
2859
|
*
|
|
2860
|
+
* Credential: `workspace_key`.
|
|
2861
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2862
|
+
*
|
|
2527
2863
|
* @param params - `Auth.WebauthnConfigUpdateParams`.
|
|
2528
2864
|
* @param options - Per-request options.
|
|
2529
2865
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `rp_id` is malformed, or is not a registrable suffix of any origin in `allowed_redirect_origins`.
|
|
@@ -2535,7 +2871,7 @@ var AppWebauthnConfigResource = class extends APIResource {
|
|
|
2535
2871
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-webauthn-config
|
|
2536
2872
|
* @example
|
|
2537
2873
|
* ```ts
|
|
2538
|
-
* const webauthnConfig = await auth.admin.app("
|
|
2874
|
+
* const webauthnConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webauthnConfig.update({ enabled: true, rp_id: "example.com" });
|
|
2539
2875
|
* ```
|
|
2540
2876
|
*/
|
|
2541
2877
|
update(params, options) {
|
|
@@ -2548,6 +2884,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2548
2884
|
*
|
|
2549
2885
|
* Deliveries are signed with the Standard Webhooks headers `webhook-id`, `webhook-timestamp` and `webhook-signature` (`v1,<base64 HMAC-SHA256 of "<id>.<timestamp>.<body>">`); the returned `whsec_…` secret works unchanged with any Standard Webhooks library. Failed deliveries are retried after 1 min, 5 min, 30 min, 2 h, 6 h and 24 h.
|
|
2550
2886
|
*
|
|
2887
|
+
* Credential: `workspace_key`.
|
|
2888
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2889
|
+
*
|
|
2551
2890
|
* @param params - `Auth.WebhookEndpointCreateParams`.
|
|
2552
2891
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2553
2892
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR, WEBHOOK_EVENT_TYPE_UNKNOWN: Validation failure: URL not https with a public host, or an unknown event type (`WEBHOOK_EVENT_TYPE_UNKNOWN`).
|
|
@@ -2561,7 +2900,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2561
2900
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-webhooks-endpoints
|
|
2562
2901
|
* @example
|
|
2563
2902
|
* ```ts
|
|
2564
|
-
* const webhookEndpointWithSecret = await auth.admin.app("
|
|
2903
|
+
* const webhookEndpointWithSecret = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.create({ url: "https://api.acme.com/webhooks" });
|
|
2565
2904
|
* ```
|
|
2566
2905
|
*/
|
|
2567
2906
|
create(params, options) {
|
|
@@ -2572,6 +2911,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2572
2911
|
*
|
|
2573
2912
|
* Queued retries are dropped. Its past attempts stay in the event log until the events expire.
|
|
2574
2913
|
*
|
|
2914
|
+
* Credential: `workspace_key`.
|
|
2915
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2916
|
+
*
|
|
2575
2917
|
* @param endpointId - Id of the endpoint.
|
|
2576
2918
|
* @param options - Per-request options.
|
|
2577
2919
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `endpoint_id` is not a UUID.
|
|
@@ -2583,7 +2925,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2583
2925
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-webhooks-endpoints-endpoint-id
|
|
2584
2926
|
* @example
|
|
2585
2927
|
* ```ts
|
|
2586
|
-
* await auth.admin.app("
|
|
2928
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2587
2929
|
* ```
|
|
2588
2930
|
*/
|
|
2589
2931
|
delete(endpointId, options) {
|
|
@@ -2594,6 +2936,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2594
2936
|
*
|
|
2595
2937
|
* At most 10, so this is always one page. Signing secrets are never returned here, only their last 4 characters.
|
|
2596
2938
|
*
|
|
2939
|
+
* Credential: `workspace_key`.
|
|
2940
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2941
|
+
*
|
|
2597
2942
|
* @param options - Per-request options.
|
|
2598
2943
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: The scope id in the path is malformed.
|
|
2599
2944
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -2604,7 +2949,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2604
2949
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webhooks-endpoints
|
|
2605
2950
|
* @example
|
|
2606
2951
|
* ```ts
|
|
2607
|
-
* for await (const endpoint of auth.admin.app("
|
|
2952
|
+
* for await (const endpoint of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.list()) {
|
|
2608
2953
|
* console.log(endpoint);
|
|
2609
2954
|
* }
|
|
2610
2955
|
* ```
|
|
@@ -2617,6 +2962,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2617
2962
|
*
|
|
2618
2963
|
* The endpoint's URL, subscription, on/off state, failure streak and the last 4 characters of its signing secret. The full secret is only returned when the endpoint is created or its secret is rotated.
|
|
2619
2964
|
*
|
|
2965
|
+
* Credential: `workspace_key`.
|
|
2966
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2967
|
+
*
|
|
2620
2968
|
* @param endpointId - Id of the endpoint.
|
|
2621
2969
|
* @param options - Per-request options.
|
|
2622
2970
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `endpoint_id` is not a UUID.
|
|
@@ -2628,7 +2976,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2628
2976
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webhooks-endpoints-endpoint-id
|
|
2629
2977
|
* @example
|
|
2630
2978
|
* ```ts
|
|
2631
|
-
* const webhookEndpoint = await auth.admin.app("
|
|
2979
|
+
* const webhookEndpoint = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2632
2980
|
* ```
|
|
2633
2981
|
*/
|
|
2634
2982
|
retrieve(endpointId, options) {
|
|
@@ -2639,6 +2987,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2639
2987
|
*
|
|
2640
2988
|
* For `grace_hours` (default 24) the previous secret keeps signing too: `webhook-signature` then lists one `v1,` signature per secret, so receivers can switch over without dropping a delivery.
|
|
2641
2989
|
*
|
|
2990
|
+
* Credential: `workspace_key`.
|
|
2991
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
2992
|
+
*
|
|
2642
2993
|
* @param endpointId - Id of the endpoint.
|
|
2643
2994
|
* @param params - `Auth.WebhookEndpointRotateSecretParams`.
|
|
2644
2995
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2652,7 +3003,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2652
3003
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-webhooks-endpoints-endpoint-id-rotate-secret
|
|
2653
3004
|
* @example
|
|
2654
3005
|
* ```ts
|
|
2655
|
-
* const webhookEndpointWithSecret = await auth.admin.app("
|
|
3006
|
+
* const webhookEndpointWithSecret = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.rotateSecret("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { grace_hours: 24 });
|
|
2656
3007
|
* ```
|
|
2657
3008
|
*/
|
|
2658
3009
|
rotateSecret(endpointId, params, options) {
|
|
@@ -2663,6 +3014,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2663
3014
|
*
|
|
2664
3015
|
* Delivers the catalogue example of `event_type`, signed like any delivery, with `"test": true` in the body. Works while the endpoint is switched off or not subscribed to that type, is logged in the event log, and is never retried or counted toward an automatic disable. Waits up to 15 s for your receiver.
|
|
2665
3016
|
*
|
|
3017
|
+
* Credential: `workspace_key`.
|
|
3018
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
3019
|
+
*
|
|
2666
3020
|
* @param endpointId - Id of the endpoint.
|
|
2667
3021
|
* @param params - `Auth.WebhookEndpointTestParams`.
|
|
2668
3022
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2676,7 +3030,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2676
3030
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-webhooks-endpoints-endpoint-id-test
|
|
2677
3031
|
* @example
|
|
2678
3032
|
* ```ts
|
|
2679
|
-
* const webhookDeliveryAttempt = await auth.admin.app("
|
|
3033
|
+
* const webhookDeliveryAttempt = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.test("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { event_type: "user.signup" });
|
|
2680
3034
|
* ```
|
|
2681
3035
|
*/
|
|
2682
3036
|
test(endpointId, params, options) {
|
|
@@ -2687,6 +3041,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2687
3041
|
*
|
|
2688
3042
|
* Only the fields sent change. `enabled: true` (or a new URL) also clears an automatic disable. Switching off cancels queued retries. The secret is unchanged; rotate it with `POST …/rotate-secret`.
|
|
2689
3043
|
*
|
|
3044
|
+
* Credential: `workspace_key`.
|
|
3045
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
3046
|
+
*
|
|
2690
3047
|
* @param endpointId - Id of the endpoint.
|
|
2691
3048
|
* @param params - `Auth.WebhookEndpointUpdateParams`.
|
|
2692
3049
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2701,7 +3058,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2701
3058
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-webhooks-endpoints-endpoint-id
|
|
2702
3059
|
* @example
|
|
2703
3060
|
* ```ts
|
|
2704
|
-
* const webhookEndpoint = await auth.admin.app("
|
|
3061
|
+
* const webhookEndpoint = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { description: "Production receiver" });
|
|
2705
3062
|
* ```
|
|
2706
3063
|
*/
|
|
2707
3064
|
update(endpointId, params, options) {
|
|
@@ -2714,6 +3071,9 @@ var AppWebhooksEventTypesResource = class extends APIResource {
|
|
|
2714
3071
|
*
|
|
2715
3072
|
* Each type with a plain description, its group and an example `data` object (what "Send test" delivers).
|
|
2716
3073
|
*
|
|
3074
|
+
* Credential: `workspace_key`.
|
|
3075
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
3076
|
+
*
|
|
2717
3077
|
* @param options - Per-request options.
|
|
2718
3078
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
2719
3079
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` (reads) or `auth.update` (changes, Send test, replay), or the app is suspended or archived.
|
|
@@ -2723,7 +3083,7 @@ var AppWebhooksEventTypesResource = class extends APIResource {
|
|
|
2723
3083
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webhooks-event-types
|
|
2724
3084
|
* @example
|
|
2725
3085
|
* ```ts
|
|
2726
|
-
* const listWebhookEventTypes = await auth.admin.app("
|
|
3086
|
+
* const listWebhookEventTypes = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.eventTypes.list();
|
|
2727
3087
|
* ```
|
|
2728
3088
|
*/
|
|
2729
3089
|
list(options) {
|
|
@@ -2736,6 +3096,9 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2736
3096
|
*
|
|
2737
3097
|
* Every event logged while at least one endpoint existed, with the latest state per endpoint and when the next retry is due.
|
|
2738
3098
|
*
|
|
3099
|
+
* Credential: `workspace_key`.
|
|
3100
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
3101
|
+
*
|
|
2739
3102
|
* @param params - `Auth.WebhookEventListParams`.
|
|
2740
3103
|
* @param options - Per-request options.
|
|
2741
3104
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid filter value or cursor.
|
|
@@ -2747,10 +3110,10 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2747
3110
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webhooks-events
|
|
2748
3111
|
* @example
|
|
2749
3112
|
* ```ts
|
|
2750
|
-
* for await (const event of auth.admin.app("
|
|
3113
|
+
* for await (const event of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.events.list()) {
|
|
2751
3114
|
* console.log(event);
|
|
2752
3115
|
* }
|
|
2753
|
-
* const page = await auth.admin.app("
|
|
3116
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.events.list({}, { timeout: 5_000 });
|
|
2754
3117
|
* ```
|
|
2755
3118
|
*/
|
|
2756
3119
|
list(params, options) {
|
|
@@ -2761,6 +3124,9 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2761
3124
|
*
|
|
2762
3125
|
* Same body and `webhook-id`, freshly signed, to every switched-on endpoint that receives this event type now, or only to `endpoint_id`. Waits for the receivers (up to 15 s each) and returns the attempts. A success cancels a retry still queued for that endpoint.
|
|
2763
3126
|
*
|
|
3127
|
+
* Credential: `workspace_key`.
|
|
3128
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
3129
|
+
*
|
|
2764
3130
|
* @param eventId - The event id, `evt_<uuid>`.
|
|
2765
3131
|
* @param params - `Auth.WebhookEventReplayParams`.
|
|
2766
3132
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2774,7 +3140,7 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2774
3140
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-webhooks-events-event-id-replay
|
|
2775
3141
|
* @example
|
|
2776
3142
|
* ```ts
|
|
2777
|
-
* const replayWebhookEvent = await auth.admin.app("
|
|
3143
|
+
* const replayWebhookEvent = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.events.replay("evt_3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2778
3144
|
* ```
|
|
2779
3145
|
*/
|
|
2780
3146
|
replay(eventId, params, options) {
|
|
@@ -2785,6 +3151,9 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2785
3151
|
*
|
|
2786
3152
|
* The event as it was sent (`type`, `data`) and every delivery attempt to every endpoint, with its trigger, HTTP status, error and the start of the response body. Use it to debug a receiver, then `replay` to send it again.
|
|
2787
3153
|
*
|
|
3154
|
+
* Credential: `workspace_key`.
|
|
3155
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
3156
|
+
*
|
|
2788
3157
|
* @param eventId - The event id, `evt_<uuid>`.
|
|
2789
3158
|
* @param options - Per-request options.
|
|
2790
3159
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `event_id` is not `evt_<uuid>`.
|
|
@@ -2796,7 +3165,7 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2796
3165
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webhooks-events-event-id
|
|
2797
3166
|
* @example
|
|
2798
3167
|
* ```ts
|
|
2799
|
-
* const webhookEventDetail = await auth.admin.app("
|
|
3168
|
+
* const webhookEventDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.events.retrieve("evt_3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2800
3169
|
* ```
|
|
2801
3170
|
*/
|
|
2802
3171
|
retrieve(eventId, options) {
|
|
@@ -2910,6 +3279,9 @@ var AuthApp = class extends APIResource {
|
|
|
2910
3279
|
/**
|
|
2911
3280
|
* Create a second app in the same workspace whose configuration matches this one — the "staging app" flow. Copies the auth config, roles, permissions, notification settings and the webhook target (with a NEW signing secret), and optionally tenants. Never copies credentials, end-users, sessions, signing keys, federated provider configs or audit history.
|
|
2912
3281
|
*
|
|
3282
|
+
* Credential: `workspace_key`.
|
|
3283
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
3284
|
+
*
|
|
2913
3285
|
* @param params - `Auth.CloneParams`.
|
|
2914
3286
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2915
3287
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure, or the slug matches the source.
|
|
@@ -2922,7 +3294,7 @@ var AuthApp = class extends APIResource {
|
|
|
2922
3294
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-clone
|
|
2923
3295
|
* @example
|
|
2924
3296
|
* ```ts
|
|
2925
|
-
* const cloneApp = await auth.admin.app("
|
|
3297
|
+
* const cloneApp = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").clone({ environment: "staging", slug: "acme-app-staging" });
|
|
2926
3298
|
* ```
|
|
2927
3299
|
*/
|
|
2928
3300
|
clone(params, options) {
|
|
@@ -2931,6 +3303,9 @@ var AuthApp = class extends APIResource {
|
|
|
2931
3303
|
/**
|
|
2932
3304
|
* Update app status (active, suspended, archived)
|
|
2933
3305
|
*
|
|
3306
|
+
* Credential: `workspace_key`.
|
|
3307
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
3308
|
+
*
|
|
2934
3309
|
* @param params - `Auth.UpdateStatusParams`.
|
|
2935
3310
|
* @param options - Per-request options.
|
|
2936
3311
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid status transition (e.g. archived → active).
|
|
@@ -2942,7 +3317,7 @@ var AuthApp = class extends APIResource {
|
|
|
2942
3317
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-status
|
|
2943
3318
|
* @example
|
|
2944
3319
|
* ```ts
|
|
2945
|
-
* const app = await auth.admin.app("
|
|
3320
|
+
* const app = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").updateStatus({ status: "suspended" });
|
|
2946
3321
|
* ```
|
|
2947
3322
|
*/
|
|
2948
3323
|
updateStatus(params, options) {
|
|
@@ -3078,6 +3453,9 @@ var ConsumerMeActivityResource = class extends APIResource {
|
|
|
3078
3453
|
*
|
|
3079
3454
|
* Login events, password changes, and other security-relevant records, scoped to this EndUser.
|
|
3080
3455
|
*
|
|
3456
|
+
* Credential: `end_user_token`.
|
|
3457
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3458
|
+
*
|
|
3081
3459
|
* @param options - Per-request options.
|
|
3082
3460
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3083
3461
|
* @throws {RateLimitError} 429 RATE_LIMITED: Rate limited: too many requests from this client IP in the last 60 seconds (`RATE_LIMITED`); wait `Retry-After` seconds.
|
|
@@ -3085,7 +3463,7 @@ var ConsumerMeActivityResource = class extends APIResource {
|
|
|
3085
3463
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me-activity
|
|
3086
3464
|
* @example
|
|
3087
3465
|
* ```ts
|
|
3088
|
-
* for await (const activity of auth.consumer("app").me.activity.list()) {
|
|
3466
|
+
* for await (const activity of auth.consumer("my-app").me.activity.list()) {
|
|
3089
3467
|
* console.log(activity);
|
|
3090
3468
|
* }
|
|
3091
3469
|
* ```
|
|
@@ -3100,6 +3478,9 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3100
3478
|
*
|
|
3101
3479
|
* Adds an email or phone contact to the EndUser. The contact starts unverified and non-primary. Verification is a separate flow — call /auth/request-verification with the contact value and the customer's PAK to mint a code, then submit via /auth/verify.
|
|
3102
3480
|
*
|
|
3481
|
+
* Credential: `end_user_token`.
|
|
3482
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3483
|
+
*
|
|
3103
3484
|
* @param params - `Auth.MeContactCreateParams`.
|
|
3104
3485
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
3105
3486
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Request validation failed: unsupported `type`, invalid email, or empty/over-long `value`.
|
|
@@ -3110,7 +3491,7 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3110
3491
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-contacts
|
|
3111
3492
|
* @example
|
|
3112
3493
|
* ```ts
|
|
3113
|
-
* const meContact = await auth.consumer("app").me.contacts.create({ type: "email", value: "
|
|
3494
|
+
* const meContact = await auth.consumer("my-app").me.contacts.create({ type: "email", value: "ada@example.com" });
|
|
3114
3495
|
* ```
|
|
3115
3496
|
*/
|
|
3116
3497
|
create(params, options) {
|
|
@@ -3119,6 +3500,9 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3119
3500
|
/**
|
|
3120
3501
|
* Delete a contact
|
|
3121
3502
|
*
|
|
3503
|
+
* Credential: `end_user_token`.
|
|
3504
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3505
|
+
*
|
|
3122
3506
|
* @param id - Id of the contact.
|
|
3123
3507
|
* @param options - Per-request options.
|
|
3124
3508
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
@@ -3129,7 +3513,7 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3129
3513
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-me-contacts-id
|
|
3130
3514
|
* @example
|
|
3131
3515
|
* ```ts
|
|
3132
|
-
* await auth.consumer("app").me.contacts.delete("
|
|
3516
|
+
* await auth.consumer("my-app").me.contacts.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
3133
3517
|
* ```
|
|
3134
3518
|
*/
|
|
3135
3519
|
delete(id, options) {
|
|
@@ -3138,6 +3522,9 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3138
3522
|
/**
|
|
3139
3523
|
* List the EndUser's contacts
|
|
3140
3524
|
*
|
|
3525
|
+
* Credential: `end_user_token`.
|
|
3526
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3527
|
+
*
|
|
3141
3528
|
* @param options - Per-request options.
|
|
3142
3529
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3143
3530
|
* @throws {RateLimitError} 429 RATE_LIMITED: Per-IP rate limit (`RATE_LIMITED`): the general bucket, 60 requests per minute per IP. Adding, verifying or removing a contact is in the strict `auth` bucket (10 per minute).
|
|
@@ -3145,7 +3532,7 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3145
3532
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me-contacts
|
|
3146
3533
|
* @example
|
|
3147
3534
|
* ```ts
|
|
3148
|
-
* const meContacts = await auth.consumer("app").me.contacts.list();
|
|
3535
|
+
* const meContacts = await auth.consumer("my-app").me.contacts.list();
|
|
3149
3536
|
* ```
|
|
3150
3537
|
*/
|
|
3151
3538
|
list(options) {
|
|
@@ -3156,6 +3543,9 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3156
3543
|
*
|
|
3157
3544
|
* Demotes the previous primary of the same type. Refused (409) when the target contact is unverified — promoting an unverified contact would let an attacker who registered the contact bypass verification by routing reset codes through it.
|
|
3158
3545
|
*
|
|
3546
|
+
* Credential: `end_user_token`.
|
|
3547
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3548
|
+
*
|
|
3159
3549
|
* @param id - Id of the contact.
|
|
3160
3550
|
* @param options - Per-request options.
|
|
3161
3551
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
@@ -3166,7 +3556,7 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3166
3556
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-contacts-id-promote
|
|
3167
3557
|
* @example
|
|
3168
3558
|
* ```ts
|
|
3169
|
-
* await auth.consumer("app").me.contacts.promote("
|
|
3559
|
+
* await auth.consumer("my-app").me.contacts.promote("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
3170
3560
|
* ```
|
|
3171
3561
|
*/
|
|
3172
3562
|
promote(id, options) {
|
|
@@ -3179,6 +3569,9 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3179
3569
|
*
|
|
3180
3570
|
* Creates a pending factor and returns the type-specific enrollment payload. TOTP: the otpauth URI, QR data URL, and shared secret; confirm with two consecutive codes. Email: a 6-digit code is sent to the bound verified email contact (primary by default, `contact_id` to override); confirm with that single code. The factor stays disabled until `/factors/:id/verify` succeeds.
|
|
3181
3571
|
*
|
|
3572
|
+
* Credential: `end_user_token`.
|
|
3573
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3574
|
+
*
|
|
3182
3575
|
* @param params - `Auth.MeMfaFactorCreateParams`.
|
|
3183
3576
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
3184
3577
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Request validation failed: unsupported `type`, over-long `label`, or `contact_id` is not a UUID.
|
|
@@ -3191,7 +3584,7 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3191
3584
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-factors
|
|
3192
3585
|
* @example
|
|
3193
3586
|
* ```ts
|
|
3194
|
-
* const startEnrollment = await auth.consumer("app").me.mfa.factors.create({ type: "totp" });
|
|
3587
|
+
* const startEnrollment = await auth.consumer("my-app").me.mfa.factors.create({ type: "totp" });
|
|
3195
3588
|
* ```
|
|
3196
3589
|
*/
|
|
3197
3590
|
create(params, options) {
|
|
@@ -3202,6 +3595,9 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3202
3595
|
*
|
|
3203
3596
|
* Soft-disable. The row is preserved (with `disabled_at` set) for audit. Has no effect on existing sessions — their `amr` claim still reflects whatever satisfied sign-in at the time. Disabling the only enabled factor removes the MFA requirement on future sign-ins.
|
|
3204
3597
|
*
|
|
3598
|
+
* Credential: `end_user_token`.
|
|
3599
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3600
|
+
*
|
|
3205
3601
|
* @param id - Id of the factor.
|
|
3206
3602
|
* @param options - Per-request options.
|
|
3207
3603
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
@@ -3211,7 +3607,7 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3211
3607
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-me-mfa-factors-id
|
|
3212
3608
|
* @example
|
|
3213
3609
|
* ```ts
|
|
3214
|
-
* await auth.consumer("app").me.mfa.factors.delete("
|
|
3610
|
+
* await auth.consumer("my-app").me.mfa.factors.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
3215
3611
|
* ```
|
|
3216
3612
|
*/
|
|
3217
3613
|
delete(id, options) {
|
|
@@ -3222,6 +3618,9 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3222
3618
|
*
|
|
3223
3619
|
* Includes factors in any state (pending enrollment + enabled). Disabled factors are not listed.
|
|
3224
3620
|
*
|
|
3621
|
+
* Credential: `end_user_token`.
|
|
3622
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3623
|
+
*
|
|
3225
3624
|
* @param options - Per-request options.
|
|
3226
3625
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3227
3626
|
* @throws {RateLimitError} 429 RATE_LIMITED: Rate limited: too many requests from this client IP in the last 60 seconds (`RATE_LIMITED`); wait `Retry-After` seconds.
|
|
@@ -3229,7 +3628,7 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3229
3628
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me-mfa-factors
|
|
3230
3629
|
* @example
|
|
3231
3630
|
* ```ts
|
|
3232
|
-
* const factorList = await auth.consumer("app").me.mfa.factors.list();
|
|
3631
|
+
* const factorList = await auth.consumer("my-app").me.mfa.factors.list();
|
|
3233
3632
|
* ```
|
|
3234
3633
|
*/
|
|
3235
3634
|
list(options) {
|
|
@@ -3240,6 +3639,9 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3240
3639
|
*
|
|
3241
3640
|
* TOTP: submit two `codes` from consecutive 30-second windows. Email: submit the emailed 6-digit `code`. On success the factor flips to enabled, recovery codes are minted (returned once), and prior recovery codes for the account are invalidated. Subsequent calls with the same `:id` fail with 400.
|
|
3242
3641
|
*
|
|
3642
|
+
* Credential: `end_user_token`.
|
|
3643
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3644
|
+
*
|
|
3243
3645
|
* @param id - Id of the factor.
|
|
3244
3646
|
* @param params - `Auth.MeMfaFactorVerifyParams`.
|
|
3245
3647
|
* @param options - Per-request options.
|
|
@@ -3250,7 +3652,7 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3250
3652
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-factors-id-verify
|
|
3251
3653
|
* @example
|
|
3252
3654
|
* ```ts
|
|
3253
|
-
* const confirmEnrollment = await auth.consumer("app").me.mfa.factors.verify("
|
|
3655
|
+
* const confirmEnrollment = await auth.consumer("my-app").me.mfa.factors.verify("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { code: "123456" });
|
|
3254
3656
|
* ```
|
|
3255
3657
|
*/
|
|
3256
3658
|
verify(id, params, options) {
|
|
@@ -3263,6 +3665,9 @@ var ConsumerMeMfaRecoveryCodesResource = class extends APIResource {
|
|
|
3263
3665
|
*
|
|
3264
3666
|
* Mints a fresh set of single-use recovery codes and invalidates every prior code for the account. The new codes are returned once — store them now.
|
|
3265
3667
|
*
|
|
3668
|
+
* Credential: `end_user_token`.
|
|
3669
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3670
|
+
*
|
|
3266
3671
|
* @param options - Per-request options.
|
|
3267
3672
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3268
3673
|
* @throws {RateLimitError} 429 RATE_LIMITED: Rate limited: too many requests from this client IP in the last 60 seconds (`RATE_LIMITED`); wait `Retry-After` seconds.
|
|
@@ -3270,7 +3675,7 @@ var ConsumerMeMfaRecoveryCodesResource = class extends APIResource {
|
|
|
3270
3675
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-recovery-codes-regenerate
|
|
3271
3676
|
* @example
|
|
3272
3677
|
* ```ts
|
|
3273
|
-
* const recoveryCodes = await auth.consumer("app").me.mfa.recoveryCodes.regenerate();
|
|
3678
|
+
* const recoveryCodes = await auth.consumer("my-app").me.mfa.recoveryCodes.regenerate();
|
|
3274
3679
|
* ```
|
|
3275
3680
|
*/
|
|
3276
3681
|
regenerate(options) {
|
|
@@ -3283,6 +3688,9 @@ var ConsumerMeMfaStepUpWebauthnResource = class extends APIResource {
|
|
|
3283
3688
|
*
|
|
3284
3689
|
* Mints a single-use WebAuthn challenge for the enabled passkeys on this account and returns the `publicKey` member for `navigator.credentials.get()`. Submit the result to `/step-up` as `credential`. Refused while step-up is locked on this session — a locked session must not be able to keep minting challenges.
|
|
3285
3690
|
*
|
|
3691
|
+
* Credential: `end_user_token`.
|
|
3692
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3693
|
+
*
|
|
3286
3694
|
* @param options - Per-request options.
|
|
3287
3695
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: No passkey is enrolled on this account.
|
|
3288
3696
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3292,7 +3700,7 @@ var ConsumerMeMfaStepUpWebauthnResource = class extends APIResource {
|
|
|
3292
3700
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-step-up-webauthn-options
|
|
3293
3701
|
* @example
|
|
3294
3702
|
* ```ts
|
|
3295
|
-
* const webauthnOptions = await auth.consumer("app").me.mfa.stepUp.webauthn.options();
|
|
3703
|
+
* const webauthnOptions = await auth.consumer("my-app").me.mfa.stepUp.webauthn.options();
|
|
3296
3704
|
* ```
|
|
3297
3705
|
*/
|
|
3298
3706
|
options(options) {
|
|
@@ -3309,6 +3717,9 @@ var ConsumerMeMfaStepUpResource = class extends APIResource {
|
|
|
3309
3717
|
*
|
|
3310
3718
|
* Mints a single-use 6-digit code against one of the account's enabled email factors and delivers it to the bound address. Follow with `/step-up` submitting the code. Codes expire after 5 minutes; sends are throttled per contact (30s between sends, shared with the sign-in path). Refused while step-up is locked on this session.
|
|
3311
3719
|
*
|
|
3720
|
+
* Credential: `end_user_token`.
|
|
3721
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3722
|
+
*
|
|
3312
3723
|
* @param params - `Auth.MeMfaStepUpSendCodeParams`.
|
|
3313
3724
|
* @param options - Per-request options.
|
|
3314
3725
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Account has no enabled email factor (or the named factor is not an email factor).
|
|
@@ -3320,7 +3731,7 @@ var ConsumerMeMfaStepUpResource = class extends APIResource {
|
|
|
3320
3731
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-step-up-send-code
|
|
3321
3732
|
* @example
|
|
3322
3733
|
* ```ts
|
|
3323
|
-
* const stepUpSendCode = await auth.consumer("app").me.mfa.stepUp.sendCode({ factor_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b" });
|
|
3734
|
+
* const stepUpSendCode = await auth.consumer("my-app").me.mfa.stepUp.sendCode({ factor_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b" });
|
|
3324
3735
|
* ```
|
|
3325
3736
|
*/
|
|
3326
3737
|
sendCode(params, options) {
|
|
@@ -3331,6 +3742,9 @@ var ConsumerMeMfaStepUpResource = class extends APIResource {
|
|
|
3331
3742
|
*
|
|
3332
3743
|
* Verify a fresh code (TOTP, emailed via `/step-up/send-code`, or recovery) against any enabled factor on the account, and update the session's `auth_methods` + `mfa_at`. Call `/auth/refresh` after this to mint a token whose claims reflect the new state. Customers reading `mfa_at` from access tokens to gate sensitive actions should require a `/step-up` + refresh cycle when the timestamp is older than their policy window. 5 consecutive wrong codes lock step-up on this session for 15 minutes.
|
|
3333
3744
|
*
|
|
3745
|
+
* Credential: `end_user_token`.
|
|
3746
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3747
|
+
*
|
|
3334
3748
|
* @param params - `Auth.MeMfaStepUpVerifyParams`.
|
|
3335
3749
|
* @param options - Per-request options.
|
|
3336
3750
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Code did not match any enabled factor or recovery code.
|
|
@@ -3340,7 +3754,7 @@ var ConsumerMeMfaStepUpResource = class extends APIResource {
|
|
|
3340
3754
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-step-up
|
|
3341
3755
|
* @example
|
|
3342
3756
|
* ```ts
|
|
3343
|
-
* const stepUp = await auth.consumer("app").me.mfa.stepUp.verify({ code: "123456" });
|
|
3757
|
+
* const stepUp = await auth.consumer("my-app").me.mfa.stepUp.verify({ code: "123456" });
|
|
3344
3758
|
* ```
|
|
3345
3759
|
*/
|
|
3346
3760
|
verify(params, options) {
|
|
@@ -3367,6 +3781,9 @@ var ConsumerMeSessionsResource = class extends APIResource {
|
|
|
3367
3781
|
*
|
|
3368
3782
|
* Sign the EndUser out of one device. The session's refresh token is destroyed; its access token expires on its TTL. Requires the `session.revoke` permission when the app's `enforce_app_permissions` flag is on; otherwise (the default) any valid token can call this. Self-revoke (revoking your own session as a member with no perms) is something to enforce separately if needed; this guard does not exempt the principal from the role check.
|
|
3369
3783
|
*
|
|
3784
|
+
* Credential: `end_user_token`.
|
|
3785
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3786
|
+
*
|
|
3370
3787
|
* @param id - Id of the session.
|
|
3371
3788
|
* @param options - Per-request options.
|
|
3372
3789
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
@@ -3376,7 +3793,7 @@ var ConsumerMeSessionsResource = class extends APIResource {
|
|
|
3376
3793
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-me-sessions-id
|
|
3377
3794
|
* @example
|
|
3378
3795
|
* ```ts
|
|
3379
|
-
* await auth.consumer("app").me.sessions.delete("
|
|
3796
|
+
* await auth.consumer("my-app").me.sessions.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
3380
3797
|
* ```
|
|
3381
3798
|
*/
|
|
3382
3799
|
delete(id, options) {
|
|
@@ -3387,6 +3804,9 @@ var ConsumerMeSessionsResource = class extends APIResource {
|
|
|
3387
3804
|
*
|
|
3388
3805
|
* Each session includes a `current` flag identifying the one belonging to the bearer token used for this request.
|
|
3389
3806
|
*
|
|
3807
|
+
* Credential: `end_user_token`.
|
|
3808
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3809
|
+
*
|
|
3390
3810
|
* @param options - Per-request options.
|
|
3391
3811
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3392
3812
|
* @throws {RateLimitError} 429 RATE_LIMITED: Rate limited: too many requests from this client IP in the last 60 seconds (`RATE_LIMITED`); wait `Retry-After` seconds.
|
|
@@ -3394,7 +3814,7 @@ var ConsumerMeSessionsResource = class extends APIResource {
|
|
|
3394
3814
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me-sessions
|
|
3395
3815
|
* @example
|
|
3396
3816
|
* ```ts
|
|
3397
|
-
* for await (const session of auth.consumer("app").me.sessions.list()) {
|
|
3817
|
+
* for await (const session of auth.consumer("my-app").me.sessions.list()) {
|
|
3398
3818
|
* console.log(session);
|
|
3399
3819
|
* }
|
|
3400
3820
|
* ```
|
|
@@ -3409,6 +3829,9 @@ var ConsumerMeTenantInvitesResource = class extends APIResource {
|
|
|
3409
3829
|
*
|
|
3410
3830
|
* Adds the caller to the invited tenant with the role the invite names, and consumes the invite. Requires the invited address to be one of the caller's own VERIFIED email contacts in this app — holding the code is not sufficient, because whoever minted the invite also holds it, and an unverified contact is not proof of owning the address. A refused accept leaves the invite redeemable.
|
|
3411
3831
|
*
|
|
3832
|
+
* Credential: `end_user_token`.
|
|
3833
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3834
|
+
*
|
|
3412
3835
|
* @param params - `Auth.MeTenantInviteAcceptParams`.
|
|
3413
3836
|
* @param options - Per-request options.
|
|
3414
3837
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3421,7 +3844,7 @@ var ConsumerMeTenantInvitesResource = class extends APIResource {
|
|
|
3421
3844
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-tenant-invites-accept
|
|
3422
3845
|
* @example
|
|
3423
3846
|
* ```ts
|
|
3424
|
-
* const acceptedTenantInvite = await auth.consumer("app").me.tenantInvites.accept({ code: "tinv_9dK2mQ7pR4vXbN1sT6yZ0hLcJeW3fAgU" });
|
|
3847
|
+
* const acceptedTenantInvite = await auth.consumer("my-app").me.tenantInvites.accept({ code: "tinv_9dK2mQ7pR4vXbN1sT6yZ0hLcJeW3fAgU" });
|
|
3425
3848
|
* ```
|
|
3426
3849
|
*/
|
|
3427
3850
|
accept(params, options) {
|
|
@@ -3434,6 +3857,9 @@ var ConsumerMeTenantsResource = class extends APIResource {
|
|
|
3434
3857
|
*
|
|
3435
3858
|
* Returns each tenant the caller is a member of, including the tenant slug + display name and the member's role. Powers a tenant-switcher UI on the customer's product.
|
|
3436
3859
|
*
|
|
3860
|
+
* Credential: `end_user_token`.
|
|
3861
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3862
|
+
*
|
|
3437
3863
|
* @param options - Per-request options.
|
|
3438
3864
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing / invalid bearer, or the session behind the token is revoked, expired or no longer exists.
|
|
3439
3865
|
* @throws {PermissionDeniedError} 403 FORBIDDEN, APP_SUSPENDED, APP_ARCHIVED: The app exists but is suspended (`APP_SUSPENDED`) or archived (`APP_ARCHIVED`). Decided by `AppStatusGuard` before the handler runs.
|
|
@@ -3443,7 +3869,7 @@ var ConsumerMeTenantsResource = class extends APIResource {
|
|
|
3443
3869
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-auth-me-tenants
|
|
3444
3870
|
* @example
|
|
3445
3871
|
* ```ts
|
|
3446
|
-
* const myTenants = await auth.consumer("app").me.tenants.list();
|
|
3872
|
+
* const myTenants = await auth.consumer("my-app").me.tenants.list();
|
|
3447
3873
|
* ```
|
|
3448
3874
|
*/
|
|
3449
3875
|
list(options) {
|
|
@@ -3480,6 +3906,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3480
3906
|
*
|
|
3481
3907
|
* Verifies `current_password`, sets the new hash, and revokes every OTHER active session for the account (the calling session is preserved). 401 if the current password is wrong or the account has no password credential — admin-provisioned accounts without an initial password should use the reset flow instead. The new password is held to exactly the same policy as signup: the app's length + character-class rules, the common-password deny-list, and the breach corpus.
|
|
3482
3908
|
*
|
|
3909
|
+
* Credential: `end_user_token`.
|
|
3910
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3911
|
+
*
|
|
3483
3912
|
* @param params - `Auth.MeChangePasswordParams`.
|
|
3484
3913
|
* @param options - Per-request options.
|
|
3485
3914
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR, PASSWORD_TOO_COMMON, PASSWORD_BREACHED: The new password fails the app-configured policy, is on the common-password deny-list (`PASSWORD_TOO_COMMON`), appears in a public breach corpus (`PASSWORD_BREACHED`), or is identical to the current one.
|
|
@@ -3490,7 +3919,10 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3490
3919
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-change-password
|
|
3491
3920
|
* @example
|
|
3492
3921
|
* ```ts
|
|
3493
|
-
* await auth.consumer("app").me.changePassword({
|
|
3922
|
+
* await auth.consumer("my-app").me.changePassword({
|
|
3923
|
+
* current_password: "correct horse battery staple",
|
|
3924
|
+
* new_password: "a new long passphrase 42",
|
|
3925
|
+
* });
|
|
3494
3926
|
* ```
|
|
3495
3927
|
*/
|
|
3496
3928
|
changePassword(params, options) {
|
|
@@ -3501,6 +3933,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3501
3933
|
*
|
|
3502
3934
|
* Removes the EndUser, all sessions, and all related records inside this app. Cannot be undone. The app audit log keeps one `auth.account.deleted` row (`via: self`; username and email domain only, never the address), and `user.deleted` fires with `via: "self"`.
|
|
3503
3935
|
*
|
|
3936
|
+
* Credential: `end_user_token`.
|
|
3937
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3938
|
+
*
|
|
3504
3939
|
* @param options - Per-request options.
|
|
3505
3940
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3506
3941
|
* @throws {RateLimitError} 429 RATE_LIMITED: Rate limited: too many requests from this client IP in the last 60 seconds (`RATE_LIMITED`); wait `Retry-After` seconds.
|
|
@@ -3508,7 +3943,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3508
3943
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-me
|
|
3509
3944
|
* @example
|
|
3510
3945
|
* ```ts
|
|
3511
|
-
* await auth.consumer("app").me.deleteAccount();
|
|
3946
|
+
* await auth.consumer("my-app").me.deleteAccount();
|
|
3512
3947
|
* ```
|
|
3513
3948
|
*/
|
|
3514
3949
|
deleteAccount(options) {
|
|
@@ -3519,6 +3954,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3519
3954
|
*
|
|
3520
3955
|
* Clears both the uploaded avatar and any provider-captured picture, and deletes the stored object. A later Google/GitHub sign-in re-populates the provider picture — that is "sync from provider" behavior, by design.
|
|
3521
3956
|
*
|
|
3957
|
+
* Credential: `end_user_token`.
|
|
3958
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3959
|
+
*
|
|
3522
3960
|
* @param options - Per-request options.
|
|
3523
3961
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3524
3962
|
* @throws {NotFoundError} 404 NOT_FOUND, ACCOUNT_NOT_FOUND: Account not found in this app (`ACCOUNT_NOT_FOUND`).
|
|
@@ -3527,7 +3965,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3527
3965
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-me-avatar
|
|
3528
3966
|
* @example
|
|
3529
3967
|
* ```ts
|
|
3530
|
-
* await auth.consumer("app").me.deleteAvatar();
|
|
3968
|
+
* await auth.consumer("my-app").me.deleteAvatar();
|
|
3531
3969
|
* ```
|
|
3532
3970
|
*/
|
|
3533
3971
|
deleteAvatar(options) {
|
|
@@ -3538,6 +3976,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3538
3976
|
*
|
|
3539
3977
|
* Returns the union of the app-level role permissions and the tenant-level role permissions (when the token carries an `org_id`). Resolved per-request through a 60-second LRU — role-permission edits propagate within ~1 minute. Use this instead of decoding a `permissions[]` claim from the JWT, which is no longer included. M2M tokens cannot call this — use `POST /:appSlug/v1/oauth/introspect` to inspect M2M scopes.
|
|
3540
3978
|
*
|
|
3979
|
+
* Credential: `end_user_token`.
|
|
3980
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3981
|
+
*
|
|
3541
3982
|
* @param options - Per-request options.
|
|
3542
3983
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3543
3984
|
* @throws {RateLimitError} 429 RATE_LIMITED: Rate limited: too many requests from this client IP in the last 60 seconds (`RATE_LIMITED`); wait `Retry-After` seconds.
|
|
@@ -3545,7 +3986,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3545
3986
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me-permissions
|
|
3546
3987
|
* @example
|
|
3547
3988
|
* ```ts
|
|
3548
|
-
* const mePermissions = await auth.consumer("app").me.permissions();
|
|
3989
|
+
* const mePermissions = await auth.consumer("my-app").me.permissions();
|
|
3549
3990
|
* ```
|
|
3550
3991
|
*/
|
|
3551
3992
|
permissions(options) {
|
|
@@ -3556,6 +3997,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3556
3997
|
*
|
|
3557
3998
|
* Returns the EndUser identity, app membership, and role name. The flat `permissions[]` array is intentionally NOT included — permissions resolve from the role on demand. Call `GET /me/permissions` for the flat list when the client needs it for UI gating.
|
|
3558
3999
|
*
|
|
4000
|
+
* Credential: `end_user_token`.
|
|
4001
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4002
|
+
*
|
|
3559
4003
|
* @param options - Per-request options.
|
|
3560
4004
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
3561
4005
|
* @throws {NotFoundError} 404 NOT_FOUND: Account not found.
|
|
@@ -3564,7 +4008,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3564
4008
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me
|
|
3565
4009
|
* @example
|
|
3566
4010
|
* ```ts
|
|
3567
|
-
* const meProfile = await auth.consumer("app").me.retrieve();
|
|
4011
|
+
* const meProfile = await auth.consumer("my-app").me.retrieve();
|
|
3568
4012
|
* ```
|
|
3569
4013
|
*/
|
|
3570
4014
|
retrieve(options) {
|
|
@@ -3575,6 +4019,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3575
4019
|
*
|
|
3576
4020
|
* Editable fields: `display_name` and `username`. The username is unique per app (case-insensitive, same rule as signup); sending the current username is a no-op. Usernames cannot be cleared.
|
|
3577
4021
|
*
|
|
4022
|
+
* Credential: `end_user_token`.
|
|
4023
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4024
|
+
*
|
|
3578
4025
|
* @param params - `Auth.MeUpdateParams`.
|
|
3579
4026
|
* @param options - Per-request options.
|
|
3580
4027
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3584,7 +4031,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3584
4031
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-me
|
|
3585
4032
|
* @example
|
|
3586
4033
|
* ```ts
|
|
3587
|
-
* const meUpdatedAccount = await auth.consumer("app").me.update({ display_name: "Ada Lovelace" });
|
|
4034
|
+
* const meUpdatedAccount = await auth.consumer("my-app").me.update({ display_name: "Ada Lovelace" });
|
|
3588
4035
|
* ```
|
|
3589
4036
|
*/
|
|
3590
4037
|
update(params, options) {
|
|
@@ -3595,6 +4042,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3595
4042
|
*
|
|
3596
4043
|
* PNG/JPEG/WEBP only — SVG is rejected (stored-XSS vector). ≤2 MB. Magic bytes are sniffed; a mislabeled file is rejected. The image is re-encoded server-side (orientation baked in, all metadata incl. EXIF/GPS stripped, bounded to 512×512, webp). An uploaded avatar takes precedence over a provider-captured picture.
|
|
3597
4044
|
*
|
|
4045
|
+
* Credential: `end_user_token`.
|
|
4046
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4047
|
+
*
|
|
3598
4048
|
* @param params - `Auth.MeUploadAvatarParams`.
|
|
3599
4049
|
* @param options - Per-request options.
|
|
3600
4050
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3605,7 +4055,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3605
4055
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-avatar
|
|
3606
4056
|
* @example
|
|
3607
4057
|
* ```ts
|
|
3608
|
-
* const avatarUrl = await auth.consumer("app").me.uploadAvatar({ file: new File(["…"], "image.png", { type: "image/png" }) });
|
|
4058
|
+
* const avatarUrl = await auth.consumer("my-app").me.uploadAvatar({ file: new File(["…"], "image.png", { type: "image/png" }) });
|
|
3609
4059
|
* ```
|
|
3610
4060
|
*/
|
|
3611
4061
|
uploadAvatar(params, options) {
|
|
@@ -3671,7 +4121,7 @@ var ConsumerMfaWebauthnResource = class extends APIResource {
|
|
|
3671
4121
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-webauthn-options
|
|
3672
4122
|
* @example
|
|
3673
4123
|
* ```ts
|
|
3674
|
-
* const consumerWebauthnOptions = await auth.consumer("app").mfa.webauthn.options({ mfa_token: "
|
|
4124
|
+
* const consumerWebauthnOptions = await auth.consumer("my-app").mfa.webauthn.options({ mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f" });
|
|
3675
4125
|
* ```
|
|
3676
4126
|
*/
|
|
3677
4127
|
options(params, options) {
|
|
@@ -3701,7 +4151,7 @@ var ConsumerMfaResource = class extends APIResource {
|
|
|
3701
4151
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-enroll
|
|
3702
4152
|
* @example
|
|
3703
4153
|
* ```ts
|
|
3704
|
-
* const startEnrollment = await auth.consumer("app").mfa.enroll({ mfa_token: "
|
|
4154
|
+
* const startEnrollment = await auth.consumer("my-app").mfa.enroll({ mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", type: "totp" });
|
|
3705
4155
|
* ```
|
|
3706
4156
|
*/
|
|
3707
4157
|
enroll(params, options) {
|
|
@@ -3725,7 +4175,10 @@ var ConsumerMfaResource = class extends APIResource {
|
|
|
3725
4175
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-recover
|
|
3726
4176
|
* @example
|
|
3727
4177
|
* ```ts
|
|
3728
|
-
* const consumerToken = await auth.consumer("app").mfa.recover({
|
|
4178
|
+
* const consumerToken = await auth.consumer("my-app").mfa.recover({
|
|
4179
|
+
* mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f",
|
|
4180
|
+
* recovery_code: "1a2b-3c4d-5e6f-7890",
|
|
4181
|
+
* });
|
|
3729
4182
|
* ```
|
|
3730
4183
|
*/
|
|
3731
4184
|
recover(params, options) {
|
|
@@ -3750,7 +4203,10 @@ var ConsumerMfaResource = class extends APIResource {
|
|
|
3750
4203
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-send-code
|
|
3751
4204
|
* @example
|
|
3752
4205
|
* ```ts
|
|
3753
|
-
* const consumerMfaSendCode = await auth.consumer("app").mfa.sendCode({
|
|
4206
|
+
* const consumerMfaSendCode = await auth.consumer("my-app").mfa.sendCode({
|
|
4207
|
+
* factor_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
4208
|
+
* mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f",
|
|
4209
|
+
* });
|
|
3754
4210
|
* ```
|
|
3755
4211
|
*/
|
|
3756
4212
|
sendCode(params, options) {
|
|
@@ -3773,7 +4229,7 @@ var ConsumerMfaResource = class extends APIResource {
|
|
|
3773
4229
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-verify
|
|
3774
4230
|
* @example
|
|
3775
4231
|
* ```ts
|
|
3776
|
-
* const consumerToken = await auth.consumer("app").mfa.verify({ mfa_token: "
|
|
4232
|
+
* const consumerToken = await auth.consumer("my-app").mfa.verify({ mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f" });
|
|
3777
4233
|
* ```
|
|
3778
4234
|
*/
|
|
3779
4235
|
verify(params, options) {
|
|
@@ -3796,7 +4252,10 @@ var ConsumerMfaResource = class extends APIResource {
|
|
|
3796
4252
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-enroll-verify
|
|
3797
4253
|
* @example
|
|
3798
4254
|
* ```ts
|
|
3799
|
-
* const consumerMfaEnrollVerify = await auth.consumer("app").mfa.verifyEnrollment({
|
|
4255
|
+
* const consumerMfaEnrollVerify = await auth.consumer("my-app").mfa.verifyEnrollment({
|
|
4256
|
+
* factor_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
4257
|
+
* mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f",
|
|
4258
|
+
* });
|
|
3800
4259
|
* ```
|
|
3801
4260
|
*/
|
|
3802
4261
|
verifyEnrollment(params, options) {
|
|
@@ -3809,6 +4268,10 @@ var ConsumerOauthResource = class extends APIResource {
|
|
|
3809
4268
|
*
|
|
3810
4269
|
* OAuth 2.0 token introspection. Send the access token via `Authorization: Bearer <token>` and receive either `{ active: false }` (invalid / expired / wrong app, or a session that is revoked, past its `expires_at`, or gone because the end user was deleted) or the active claim set including `scopes` (M2M) or `role` (EndUser), `exp`, `iat`, `iss`, `aid`. The body `token` field is optional and, if present, must match the bearer — RFC 7662 allows a separate `token` body field but we deliberately refuse cross-token introspection so a stolen token can't be probed against another active credential. The endpoint accepts both M2M and EndUser tokens — use it as the canonical way for a service to know what its own token can do, instead of decoding the JWT by hand. Returns 401 when the bearer is missing.
|
|
3811
4270
|
*
|
|
4271
|
+
* Credential: one of `m2m_token`, `end_user_token`.
|
|
4272
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4273
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4274
|
+
*
|
|
3812
4275
|
* @param params - `Auth.OauthIntrospectParams`.
|
|
3813
4276
|
* @param options - Per-request options.
|
|
3814
4277
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Request validation failed in the global `ValidationPipe`.
|
|
@@ -3821,7 +4284,7 @@ var ConsumerOauthResource = class extends APIResource {
|
|
|
3821
4284
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-oauth-introspect
|
|
3822
4285
|
* @example
|
|
3823
4286
|
* ```ts
|
|
3824
|
-
* const introspect = await auth.consumer("app").oauth.introspect({ token: "
|
|
4287
|
+
* const introspect = await auth.consumer("my-app").oauth.introspect({ token: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJzdWIiOiJ1c3JfMSJ9.c2lnbmF0dXJl" });
|
|
3825
4288
|
* ```
|
|
3826
4289
|
*/
|
|
3827
4290
|
introspect(params, options) {
|
|
@@ -3844,9 +4307,9 @@ var ConsumerOauthResource = class extends APIResource {
|
|
|
3844
4307
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-oauth-token
|
|
3845
4308
|
* @example
|
|
3846
4309
|
* ```ts
|
|
3847
|
-
* const oAuthToken = await auth.consumer("app").oauth.token({
|
|
4310
|
+
* const oAuthToken = await auth.consumer("my-app").oauth.token({
|
|
3848
4311
|
* client_id: "m2m_a1b2c3d4e5f6...",
|
|
3849
|
-
* client_secret: "
|
|
4312
|
+
* client_secret: "the-secret-returned-by-credentials-create",
|
|
3850
4313
|
* grant_type: "client_credentials",
|
|
3851
4314
|
* });
|
|
3852
4315
|
* ```
|
|
@@ -3881,7 +4344,7 @@ var ConsumerPasskeyResource = class extends APIResource {
|
|
|
3881
4344
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-passkey-options
|
|
3882
4345
|
* @example
|
|
3883
4346
|
* ```ts
|
|
3884
|
-
* const consumerWebauthnOptions = await auth.consumer("app").passkey.options({ tenant_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b" });
|
|
4347
|
+
* const consumerWebauthnOptions = await auth.consumer("my-app").passkey.options({ tenant_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b" });
|
|
3885
4348
|
* ```
|
|
3886
4349
|
*/
|
|
3887
4350
|
options(params, options) {
|
|
@@ -3904,7 +4367,7 @@ var ConsumerPasskeyResource = class extends APIResource {
|
|
|
3904
4367
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-passkey-verify
|
|
3905
4368
|
* @example
|
|
3906
4369
|
* ```ts
|
|
3907
|
-
* const consumerToken = await auth.consumer("app").passkey.verify({ credential: {} });
|
|
4370
|
+
* const consumerToken = await auth.consumer("my-app").passkey.verify({ credential: {} });
|
|
3908
4371
|
* ```
|
|
3909
4372
|
*/
|
|
3910
4373
|
verify(params, options) {
|
|
@@ -3917,6 +4380,11 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3917
4380
|
*
|
|
3918
4381
|
* Inserts a `<resource>.<action>` row in the per-app permission catalogue. The resource and action segments must each match `^[a-z][a-z0-9_-]{1,47}$`. Conflicts with a system permission name return 409. Customers usually then bind the new permission to a role via `PUT /admin/roles/:roleName/permissions`.
|
|
3919
4382
|
*
|
|
4383
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4384
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
4385
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4386
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4387
|
+
*
|
|
3920
4388
|
* @param params - `Auth.ConsumerScopedPermissionCreateParams`.
|
|
3921
4389
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
3922
4390
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3926,7 +4394,7 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3926
4394
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-admin-permissions
|
|
3927
4395
|
* @example
|
|
3928
4396
|
* ```ts
|
|
3929
|
-
* const consumerAdminPermission = await auth.consumer("app").permissions.create({ action: "read", resource: "project" });
|
|
4397
|
+
* const consumerAdminPermission = await auth.consumer("my-app").permissions.create({ action: "read", resource: "project" });
|
|
3930
4398
|
* ```
|
|
3931
4399
|
*/
|
|
3932
4400
|
create(params, options) {
|
|
@@ -3937,6 +4405,11 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3937
4405
|
*
|
|
3938
4406
|
* The `permissionKey` path parameter is the literal `<resource>.<action>` string. System permissions cannot be deleted — attempts return 403. Removing a permission also removes every `role_permission` row that bound it (cascade); role lookups dropped of that perm on the next request.
|
|
3939
4407
|
*
|
|
4408
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4409
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
4410
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4411
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4412
|
+
*
|
|
3940
4413
|
* @param permissionKey - Permission key, `resource.action` (e.g. `invoice.read`).
|
|
3941
4414
|
* @param options - Per-request options.
|
|
3942
4415
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: permissionKey must be in `resource.action` format.
|
|
@@ -3948,7 +4421,7 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3948
4421
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-admin-permissions-permission-key
|
|
3949
4422
|
* @example
|
|
3950
4423
|
* ```ts
|
|
3951
|
-
* await auth.consumer("app").permissions.delete("
|
|
4424
|
+
* await auth.consumer("my-app").permissions.delete("invoice.read");
|
|
3952
4425
|
* ```
|
|
3953
4426
|
*/
|
|
3954
4427
|
delete(permissionKey, options) {
|
|
@@ -3959,6 +4432,11 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3959
4432
|
*
|
|
3960
4433
|
* Returns the union of system permissions (shared across every app — `is_system: true` in the response) and any custom entries this app has defined (`is_system: false`). Useful for driving a role-editor UI that picks from the full catalogue.
|
|
3961
4434
|
*
|
|
4435
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4436
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
4437
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4438
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4439
|
+
*
|
|
3962
4440
|
* @param options - Per-request options.
|
|
3963
4441
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired Consumer-API bearer: an EndUser or M2M token, or an app API key (`hdk_live_*` / `hdk_test_*`); or the account, session, M2M client or key is no longer active, or the key belongs to another app.
|
|
3964
4442
|
* @throws {PermissionDeniedError} 403 FORBIDDEN, APP_SUSPENDED, APP_ARCHIVED: The app is suspended or archived (`APP_SUSPENDED` / `APP_ARCHIVED`), or the caller lacks `permission.read`: an app API key always needs it in its permissions; a role or M2M scopes need it once the app enforces permissions.
|
|
@@ -3968,7 +4446,7 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3968
4446
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-admin-permissions
|
|
3969
4447
|
* @example
|
|
3970
4448
|
* ```ts
|
|
3971
|
-
* const result = await auth.consumer("app").permissions.list();
|
|
4449
|
+
* const result = await auth.consumer("my-app").permissions.list();
|
|
3972
4450
|
* ```
|
|
3973
4451
|
*/
|
|
3974
4452
|
list(options) {
|
|
@@ -3981,6 +4459,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
3981
4459
|
*
|
|
3982
4460
|
* Creates a role with no permissions bound yet. Use `PUT /:roleName/permissions` to attach a permission set after creation — that route also runs caller-narrowing so an EndUser admin can't grant verbs they don't themselves hold.
|
|
3983
4461
|
*
|
|
4462
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4463
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
4464
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4465
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4466
|
+
*
|
|
3984
4467
|
* @param params - `Auth.ConsumerScopedRoleCreateParams`.
|
|
3985
4468
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
3986
4469
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3990,7 +4473,7 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
3990
4473
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-admin-roles
|
|
3991
4474
|
* @example
|
|
3992
4475
|
* ```ts
|
|
3993
|
-
* const consumerRole = await auth.consumer("app").roles.create({ name: "editor" });
|
|
4476
|
+
* const consumerRole = await auth.consumer("my-app").roles.create({ name: "editor" });
|
|
3994
4477
|
* ```
|
|
3995
4478
|
*/
|
|
3996
4479
|
create(params, options) {
|
|
@@ -4001,6 +4484,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4001
4484
|
*
|
|
4002
4485
|
* System roles (`owner`, `admin`, `member`) cannot be deleted — attempts return 403. Roles currently assigned to any member return 409 `ROLE_IN_USE`; reassign the affected members first.
|
|
4003
4486
|
*
|
|
4487
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4488
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
4489
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4490
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4491
|
+
*
|
|
4004
4492
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
4005
4493
|
* @param options - Per-request options.
|
|
4006
4494
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -4011,7 +4499,7 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4011
4499
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-admin-roles-role-name
|
|
4012
4500
|
* @example
|
|
4013
4501
|
* ```ts
|
|
4014
|
-
* await auth.consumer("app").roles.delete("
|
|
4502
|
+
* await auth.consumer("my-app").roles.delete("admin");
|
|
4015
4503
|
* ```
|
|
4016
4504
|
*/
|
|
4017
4505
|
delete(roleName, options) {
|
|
@@ -4022,6 +4510,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4022
4510
|
*
|
|
4023
4511
|
* Cursor-paginated by `created_at`. Use the returned `next_cursor` in subsequent calls — offset pagination is not exposed.
|
|
4024
4512
|
*
|
|
4513
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4514
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
4515
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4516
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4517
|
+
*
|
|
4025
4518
|
* @param params - `Auth.ConsumerScopedRoleListParams`.
|
|
4026
4519
|
* @param options - Per-request options.
|
|
4027
4520
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Malformed `cursor`.
|
|
@@ -4033,10 +4526,10 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4033
4526
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-admin-roles
|
|
4034
4527
|
* @example
|
|
4035
4528
|
* ```ts
|
|
4036
|
-
* for await (const role of auth.consumer("app").roles.list()) {
|
|
4529
|
+
* for await (const role of auth.consumer("my-app").roles.list()) {
|
|
4037
4530
|
* console.log(role);
|
|
4038
4531
|
* }
|
|
4039
|
-
* const page = await auth.consumer("app").roles.list({}, { timeout: 5_000 });
|
|
4532
|
+
* const page = await auth.consumer("my-app").roles.list({}, { timeout: 5_000 });
|
|
4040
4533
|
* ```
|
|
4041
4534
|
*/
|
|
4042
4535
|
list(params, options) {
|
|
@@ -4047,6 +4540,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4047
4540
|
*
|
|
4048
4541
|
* Returns the role plus the flat `permissions[]` array currently bound. Use this to drive a "configure role" UI in the customer product without having to call `/permissions` separately.
|
|
4049
4542
|
*
|
|
4543
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4544
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
4545
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4546
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4547
|
+
*
|
|
4050
4548
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
4051
4549
|
* @param options - Per-request options.
|
|
4052
4550
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -4056,7 +4554,7 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4056
4554
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-admin-roles-role-name
|
|
4057
4555
|
* @example
|
|
4058
4556
|
* ```ts
|
|
4059
|
-
* const consumerRoleWithPermissions = await auth.consumer("app").roles.retrieve("
|
|
4557
|
+
* const consumerRoleWithPermissions = await auth.consumer("my-app").roles.retrieve("admin");
|
|
4060
4558
|
* ```
|
|
4061
4559
|
*/
|
|
4062
4560
|
retrieve(roleName, options) {
|
|
@@ -4067,6 +4565,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4067
4565
|
*
|
|
4068
4566
|
* Renames are intentionally NOT supported — the role name is part of every issued EndUser JWT, so changing it would silently break live sessions. Create a new role and migrate users instead.
|
|
4069
4567
|
*
|
|
4568
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4569
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
4570
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4571
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4572
|
+
*
|
|
4070
4573
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
4071
4574
|
* @param params - `Auth.ConsumerScopedRoleUpdateParams`.
|
|
4072
4575
|
* @param options - Per-request options.
|
|
@@ -4077,7 +4580,7 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4077
4580
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-admin-roles-role-name
|
|
4078
4581
|
* @example
|
|
4079
4582
|
* ```ts
|
|
4080
|
-
* const consumerRole = await auth.consumer("app").roles.update("
|
|
4583
|
+
* const consumerRole = await auth.consumer("my-app").roles.update("admin", { description: "Updated description" });
|
|
4081
4584
|
* ```
|
|
4082
4585
|
*/
|
|
4083
4586
|
update(roleName, params, options) {
|
|
@@ -4088,6 +4591,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4088
4591
|
*
|
|
4089
4592
|
* Destructive — the role's permission set is replaced wholesale with the supplied array. Caller-narrowed: the caller must hold every permission in the request, otherwise 403 `Cannot grant actions you don't have: ...`. For EndUser callers the caller-held set is their app-membership role's effective permissions. For M2M callers the held set is the token's `scopes[]` claim — the M2M cannot grant a role any verb that wasn't configured on the M2M credential. Unknown permission strings return 400.
|
|
4090
4593
|
*
|
|
4594
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4595
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
4596
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4597
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4598
|
+
*
|
|
4091
4599
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
4092
4600
|
* @param params - `Auth.ConsumerScopedRoleUpdatePermissionsParams`.
|
|
4093
4601
|
* @param options - Per-request options.
|
|
@@ -4100,7 +4608,7 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4100
4608
|
* @see https://productcraft.co/docs/auth/api-reference#put-app-slug-v1-admin-roles-role-name-permissions
|
|
4101
4609
|
* @example
|
|
4102
4610
|
* ```ts
|
|
4103
|
-
* const result = await auth.consumer("app").roles.updatePermissions("
|
|
4611
|
+
* const result = await auth.consumer("my-app").roles.updatePermissions("admin", { permissions: ["user.read", "role.create"] });
|
|
4104
4612
|
* ```
|
|
4105
4613
|
*/
|
|
4106
4614
|
updatePermissions(roleName, params, options) {
|
|
@@ -4113,6 +4621,9 @@ var ConsumerTenantApiKeysConfigResource = class extends APIResource {
|
|
|
4113
4621
|
*
|
|
4114
4622
|
* Requires `auth.tenant.api_keys.configure` on the app.
|
|
4115
4623
|
*
|
|
4624
|
+
* Credential: `workspace_key`.
|
|
4625
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
4626
|
+
*
|
|
4116
4627
|
* @param options - Per-request options.
|
|
4117
4628
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, malformed or revoked Platform API Key (`Authorization: Bearer pcft_live_…`).
|
|
4118
4629
|
* @throws {PermissionDeniedError} 403 FORBIDDEN, PAK_WORKSPACE_MISMATCH: `PAK_WORKSPACE_MISMATCH` (the PAK belongs to another workspace than the app), or the PAK's policy does not allow `auth.tenant.api_keys.configure` on `pcft:heimdall:app/<appId>`.
|
|
@@ -4123,7 +4634,7 @@ var ConsumerTenantApiKeysConfigResource = class extends APIResource {
|
|
|
4123
4634
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenant-api-keys-config
|
|
4124
4635
|
* @example
|
|
4125
4636
|
* ```ts
|
|
4126
|
-
* const tenantApiKeysConfig = await auth.consumer("app").tenantApiKeys.config.retrieve();
|
|
4637
|
+
* const tenantApiKeysConfig = await auth.consumer("my-app").tenantApiKeys.config.retrieve();
|
|
4127
4638
|
* ```
|
|
4128
4639
|
*/
|
|
4129
4640
|
retrieve(options) {
|
|
@@ -4134,6 +4645,9 @@ var ConsumerTenantApiKeysConfigResource = class extends APIResource {
|
|
|
4134
4645
|
*
|
|
4135
4646
|
* Call it on boot: your code is the source of truth for the scopes a key can carry. Fields you leave out keep their stored value. `suspended` is the platform's kill switch: this route never changes it, and a body that carries it is refused. Requires `auth.tenant.api_keys.configure` on the app.
|
|
4136
4647
|
*
|
|
4648
|
+
* Credential: `workspace_key`.
|
|
4649
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
4650
|
+
*
|
|
4137
4651
|
* @param params - `Auth.ConsumerScopedTenantApiKeyConfigUpdateParams`.
|
|
4138
4652
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
4139
4653
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR, TENANT_API_KEYS_SCOPE_INVALID, TENANT_API_KEYS_UNKNOWN_ROLE, TENANT_API_KEY_EXPIRY_INVALID, TENANT_API_KEYS_NO_SCOPES, TENANT_API_KEYS_SUSPENDED_NOT_WRITABLE: `VALIDATION_ERROR`, `TENANT_API_KEYS_SCOPE_INVALID` (`details.scopes`), `TENANT_API_KEYS_UNKNOWN_ROLE` (`details.roles`: `manage_roles` names a role this app does not have), `TENANT_API_KEY_EXPIRY_INVALID`, `TENANT_API_KEYS_NO_SCOPES` (enabling with no scope), `TENANT_API_KEYS_SUSPENDED_NOT_WRITABLE` (the body carries `suspended`), or a malformed `Idempotency-Key`.
|
|
@@ -4146,7 +4660,7 @@ var ConsumerTenantApiKeysConfigResource = class extends APIResource {
|
|
|
4146
4660
|
* @see https://productcraft.co/docs/auth/api-reference#put-app-slug-v1-tenant-api-keys-config
|
|
4147
4661
|
* @example
|
|
4148
4662
|
* ```ts
|
|
4149
|
-
* const tenantApiKeysConfig = await auth.consumer("app").tenantApiKeys.config.update({ default_expiry_days: 7 });
|
|
4663
|
+
* const tenantApiKeysConfig = await auth.consumer("my-app").tenantApiKeys.config.update({ default_expiry_days: 7 });
|
|
4150
4664
|
* ```
|
|
4151
4665
|
*/
|
|
4152
4666
|
update(params, options) {
|
|
@@ -4163,6 +4677,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4163
4677
|
*
|
|
4164
4678
|
* Returns the secret ONCE (`key`). Scopes must be grantable by the app and held by your own tenant role. At most 25 active keys per tenant. If the app requires recent MFA, verify a factor first (403 `step_up_required`). Responses carry `Cache-Control: no-store`.
|
|
4165
4679
|
*
|
|
4680
|
+
* Credential: `end_user_token`.
|
|
4681
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4682
|
+
*
|
|
4166
4683
|
* @param params - `Auth.TenantApiKeyCreateParams`.
|
|
4167
4684
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
4168
4685
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR, TENANT_API_KEY_SCOPE_NOT_GRANTABLE, TENANT_API_KEY_EXPIRY_INVALID: `VALIDATION_ERROR`, `TENANT_API_KEY_SCOPE_NOT_GRANTABLE` (`details.scopes`), `TENANT_API_KEY_EXPIRY_INVALID` (`details.allowed`), or a malformed `Idempotency-Key`.
|
|
@@ -4175,7 +4692,7 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4175
4692
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenant-api-keys
|
|
4176
4693
|
* @example
|
|
4177
4694
|
* ```ts
|
|
4178
|
-
* const tenantApiKeyWithSecret = await auth.consumer("app").tenantApiKeys.create({ name: "CI e2e", scopes: ["disputes.read", "audit.read"] });
|
|
4695
|
+
* const tenantApiKeyWithSecret = await auth.consumer("my-app").tenantApiKeys.create({ name: "CI e2e", scopes: ["disputes.read", "audit.read"] });
|
|
4179
4696
|
* ```
|
|
4180
4697
|
*/
|
|
4181
4698
|
create(params, options) {
|
|
@@ -4186,6 +4703,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4186
4703
|
*
|
|
4187
4704
|
* Immediate and final. Idempotent: revoking a revoked key is a 204 that changes nothing.
|
|
4188
4705
|
*
|
|
4706
|
+
* Credential: `end_user_token`.
|
|
4707
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4708
|
+
*
|
|
4189
4709
|
* @param keyId - Key id (UUID) or display id (`tak_…`).
|
|
4190
4710
|
* @param options - Per-request options.
|
|
4191
4711
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid end-user bearer token (M2M tokens, PAKs and API keys are refused).
|
|
@@ -4196,7 +4716,7 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4196
4716
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-tenant-api-keys-key-id
|
|
4197
4717
|
* @example
|
|
4198
4718
|
* ```ts
|
|
4199
|
-
* await auth.consumer("app").tenantApiKeys.delete("
|
|
4719
|
+
* await auth.consumer("my-app").tenantApiKeys.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4200
4720
|
* ```
|
|
4201
4721
|
*/
|
|
4202
4722
|
delete(keyId, options) {
|
|
@@ -4207,6 +4727,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4207
4727
|
*
|
|
4208
4728
|
* For your backend: is this `pctk_` key, presented to YOUR API, usable right now, for which tenant and with which scopes? A key of another app is `{"active": false}`. Cache answers by the key's SHA-256: positives up to 30 s (never past `expires_at`), negatives up to 60 s. Intersect `scopes` with the permissions of `created_by.tenant_role` in your app. Requires `auth.tenant.api_keys.introspect` on the app. Not audited per call; `last_used_at` records use (5-minute granularity). This route has its own per-app rate bucket (1200 calls a minute by default), separate from your PAK's other calls; over it the answer is 429 with `Retry-After`, never a false `active: false`, so keep serving keys you hold a fresh positive for.
|
|
4209
4729
|
*
|
|
4730
|
+
* Credential: `workspace_key`.
|
|
4731
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
4732
|
+
*
|
|
4210
4733
|
* @param params - `Auth.TenantApiKeyIntrospectParams`.
|
|
4211
4734
|
* @param options - Per-request options.
|
|
4212
4735
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `key` missing or not a string.
|
|
@@ -4219,7 +4742,7 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4219
4742
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenant-api-keys-introspect
|
|
4220
4743
|
* @example
|
|
4221
4744
|
* ```ts
|
|
4222
|
-
* const tenantApiKeyIntrospection = await auth.consumer("app").tenantApiKeys.introspect({ key: "pctk_live_4fQ2aZ0000000000000000000000000000000000000_1a2B3c" });
|
|
4745
|
+
* const tenantApiKeyIntrospection = await auth.consumer("my-app").tenantApiKeys.introspect({ key: "pctk_live_4fQ2aZ0000000000000000000000000000000000000_1a2B3c" });
|
|
4223
4746
|
* ```
|
|
4224
4747
|
*/
|
|
4225
4748
|
introspect(params, options) {
|
|
@@ -4230,6 +4753,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4230
4753
|
*
|
|
4231
4754
|
* Newest first, cursor-paginated (20 per page, max 100). Secrets are never returned; `key_prefix` and `last4` identify a key.
|
|
4232
4755
|
*
|
|
4756
|
+
* Credential: `end_user_token`.
|
|
4757
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4758
|
+
*
|
|
4233
4759
|
* @param params - `Auth.ConsumerScopedTenantApiKeyListParams`.
|
|
4234
4760
|
* @param options - Per-request options.
|
|
4235
4761
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `status` or malformed `cursor`.
|
|
@@ -4241,10 +4767,10 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4241
4767
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenant-api-keys
|
|
4242
4768
|
* @example
|
|
4243
4769
|
* ```ts
|
|
4244
|
-
* for await (const tenantApiKey of auth.consumer("app").tenantApiKeys.list()) {
|
|
4770
|
+
* for await (const tenantApiKey of auth.consumer("my-app").tenantApiKeys.list()) {
|
|
4245
4771
|
* console.log(tenantApiKey);
|
|
4246
4772
|
* }
|
|
4247
|
-
* const page = await auth.consumer("app").tenantApiKeys.list({}, { timeout: 5_000 });
|
|
4773
|
+
* const page = await auth.consumer("my-app").tenantApiKeys.list({}, { timeout: 5_000 });
|
|
4248
4774
|
* ```
|
|
4249
4775
|
*/
|
|
4250
4776
|
list(params, options) {
|
|
@@ -4255,6 +4781,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4255
4781
|
*
|
|
4256
4782
|
* Mints a replacement with the same name and scopes and returns its secret ONCE. You become the replacement's creator, so its scopes must be within your own tenant role. The outgoing key is revoked now (`grace_hours: 0`, the default) or keeps working for up to 24 hours. To kill a leaked key, revoke it. Responses carry `Cache-Control: no-store`.
|
|
4257
4783
|
*
|
|
4784
|
+
* Credential: `end_user_token`.
|
|
4785
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4786
|
+
*
|
|
4258
4787
|
* @param keyId - Key id (UUID) or display id (`tak_…`).
|
|
4259
4788
|
* @param params - `Auth.TenantApiKeyRotateParams`.
|
|
4260
4789
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -4268,7 +4797,7 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4268
4797
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenant-api-keys-key-id-rotate
|
|
4269
4798
|
* @example
|
|
4270
4799
|
* ```ts
|
|
4271
|
-
* const tenantApiKeyWithSecret = await auth.consumer("app").tenantApiKeys.rotate("
|
|
4800
|
+
* const tenantApiKeyWithSecret = await auth.consumer("my-app").tenantApiKeys.rotate("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { expires_in_days: 7 });
|
|
4272
4801
|
* ```
|
|
4273
4802
|
*/
|
|
4274
4803
|
rotate(keyId, params, options) {
|
|
@@ -4279,6 +4808,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4279
4808
|
*
|
|
4280
4809
|
* For your own audit trail: record why a key you saw go inactive died (revoked in the console, creator left the tenant, expired, keys suspended). Only keys of this app; another app's key is 404. Requires `auth.tenant.api_keys.introspect` on the app.
|
|
4281
4810
|
*
|
|
4811
|
+
* Credential: `workspace_key`.
|
|
4812
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
4813
|
+
*
|
|
4282
4814
|
* @param keyId - Key id (UUID) or display id (`tak_…`), as `introspect` returned it.
|
|
4283
4815
|
* @param options - Per-request options.
|
|
4284
4816
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, malformed or revoked Platform API Key (`Authorization: Bearer pcft_live_…`).
|
|
@@ -4290,7 +4822,7 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4290
4822
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenant-api-keys-key-id-status
|
|
4291
4823
|
* @example
|
|
4292
4824
|
* ```ts
|
|
4293
|
-
* const tenantApiKeyStatus = await auth.consumer("app").tenantApiKeys.status("
|
|
4825
|
+
* const tenantApiKeyStatus = await auth.consumer("my-app").tenantApiKeys.status("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4294
4826
|
* ```
|
|
4295
4827
|
*/
|
|
4296
4828
|
status(keyId, options) {
|
|
@@ -4303,6 +4835,9 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4303
4835
|
*
|
|
4304
4836
|
* Unlike `POST /members`, nothing is granted until the invitee accepts at `POST /:appSlug/v1/auth/accept-tenant-invite`. Only a SHA-256 digest of the code is stored, so the `code` in this response is unrecoverable afterwards.
|
|
4305
4837
|
*
|
|
4838
|
+
* Credential: `workspace_key`.
|
|
4839
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
4840
|
+
*
|
|
4306
4841
|
* @param tenantId - Id of the tenant.
|
|
4307
4842
|
* @param params - `Auth.ConsumerScopedTenantInviteCreateParams`.
|
|
4308
4843
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -4316,7 +4851,7 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4316
4851
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenants-tenant-id-invites
|
|
4317
4852
|
* @example
|
|
4318
4853
|
* ```ts
|
|
4319
|
-
* const createTenantInvite = await auth.consumer("app").tenants.invites.create("
|
|
4854
|
+
* const createTenantInvite = await auth.consumer("my-app").tenants.invites.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { email: "alice@example.com", role_name: "member" });
|
|
4320
4855
|
* ```
|
|
4321
4856
|
*/
|
|
4322
4857
|
create(tenantId, params, options) {
|
|
@@ -4325,6 +4860,9 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4325
4860
|
/**
|
|
4326
4861
|
* Revoke a pending invite. Idempotent — revoking an already-revoked invite is a 204 no-op and fires no second webhook. PAK must hold auth.tenant.members.remove.
|
|
4327
4862
|
*
|
|
4863
|
+
* Credential: `workspace_key`.
|
|
4864
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
4865
|
+
*
|
|
4328
4866
|
* @param tenantId - Id of the tenant.
|
|
4329
4867
|
* @param inviteId - Id of the invite.
|
|
4330
4868
|
* @param options - Per-request options.
|
|
@@ -4335,7 +4873,7 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4335
4873
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-tenants-tenant-id-invites-invite-id
|
|
4336
4874
|
* @example
|
|
4337
4875
|
* ```ts
|
|
4338
|
-
* await auth.consumer("app").tenants.invites.delete("
|
|
4876
|
+
* await auth.consumer("my-app").tenants.invites.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4339
4877
|
* ```
|
|
4340
4878
|
*/
|
|
4341
4879
|
delete(tenantId, inviteId, options) {
|
|
@@ -4346,6 +4884,9 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4346
4884
|
*
|
|
4347
4885
|
* Codes are never returned here — only the digest is stored. Use `status=pending` to show outstanding invitations.
|
|
4348
4886
|
*
|
|
4887
|
+
* Credential: `workspace_key`.
|
|
4888
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
4889
|
+
*
|
|
4349
4890
|
* @param tenantId - Id of the tenant.
|
|
4350
4891
|
* @param params - `Auth.ConsumerScopedTenantInviteListParams`.
|
|
4351
4892
|
* @param options - Per-request options.
|
|
@@ -4357,10 +4898,10 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4357
4898
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenants-tenant-id-invites
|
|
4358
4899
|
* @example
|
|
4359
4900
|
* ```ts
|
|
4360
|
-
* for await (const invite of auth.consumer("app").tenants.invites.list("
|
|
4901
|
+
* for await (const invite of auth.consumer("my-app").tenants.invites.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
|
|
4361
4902
|
* console.log(invite);
|
|
4362
4903
|
* }
|
|
4363
|
-
* const page = await auth.consumer("app").tenants.invites.list("
|
|
4904
|
+
* const page = await auth.consumer("my-app").tenants.invites.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
|
|
4364
4905
|
* ```
|
|
4365
4906
|
*/
|
|
4366
4907
|
list(tenantId, params, options) {
|
|
@@ -4371,6 +4912,9 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4371
4912
|
/**
|
|
4372
4913
|
* Add a member to a tenant. Pass `accountId` for an existing user, or `email` (+ optional `display_name`/`username`) to auto-create the account inline. PAK must hold auth.tenant.members.add.
|
|
4373
4914
|
*
|
|
4915
|
+
* Credential: `workspace_key`.
|
|
4916
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
4917
|
+
*
|
|
4374
4918
|
* @param tenantId - Id of the tenant.
|
|
4375
4919
|
* @param params - `Auth.ConsumerScopedTenantMemberCreateParams`.
|
|
4376
4920
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -4383,7 +4927,7 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4383
4927
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenants-tenant-id-members
|
|
4384
4928
|
* @example
|
|
4385
4929
|
* ```ts
|
|
4386
|
-
* const consumerAddMember = await auth.consumer("app").tenants.members.create("
|
|
4930
|
+
* const consumerAddMember = await auth.consumer("my-app").tenants.members.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "member" });
|
|
4387
4931
|
* ```
|
|
4388
4932
|
*/
|
|
4389
4933
|
create(tenantId, params, options) {
|
|
@@ -4392,6 +4936,9 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4392
4936
|
/**
|
|
4393
4937
|
* Remove a member from a tenant. The underlying account row stays in the app — only the tenant_membership row is deleted. PAK must hold auth.tenant.members.remove.
|
|
4394
4938
|
*
|
|
4939
|
+
* Credential: `workspace_key`.
|
|
4940
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
4941
|
+
*
|
|
4395
4942
|
* @param tenantId - Id of the tenant.
|
|
4396
4943
|
* @param accountId - Id of the account.
|
|
4397
4944
|
* @param options - Per-request options.
|
|
@@ -4402,7 +4949,7 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4402
4949
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-tenants-tenant-id-members-account-id
|
|
4403
4950
|
* @example
|
|
4404
4951
|
* ```ts
|
|
4405
|
-
* await auth.consumer("app").tenants.members.delete("
|
|
4952
|
+
* await auth.consumer("my-app").tenants.members.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4406
4953
|
* ```
|
|
4407
4954
|
*/
|
|
4408
4955
|
delete(tenantId, accountId, options) {
|
|
@@ -4411,6 +4958,9 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4411
4958
|
/**
|
|
4412
4959
|
* List members of a tenant. Cursor-paginated by joined_at desc. Filter by `?search=` and/or `?role=`. PAK must hold auth.tenant.read.
|
|
4413
4960
|
*
|
|
4961
|
+
* Credential: `workspace_key`.
|
|
4962
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
4963
|
+
*
|
|
4414
4964
|
* @param tenantId - Id of the tenant.
|
|
4415
4965
|
* @param params - `Auth.ConsumerScopedTenantMemberListParams`.
|
|
4416
4966
|
* @param options - Per-request options.
|
|
@@ -4424,10 +4974,10 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4424
4974
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenants-tenant-id-members
|
|
4425
4975
|
* @example
|
|
4426
4976
|
* ```ts
|
|
4427
|
-
* for await (const member of auth.consumer("app").tenants.members.list("
|
|
4977
|
+
* for await (const member of auth.consumer("my-app").tenants.members.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
|
|
4428
4978
|
* console.log(member);
|
|
4429
4979
|
* }
|
|
4430
|
-
* const page = await auth.consumer("app").tenants.members.list("
|
|
4980
|
+
* const page = await auth.consumer("my-app").tenants.members.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
|
|
4431
4981
|
* ```
|
|
4432
4982
|
*/
|
|
4433
4983
|
list(tenantId, params, options) {
|
|
@@ -4436,6 +4986,9 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4436
4986
|
/**
|
|
4437
4987
|
* Change a member's role. PAK must hold auth.tenant.members.update-role.
|
|
4438
4988
|
*
|
|
4989
|
+
* Credential: `workspace_key`.
|
|
4990
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
4991
|
+
*
|
|
4439
4992
|
* @param tenantId - Id of the tenant.
|
|
4440
4993
|
* @param accountId - Id of the account.
|
|
4441
4994
|
* @param params - `Auth.ConsumerScopedTenantMemberUpdateParams`.
|
|
@@ -4448,7 +5001,7 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4448
5001
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-tenants-tenant-id-members-account-id
|
|
4449
5002
|
* @example
|
|
4450
5003
|
* ```ts
|
|
4451
|
-
* const consumerTenantMembership = await auth.consumer("app").tenants.members.update("
|
|
5004
|
+
* const consumerTenantMembership = await auth.consumer("my-app").tenants.members.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "admin" });
|
|
4452
5005
|
* ```
|
|
4453
5006
|
*/
|
|
4454
5007
|
update(tenantId, accountId, params, options) {
|
|
@@ -4467,6 +5020,9 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4467
5020
|
/**
|
|
4468
5021
|
* Create a tenant inside this app. Returns the new tenant with a `display_id` (`tnt_<12hex>`). PAK must hold auth.tenant.create.
|
|
4469
5022
|
*
|
|
5023
|
+
* Credential: `workspace_key`.
|
|
5024
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5025
|
+
*
|
|
4470
5026
|
* @param params - `Auth.ConsumerScopedTenantCreateParams`.
|
|
4471
5027
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
4472
5028
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid display_name or slug.
|
|
@@ -4479,7 +5035,7 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4479
5035
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenants
|
|
4480
5036
|
* @example
|
|
4481
5037
|
* ```ts
|
|
4482
|
-
* const consumerTenant = await auth.consumer("app").tenants.create({ display_name: "Acme Co" });
|
|
5038
|
+
* const consumerTenant = await auth.consumer("my-app").tenants.create({ display_name: "Acme Co" });
|
|
4483
5039
|
* ```
|
|
4484
5040
|
*/
|
|
4485
5041
|
create(params, options) {
|
|
@@ -4488,6 +5044,9 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4488
5044
|
/**
|
|
4489
5045
|
* Delete a tenant. Cascades to tenant_membership rows; account rows are unaffected. PAK must hold auth.tenant.delete.
|
|
4490
5046
|
*
|
|
5047
|
+
* Credential: `workspace_key`.
|
|
5048
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5049
|
+
*
|
|
4491
5050
|
* @param tenantId - Id of the tenant.
|
|
4492
5051
|
* @param options - Per-request options.
|
|
4493
5052
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -4497,7 +5056,7 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4497
5056
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-tenants-tenant-id
|
|
4498
5057
|
* @example
|
|
4499
5058
|
* ```ts
|
|
4500
|
-
* await auth.consumer("app").tenants.delete("
|
|
5059
|
+
* await auth.consumer("my-app").tenants.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4501
5060
|
* ```
|
|
4502
5061
|
*/
|
|
4503
5062
|
delete(tenantId, options) {
|
|
@@ -4506,6 +5065,9 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4506
5065
|
/**
|
|
4507
5066
|
* List tenants in this app, paginated by created_at desc. PAK must hold auth.tenant.read.
|
|
4508
5067
|
*
|
|
5068
|
+
* Credential: `workspace_key`.
|
|
5069
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5070
|
+
*
|
|
4509
5071
|
* @param params - `Auth.ConsumerScopedTenantListParams`.
|
|
4510
5072
|
* @param options - Per-request options.
|
|
4511
5073
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid `status` filter or malformed `cursor`.
|
|
@@ -4518,10 +5080,10 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4518
5080
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenants
|
|
4519
5081
|
* @example
|
|
4520
5082
|
* ```ts
|
|
4521
|
-
* for await (const tenant of auth.consumer("app").tenants.list()) {
|
|
5083
|
+
* for await (const tenant of auth.consumer("my-app").tenants.list()) {
|
|
4522
5084
|
* console.log(tenant);
|
|
4523
5085
|
* }
|
|
4524
|
-
* const page = await auth.consumer("app").tenants.list({}, { timeout: 5_000 });
|
|
5086
|
+
* const page = await auth.consumer("my-app").tenants.list({}, { timeout: 5_000 });
|
|
4525
5087
|
* ```
|
|
4526
5088
|
*/
|
|
4527
5089
|
list(params, options) {
|
|
@@ -4530,6 +5092,9 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4530
5092
|
/**
|
|
4531
5093
|
* Fetch a single tenant by its UUID or `tnt_<12hex>` display id. PAK must hold auth.tenant.read.
|
|
4532
5094
|
*
|
|
5095
|
+
* Credential: `workspace_key`.
|
|
5096
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5097
|
+
*
|
|
4533
5098
|
* @param tenantId - Id of the tenant.
|
|
4534
5099
|
* @param options - Per-request options.
|
|
4535
5100
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -4539,7 +5104,7 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4539
5104
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenants-tenant-id
|
|
4540
5105
|
* @example
|
|
4541
5106
|
* ```ts
|
|
4542
|
-
* const consumerTenant = await auth.consumer("app").tenants.retrieve("
|
|
5107
|
+
* const consumerTenant = await auth.consumer("my-app").tenants.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4543
5108
|
* ```
|
|
4544
5109
|
*/
|
|
4545
5110
|
retrieve(tenantId, options) {
|
|
@@ -4548,6 +5113,9 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4548
5113
|
/**
|
|
4549
5114
|
* Patch a tenant. Any subset of {display_name, slug, status, metadata}. PAK must hold auth.tenant.update.
|
|
4550
5115
|
*
|
|
5116
|
+
* Credential: `workspace_key`.
|
|
5117
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5118
|
+
*
|
|
4551
5119
|
* @param tenantId - Id of the tenant.
|
|
4552
5120
|
* @param params - `Auth.ConsumerScopedTenantUpdateParams`.
|
|
4553
5121
|
* @param options - Per-request options.
|
|
@@ -4560,7 +5128,7 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4560
5128
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-tenants-tenant-id
|
|
4561
5129
|
* @example
|
|
4562
5130
|
* ```ts
|
|
4563
|
-
* const consumerTenant = await auth.consumer("app").tenants.update("
|
|
5131
|
+
* const consumerTenant = await auth.consumer("my-app").tenants.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { display_name: "Acme Inc" });
|
|
4564
5132
|
* ```
|
|
4565
5133
|
*/
|
|
4566
5134
|
update(tenantId, params, options) {
|
|
@@ -4573,6 +5141,9 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4573
5141
|
*
|
|
4574
5142
|
* Creates the factor in the enabled state. TOTP: returns the cleartext secret + otpauth URI + recovery codes in the response — intended for synthetic-account-style flows where the caller bundles credentials and ships them out once. Email: binds the user's verified email contact (primary by default, `contact_id` to override; 412 when unverified) and returns the masked address + recovery codes — sign-in codes are then delivered on demand via `/auth/mfa/send-code`.
|
|
4575
5143
|
*
|
|
5144
|
+
* Credential: `workspace_key`.
|
|
5145
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5146
|
+
*
|
|
4576
5147
|
* @param userId - Id of the user.
|
|
4577
5148
|
* @param params - `Auth.UserFactorCreateParams`.
|
|
4578
5149
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -4587,7 +5158,7 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4587
5158
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-users-user-id-factors
|
|
4588
5159
|
* @example
|
|
4589
5160
|
* ```ts
|
|
4590
|
-
* const adminProvisionFactor = await auth.consumer("app").users.factors.create("
|
|
5161
|
+
* const adminProvisionFactor = await auth.consumer("my-app").users.factors.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { type: "totp" });
|
|
4591
5162
|
* ```
|
|
4592
5163
|
*/
|
|
4593
5164
|
create(userId, params, options) {
|
|
@@ -4596,6 +5167,9 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4596
5167
|
/**
|
|
4597
5168
|
* Disable a user's MFA factor
|
|
4598
5169
|
*
|
|
5170
|
+
* Credential: `workspace_key`.
|
|
5171
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5172
|
+
*
|
|
4599
5173
|
* @param userId - Id of the user.
|
|
4600
5174
|
* @param factorId - Id of the factor.
|
|
4601
5175
|
* @param options - Per-request options.
|
|
@@ -4608,7 +5182,7 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4608
5182
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-users-user-id-factors-factor-id
|
|
4609
5183
|
* @example
|
|
4610
5184
|
* ```ts
|
|
4611
|
-
* await auth.consumer("app").users.factors.delete("
|
|
5185
|
+
* await auth.consumer("my-app").users.factors.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4612
5186
|
* ```
|
|
4613
5187
|
*/
|
|
4614
5188
|
delete(userId, factorId, options) {
|
|
@@ -4617,6 +5191,9 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4617
5191
|
/**
|
|
4618
5192
|
* List a user's MFA factors
|
|
4619
5193
|
*
|
|
5194
|
+
* Credential: `workspace_key`.
|
|
5195
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5196
|
+
*
|
|
4620
5197
|
* @param userId - Id of the user.
|
|
4621
5198
|
* @param options - Per-request options.
|
|
4622
5199
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing bearer token, or the Platform API Key is malformed, unknown or revoked.
|
|
@@ -4628,7 +5205,7 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4628
5205
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-users-user-id-factors
|
|
4629
5206
|
* @example
|
|
4630
5207
|
* ```ts
|
|
4631
|
-
* const factorList = await auth.consumer("app").users.factors.list("
|
|
5208
|
+
* const factorList = await auth.consumer("my-app").users.factors.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4632
5209
|
* ```
|
|
4633
5210
|
*/
|
|
4634
5211
|
list(userId, options) {
|
|
@@ -4647,6 +5224,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4647
5224
|
*
|
|
4648
5225
|
* What is NOT distinct: the password policy. A supplied `password` goes through the same app-configured rules, the same common-password deny-list and the same breach check as `/auth/signup`.
|
|
4649
5226
|
*
|
|
5227
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5228
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
5229
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5230
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5231
|
+
*
|
|
4650
5232
|
* @param params - `Auth.UserCreateParams`.
|
|
4651
5233
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
4652
5234
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR, PASSWORD_TOO_COMMON, PASSWORD_BREACHED: Invalid email, unknown role, or a password that fails the app policy — `PASSWORD_TOO_COMMON` / `PASSWORD_BREACHED`.
|
|
@@ -4658,7 +5240,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4658
5240
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-admin-users
|
|
4659
5241
|
* @example
|
|
4660
5242
|
* ```ts
|
|
4661
|
-
* const consumerAdminCreatedUser = await auth.consumer("app").users.create({ email: "
|
|
5243
|
+
* const consumerAdminCreatedUser = await auth.consumer("my-app").users.create({ email: "ada@example.com" });
|
|
4662
5244
|
* ```
|
|
4663
5245
|
*/
|
|
4664
5246
|
create(params, options) {
|
|
@@ -4669,6 +5251,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4669
5251
|
*
|
|
4670
5252
|
* Removes the account, its sessions, contacts, and tenant memberships. Audit rows are preserved, and the deletion itself is audited as `auth.account.deleted` with `via: consumer_admin` and the caller as actor. Fires `user.deleted` with `via: "consumer_admin"`.
|
|
4671
5253
|
*
|
|
5254
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5255
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
5256
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5257
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5258
|
+
*
|
|
4672
5259
|
* @param userId - Id of the user.
|
|
4673
5260
|
* @param options - Per-request options.
|
|
4674
5261
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired Consumer-API bearer: an EndUser or M2M token, or an app API key (`hdk_live_*` / `hdk_test_*`); or the account, session, M2M client or key is no longer active, or the key belongs to another app.
|
|
@@ -4679,7 +5266,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4679
5266
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-admin-users-user-id
|
|
4680
5267
|
* @example
|
|
4681
5268
|
* ```ts
|
|
4682
|
-
* await auth.consumer("app").users.delete("
|
|
5269
|
+
* await auth.consumer("my-app").users.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4683
5270
|
* ```
|
|
4684
5271
|
*/
|
|
4685
5272
|
delete(userId, options) {
|
|
@@ -4690,6 +5277,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4690
5277
|
*
|
|
4691
5278
|
* Cursor-paginated. Supports the same `status` and `search` filters as the auth-admin equivalent. Use the cursor in subsequent calls — Auth does not expose offset pagination.
|
|
4692
5279
|
*
|
|
5280
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5281
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
5282
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5283
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5284
|
+
*
|
|
4693
5285
|
* @param params - `Auth.UserListParams`.
|
|
4694
5286
|
* @param options - Per-request options.
|
|
4695
5287
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Malformed `cursor`, or a cursor issued for a different sort order.
|
|
@@ -4701,10 +5293,10 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4701
5293
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-admin-users
|
|
4702
5294
|
* @example
|
|
4703
5295
|
* ```ts
|
|
4704
|
-
* for await (const user of auth.consumer("app").users.list()) {
|
|
5296
|
+
* for await (const user of auth.consumer("my-app").users.list()) {
|
|
4705
5297
|
* console.log(user);
|
|
4706
5298
|
* }
|
|
4707
|
-
* const page = await auth.consumer("app").users.list({}, { timeout: 5_000 });
|
|
5299
|
+
* const page = await auth.consumer("my-app").users.list({}, { timeout: 5_000 });
|
|
4708
5300
|
* ```
|
|
4709
5301
|
*/
|
|
4710
5302
|
list(params, options) {
|
|
@@ -4713,6 +5305,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4713
5305
|
/**
|
|
4714
5306
|
* Read one end-user
|
|
4715
5307
|
*
|
|
5308
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5309
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
5310
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5311
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5312
|
+
*
|
|
4716
5313
|
* @param userId - Id of the user.
|
|
4717
5314
|
* @param options - Per-request options.
|
|
4718
5315
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -4722,7 +5319,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4722
5319
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-admin-users-user-id
|
|
4723
5320
|
* @example
|
|
4724
5321
|
* ```ts
|
|
4725
|
-
* const consumerAdminEndUser = await auth.consumer("app").users.retrieve("
|
|
5322
|
+
* const consumerAdminEndUser = await auth.consumer("my-app").users.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4726
5323
|
* ```
|
|
4727
5324
|
*/
|
|
4728
5325
|
retrieve(userId, options) {
|
|
@@ -4733,6 +5330,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4733
5330
|
*
|
|
4734
5331
|
* Email update promotes an existing contact to primary (not for creating new contacts — that goes through the per-contact flow).
|
|
4735
5332
|
*
|
|
5333
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5334
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
5335
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5336
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5337
|
+
*
|
|
4736
5338
|
* @param userId - Id of the user.
|
|
4737
5339
|
* @param params - `Auth.UserUpdateParams`.
|
|
4738
5340
|
* @param options - Per-request options.
|
|
@@ -4745,7 +5347,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4745
5347
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-admin-users-user-id
|
|
4746
5348
|
* @example
|
|
4747
5349
|
* ```ts
|
|
4748
|
-
* const consumerAdminEndUser = await auth.consumer("app").users.update("
|
|
5350
|
+
* const consumerAdminEndUser = await auth.consumer("my-app").users.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { display_name: "Ada Lovelace" });
|
|
4749
5351
|
* ```
|
|
4750
5352
|
*/
|
|
4751
5353
|
update(userId, params, options) {
|
|
@@ -4756,6 +5358,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4756
5358
|
*
|
|
4757
5359
|
* Sets `app_membership.role_id` for the target user. For M2M callers the assignable role is bounded by the token's scopes (the guard already enforced `role.assign`); the role's own permission set is NOT additionally narrowed against the M2M scopes because M2M scopes are typically broader than per-user role perms by design (a backend cron with `user.list` + `role.assign` SHOULD be able to promote a user into a role carrying any per-app perm). EndUser admins are bounded by their own role's perms transitively — they couldn't authenticate as an admin without holding the perm.
|
|
4758
5360
|
*
|
|
5361
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5362
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
5363
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5364
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5365
|
+
*
|
|
4759
5366
|
* @param userId - Id of the user.
|
|
4760
5367
|
* @param params - `Auth.UserUpdateRoleParams`.
|
|
4761
5368
|
* @param options - Per-request options.
|
|
@@ -4768,7 +5375,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4768
5375
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-admin-users-user-id-role
|
|
4769
5376
|
* @example
|
|
4770
5377
|
* ```ts
|
|
4771
|
-
* const consumerAdminRoleAssignment = await auth.consumer("app").users.updateRole("
|
|
5378
|
+
* const consumerAdminRoleAssignment = await auth.consumer("my-app").users.updateRole("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "member" });
|
|
4772
5379
|
* ```
|
|
4773
5380
|
*/
|
|
4774
5381
|
updateRole(userId, params, options) {
|
|
@@ -4779,6 +5386,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4779
5386
|
*
|
|
4780
5387
|
* Setting status to `suspended` or `deactivated` also revokes all active sessions for the user (same behaviour as the auth-admin equivalent).
|
|
4781
5388
|
*
|
|
5389
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5390
|
+
* - `app_api_key`: An app API key (`hdk_live_…` or `hdk_test_…`) minted for this app (`POST /v1/apps/{app_id}/api-keys`). Its permissions are always enforced. A workspace key is refused.
|
|
5391
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5392
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5393
|
+
*
|
|
4782
5394
|
* @param userId - Id of the user.
|
|
4783
5395
|
* @param params - `Auth.UserUpdateStatusParams`.
|
|
4784
5396
|
* @param options - Per-request options.
|
|
@@ -4791,7 +5403,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4791
5403
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-admin-users-user-id-status
|
|
4792
5404
|
* @example
|
|
4793
5405
|
* ```ts
|
|
4794
|
-
* const consumerAdminEndUser = await auth.consumer("app").users.updateStatus("
|
|
5406
|
+
* const consumerAdminEndUser = await auth.consumer("my-app").users.updateStatus("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { status: "active" });
|
|
4795
5407
|
* ```
|
|
4796
5408
|
*/
|
|
4797
5409
|
updateStatus(userId, params, options) {
|
|
@@ -4815,7 +5427,7 @@ var ConsumerVerifyResource = class extends APIResource {
|
|
|
4815
5427
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-authorize
|
|
4816
5428
|
* @example
|
|
4817
5429
|
* ```ts
|
|
4818
|
-
* const authorize = await auth.consumer("app").verify.authorize({ permission: "
|
|
5430
|
+
* const authorize = await auth.consumer("my-app").verify.authorize({ permission: "invoice.read" });
|
|
4819
5431
|
* ```
|
|
4820
5432
|
*/
|
|
4821
5433
|
authorize(params, options) {
|
|
@@ -4837,7 +5449,7 @@ var ConsumerVerifyResource = class extends APIResource {
|
|
|
4837
5449
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-authorize-batch
|
|
4838
5450
|
* @example
|
|
4839
5451
|
* ```ts
|
|
4840
|
-
* const authorizeBatch = await auth.consumer("app").verify.authorizeBatch({ checks: [{}] });
|
|
5452
|
+
* const authorizeBatch = await auth.consumer("my-app").verify.authorizeBatch({ checks: [{}] });
|
|
4841
5453
|
* ```
|
|
4842
5454
|
*/
|
|
4843
5455
|
authorizeBatch(params, options) {
|
|
@@ -4859,7 +5471,7 @@ var ConsumerVerifyResource = class extends APIResource {
|
|
|
4859
5471
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-verify
|
|
4860
5472
|
* @example
|
|
4861
5473
|
* ```ts
|
|
4862
|
-
* const verify = await auth.consumer("app").verify.token({ token: "
|
|
5474
|
+
* const verify = await auth.consumer("my-app").verify.token({ token: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJzdWIiOiJ1c3JfMSJ9.c2lnbmF0dXJl" });
|
|
4863
5475
|
* ```
|
|
4864
5476
|
*/
|
|
4865
5477
|
token(params, options) {
|
|
@@ -4887,7 +5499,7 @@ var ConsumerWellKnownResource = class extends APIResource {
|
|
|
4887
5499
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-well-known-jwks-json
|
|
4888
5500
|
* @example
|
|
4889
5501
|
* ```ts
|
|
4890
|
-
* const jwks = await auth.consumer("app").wellKnown.jwks();
|
|
5502
|
+
* const jwks = await auth.consumer("my-app").wellKnown.jwks();
|
|
4891
5503
|
* ```
|
|
4892
5504
|
*/
|
|
4893
5505
|
jwks(options) {
|
|
@@ -4905,7 +5517,7 @@ var ConsumerWellKnownResource = class extends APIResource {
|
|
|
4905
5517
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-well-known-openid-configuration
|
|
4906
5518
|
* @example
|
|
4907
5519
|
* ```ts
|
|
4908
|
-
* const openIdConfiguration = await auth.consumer("app").wellKnown.openidConfiguration();
|
|
5520
|
+
* const openIdConfiguration = await auth.consumer("my-app").wellKnown.openidConfiguration();
|
|
4909
5521
|
* ```
|
|
4910
5522
|
*/
|
|
4911
5523
|
openidConfiguration(options) {
|
|
@@ -4981,7 +5593,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
4981
5593
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-accept-invite
|
|
4982
5594
|
* @example
|
|
4983
5595
|
* ```ts
|
|
4984
|
-
* const result = await auth.consumer("app").acceptInvite({ code: "inv_x7H2k3jLqXr", password: "CorrectHorseBatteryStaple" });
|
|
5596
|
+
* const result = await auth.consumer("my-app").acceptInvite({ code: "inv_x7H2k3jLqXr", password: "CorrectHorseBatteryStaple" });
|
|
4985
5597
|
* ```
|
|
4986
5598
|
*/
|
|
4987
5599
|
acceptInvite(params, options) {
|
|
@@ -5006,7 +5618,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5006
5618
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-accept-tenant-invite
|
|
5007
5619
|
* @example
|
|
5008
5620
|
* ```ts
|
|
5009
|
-
* const consumerToken = await auth.consumer("app").acceptTenantInvite({ code: "tinv_9dK2mQ7pR4vXbN1sT6yZ0hLcJeW3fAgU", password: "CorrectHorseBatteryStaple" });
|
|
5621
|
+
* const consumerToken = await auth.consumer("my-app").acceptTenantInvite({ code: "tinv_9dK2mQ7pR4vXbN1sT6yZ0hLcJeW3fAgU", password: "CorrectHorseBatteryStaple" });
|
|
5010
5622
|
* ```
|
|
5011
5623
|
*/
|
|
5012
5624
|
acceptTenantInvite(params, options) {
|
|
@@ -5024,7 +5636,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5024
5636
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-oauth-exchange
|
|
5025
5637
|
* @example
|
|
5026
5638
|
* ```ts
|
|
5027
|
-
* const exchange = await auth.consumer("app").exchangeProviderCode({ code: "
|
|
5639
|
+
* const exchange = await auth.consumer("my-app").exchangeProviderCode({ code: "hc_8f14e45fceea167a5a36dedd4bea2543" });
|
|
5028
5640
|
* ```
|
|
5029
5641
|
*/
|
|
5030
5642
|
exchangeProviderCode(params, options) {
|
|
@@ -5047,7 +5659,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5047
5659
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-logout
|
|
5048
5660
|
* @example
|
|
5049
5661
|
* ```ts
|
|
5050
|
-
* await auth.consumer("app").logout({
|
|
5662
|
+
* await auth.consumer("my-app").logout({
|
|
5663
|
+
* refresh_token: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJ0eXAiOiJyZWZyZXNoIn0.c2lnbmF0dXJl",
|
|
5664
|
+
* });
|
|
5051
5665
|
* ```
|
|
5052
5666
|
*/
|
|
5053
5667
|
logout(params, options) {
|
|
@@ -5070,7 +5684,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5070
5684
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-refresh
|
|
5071
5685
|
* @example
|
|
5072
5686
|
* ```ts
|
|
5073
|
-
* const consumerToken = await auth.consumer("app").refresh({
|
|
5687
|
+
* const consumerToken = await auth.consumer("my-app").refresh({
|
|
5688
|
+
* refresh_token: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJ0eXAiOiJyZWZyZXNoIn0.c2lnbmF0dXJl",
|
|
5689
|
+
* });
|
|
5074
5690
|
* ```
|
|
5075
5691
|
*/
|
|
5076
5692
|
refresh(params, options) {
|
|
@@ -5085,6 +5701,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5085
5701
|
*
|
|
5086
5702
|
* Renamed from /auth/request-reset.
|
|
5087
5703
|
*
|
|
5704
|
+
* Credential: `workspace_key`.
|
|
5705
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5706
|
+
*
|
|
5088
5707
|
* @param params - `Auth.RequestPasswordResetParams`.
|
|
5089
5708
|
* @param options - Per-request options.
|
|
5090
5709
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Provide exactly one of `email` or `phone`, or request validation failed in the global `ValidationPipe`.
|
|
@@ -5097,7 +5716,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5097
5716
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-request-password-reset
|
|
5098
5717
|
* @example
|
|
5099
5718
|
* ```ts
|
|
5100
|
-
* const consumerCodeIssue = await auth.consumer("app").requestPasswordReset({ email: "jane@example.com" });
|
|
5719
|
+
* const consumerCodeIssue = await auth.consumer("my-app").requestPasswordReset({ email: "jane@example.com" });
|
|
5101
5720
|
* ```
|
|
5102
5721
|
*/
|
|
5103
5722
|
requestPasswordReset(params, options) {
|
|
@@ -5112,6 +5731,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5112
5731
|
*
|
|
5113
5732
|
* Issuing a code invalidates any previously issued, unconsumed code for the same contact — including the one auto-emailed at signup. Only the most recently minted code is accepted.
|
|
5114
5733
|
*
|
|
5734
|
+
* Credential: `workspace_key`.
|
|
5735
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5736
|
+
*
|
|
5115
5737
|
* @param params - `Auth.RequestVerificationParams`.
|
|
5116
5738
|
* @param options - Per-request options.
|
|
5117
5739
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Provide exactly one of `email` or `phone`, or request validation failed in the global `ValidationPipe`.
|
|
@@ -5124,7 +5746,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5124
5746
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-request-verification
|
|
5125
5747
|
* @example
|
|
5126
5748
|
* ```ts
|
|
5127
|
-
* const consumerCodeIssue = await auth.consumer("app").requestVerification({ email: "jane@example.com" });
|
|
5749
|
+
* const consumerCodeIssue = await auth.consumer("my-app").requestVerification({ email: "jane@example.com" });
|
|
5128
5750
|
* ```
|
|
5129
5751
|
*/
|
|
5130
5752
|
requestVerification(params, options) {
|
|
@@ -5148,7 +5770,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5148
5770
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-reset-password
|
|
5149
5771
|
* @example
|
|
5150
5772
|
* ```ts
|
|
5151
|
-
* await auth.consumer("app").resetPassword({ code: "123456", new_password: "
|
|
5773
|
+
* await auth.consumer("my-app").resetPassword({ code: "123456", new_password: "a new long passphrase 42" });
|
|
5152
5774
|
* ```
|
|
5153
5775
|
*/
|
|
5154
5776
|
resetPassword(params, options) {
|
|
@@ -5159,6 +5781,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5159
5781
|
*
|
|
5160
5782
|
* Same shape as `send-verification-email` but for the reset slot. PAK perm: `auth.user.password-reset.send-email`. Same loud precondition errors. Email-only.
|
|
5161
5783
|
*
|
|
5784
|
+
* Credential: `workspace_key`.
|
|
5785
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5786
|
+
*
|
|
5162
5787
|
* @param params - `Auth.SendPasswordResetEmailParams`.
|
|
5163
5788
|
* @param options - Per-request options.
|
|
5164
5789
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Request validation failed: a required body field is missing, has the wrong type, or fails its format constraint. Produced by the global `ValidationPipe` before the handler runs; the response body lists the offending fields.
|
|
@@ -5173,7 +5798,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5173
5798
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-send-password-reset-email
|
|
5174
5799
|
* @example
|
|
5175
5800
|
* ```ts
|
|
5176
|
-
* const consumerCodeDispatch = await auth.consumer("app").sendPasswordResetEmail({ email: "jane@example.com" });
|
|
5801
|
+
* const consumerCodeDispatch = await auth.consumer("my-app").sendPasswordResetEmail({ email: "jane@example.com" });
|
|
5177
5802
|
* ```
|
|
5178
5803
|
*/
|
|
5179
5804
|
sendPasswordResetEmail(params, options) {
|
|
@@ -5197,6 +5822,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5197
5822
|
*
|
|
5198
5823
|
* Issuing a code invalidates any previously issued, unconsumed code for the same contact — including the one auto-emailed at signup. Only the most recently minted code is accepted.
|
|
5199
5824
|
*
|
|
5825
|
+
* Credential: `workspace_key`.
|
|
5826
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5827
|
+
*
|
|
5200
5828
|
* @param params - `Auth.SendVerificationEmailParams`.
|
|
5201
5829
|
* @param options - Per-request options.
|
|
5202
5830
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Request validation failed: a required body field is missing, has the wrong type, or fails its format constraint. Produced by the global `ValidationPipe` before the handler runs; the response body lists the offending fields.
|
|
@@ -5211,7 +5839,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5211
5839
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-send-verification-email
|
|
5212
5840
|
* @example
|
|
5213
5841
|
* ```ts
|
|
5214
|
-
* const consumerCodeDispatch = await auth.consumer("app").sendVerificationEmail({ email: "jane@example.com" });
|
|
5842
|
+
* const consumerCodeDispatch = await auth.consumer("my-app").sendVerificationEmail({ email: "jane@example.com" });
|
|
5215
5843
|
* ```
|
|
5216
5844
|
*/
|
|
5217
5845
|
sendVerificationEmail(params, options) {
|
|
@@ -5235,7 +5863,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5235
5863
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-signin
|
|
5236
5864
|
* @example
|
|
5237
5865
|
* ```ts
|
|
5238
|
-
* const result = await auth.consumer("app").signin({ identifier: "jane_doe", password: "
|
|
5866
|
+
* const result = await auth.consumer("my-app").signin({ identifier: "jane_doe", password: "correct horse battery staple" });
|
|
5239
5867
|
* ```
|
|
5240
5868
|
*/
|
|
5241
5869
|
signin(params, options) {
|
|
@@ -5256,7 +5884,10 @@ var AuthConsumer = class extends APIResource {
|
|
|
5256
5884
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-oauth-provider
|
|
5257
5885
|
* @example
|
|
5258
5886
|
* ```ts
|
|
5259
|
-
* const result = await auth.consumer("app").signinWithProvider("
|
|
5887
|
+
* const result = await auth.consumer("my-app").signinWithProvider("google", {
|
|
5888
|
+
* id_token: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJzdWIiOiJ1c3JfMSJ9.c2lnbmF0dXJl",
|
|
5889
|
+
* nonce: "n-0S6_WzA2Mj",
|
|
5890
|
+
* });
|
|
5260
5891
|
* ```
|
|
5261
5892
|
*/
|
|
5262
5893
|
signinWithProvider(provider, params, options) {
|
|
@@ -5271,11 +5902,14 @@ var AuthConsumer = class extends APIResource {
|
|
|
5271
5902
|
*
|
|
5272
5903
|
* When the app has bot protection on (`auth_config.bot_protection`, Cloudflare Turnstile or hCaptcha), send the widget response as `bot_protection_token`. Auth verifies it with the provider before it looks at the email, username or password, and refuses the sign-up when the token is missing (400 `BOT_PROTECTION_REQUIRED`), rejected (403 `BOT_PROTECTION_FAILED`) or cannot be checked (503 `BOT_PROTECTION_UNAVAILABLE`; no account is created). This applies to PAK-authenticated calls too: a backend forwards the token its browser received.
|
|
5273
5904
|
*
|
|
5905
|
+
* Credential (optional): `workspace_key`.
|
|
5906
|
+
* - `workspace_key`: A workspace API key (`pcft_live_…`, what the SDKs read from `PRODUCTCRAFT_API_KEY`) or a signed-in ProductCraft platform session token. Its workspace policy decides what it may do.
|
|
5907
|
+
*
|
|
5274
5908
|
* @param params - `Auth.SignupParams`.
|
|
5275
5909
|
* @param options - Per-request options.
|
|
5276
5910
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR, BOT_PROTECTION_REQUIRED: `BOT_PROTECTION_REQUIRED`: the app has bot protection on and the request carried no `bot_protection_token`. Also: Request validation failed: a required body field is missing, has the wrong type, or fails its format constraint. Produced by the global `ValidationPipe` before the handler runs; the response body lists the offending fields.
|
|
5277
5911
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: The app sets `signup_requires_pak` and no Platform API Key was presented on `Authorization: Bearer`.
|
|
5278
|
-
* @throws {PermissionDeniedError} 403 FORBIDDEN, BOT_PROTECTION_FAILED, APP_SUSPENDED, APP_ARCHIVED: `BOT_PROTECTION_FAILED`: the bot-protection provider rejected the `bot_protection_token` (bad, expired or already used), or the hostname it reported is not one of the app's `bot_protection.expected_hostnames`; render a fresh widget and retry. Otherwise: signup is disabled for this app, the email domain is not on the app's allow-list, the presented PAK belongs to a different workspace, or its policy denies `auth.signup.create` on this app. Also returned when the app itself is suspended (`APP_SUSPENDED`) or archived (`APP_ARCHIVED`).
|
|
5912
|
+
* @throws {PermissionDeniedError} 403 FORBIDDEN, BOT_PROTECTION_FAILED, APP_SUSPENDED, APP_ARCHIVED: `BOT_PROTECTION_FAILED`: the bot-protection provider rejected the `bot_protection_token` (bad, expired or already used), or the hostname it reported is not one of the app's `bot_protection.expected_hostnames`; render a fresh widget and retry. Otherwise: signup is disabled for this app (new apps start with `signup_enabled: false`; turn it on with `PATCH /v1/apps/{app_id}/auth-config`), the email domain is not on the app's allow-list, the presented PAK belongs to a different workspace, or its policy denies `auth.signup.create` on this app. Also returned when the app itself is suspended (`APP_SUSPENDED`) or archived (`APP_ARCHIVED`).
|
|
5279
5913
|
* @throws {NotFoundError} 404 NOT_FOUND: The `:appSlug` in the path matches no app (or no live rename alias for one). This is about the **app**, not the account — it is decided before any identifier, code or credential in the body is looked at, so it is never a signal about whether an account or a contact exists.
|
|
5280
5914
|
* @throws {ConflictError} 409 CONFLICT: Email or username already in use in this app, or the app has no workspace binding and therefore cannot accept a PAK signup.
|
|
5281
5915
|
* @throws {APIError} 415 UNSUPPORTED_MEDIA_TYPE: The request body was sent as `application/x-www-form-urlencoded` (`UNSUPPORTED_MEDIA_TYPE`). This API is JSON-only: a form body is a CORS-simple request that skips preflight, so accepting one would widen the CSRF surface. Send `application/json`. Rejected in `main.ts` before routing, on every non-GET request.
|
|
@@ -5285,7 +5919,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5285
5919
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-signup
|
|
5286
5920
|
* @example
|
|
5287
5921
|
* ```ts
|
|
5288
|
-
* const result = await auth.consumer("app").signup({ email: "jane@example.com", password: "CorrectHorseBatteryStaple", username: "john_doe" });
|
|
5922
|
+
* const result = await auth.consumer("my-app").signup({ email: "jane@example.com", password: "CorrectHorseBatteryStaple", username: "john_doe" });
|
|
5289
5923
|
* ```
|
|
5290
5924
|
*/
|
|
5291
5925
|
signup(params, options) {
|
|
@@ -5296,6 +5930,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5296
5930
|
*
|
|
5297
5931
|
* Re-issues the EndUser's access + refresh tokens with the new `org_id` + `org_role` claims, after verifying the caller holds a tenant_membership for the target tenant. The session row is updated to the new tenant so subsequent refreshes preserve the context. The new access token keeps the session's `amr` and `mfa_at` (as `/auth/refresh` does), so a sign-in that completed MFA still proves it after a switch. Refresh-token rotation runs as usual; the previous refresh token enters the standard 60-second grace window.
|
|
5298
5932
|
*
|
|
5933
|
+
* Credential: `end_user_token`.
|
|
5934
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5935
|
+
*
|
|
5299
5936
|
* @param params - `Auth.SwitchTenantParams`.
|
|
5300
5937
|
* @param options - Per-request options.
|
|
5301
5938
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Request validation failed: a required body field is missing, has the wrong type, or fails its format constraint. Produced by the global `ValidationPipe` before the handler runs; the response body lists the offending fields.
|
|
@@ -5308,7 +5945,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5308
5945
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-switch-tenant
|
|
5309
5946
|
* @example
|
|
5310
5947
|
* ```ts
|
|
5311
|
-
* const consumerToken = await auth.consumer("app").switchTenant({ tenant_id: "
|
|
5948
|
+
* const consumerToken = await auth.consumer("my-app").switchTenant({ tenant_id: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f" });
|
|
5312
5949
|
* ```
|
|
5313
5950
|
*/
|
|
5314
5951
|
switchTenant(params, options) {
|
|
@@ -5333,7 +5970,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5333
5970
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-verify
|
|
5334
5971
|
* @example
|
|
5335
5972
|
* ```ts
|
|
5336
|
-
* const consumerVerify = await auth.consumer("app").verifyEmail({ code: "123456" });
|
|
5973
|
+
* const consumerVerify = await auth.consumer("my-app").verifyEmail({ code: "123456" });
|
|
5337
5974
|
* ```
|
|
5338
5975
|
*/
|
|
5339
5976
|
verifyEmail(params, options) {
|
|
@@ -7294,7 +7931,7 @@ var WebhookEventStatus = { values: ["pending", "delivered", "failed", "not_sent"
|
|
|
7294
7931
|
var WebhookEventType = { values: ["user.signup", "user.signin", "user.suspended", "user.deactivated", "user.reinstated", "user.role_changed", "user.deleted", "user.contact_verified", "user.email_verified", "user.password_reset.requested", "user.password_reset.completed", "user.mfa.factor_enrolled", "user.mfa.factor_disabled", "user.mfa.recovery_code_used", "user.mfa.step_up_succeeded", "user.mfa.step_up_locked", "user.mfa.enrollment_required", "user.mfa.reenrollment_required", "tenant.created", "tenant.updated", "tenant.deleted", "tenant.member.added", "tenant.member.removed", "tenant.member.role_changed", "tenant.invite.created", "tenant.invite.accepted", "tenant.invite.revoked", "app.slug_changed"] };
|
|
7295
7932
|
|
|
7296
7933
|
// src/_generated/client.ts
|
|
7297
|
-
var VERSION = "1.
|
|
7934
|
+
var VERSION = "1.1.0" ;
|
|
7298
7935
|
exports.default = class Auth extends AuthBase {
|
|
7299
7936
|
#openapi;
|
|
7300
7937
|
constructor(options = {}) {
|