@productcraft/auth 1.0.1 → 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 +996 -262
- package/dist/index.d.ts +996 -262
- package/dist/index.js +868 -231
- package/dist/index.js.map +1 -1
- package/manifest.json +210 -210
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -34,6 +34,11 @@ var AppsResource = class extends APIResource {
|
|
|
34
34
|
*
|
|
35
35
|
* 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`.
|
|
36
36
|
*
|
|
37
|
+
* **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.
|
|
38
|
+
*
|
|
39
|
+
* Credential: `workspace_key`.
|
|
40
|
+
* - `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.
|
|
41
|
+
*
|
|
37
42
|
* @param params - `Auth.AppCreateParams`.
|
|
38
43
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
39
44
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (slug, display name, or workspaceId).
|
|
@@ -58,6 +63,9 @@ var AppsResource = class extends APIResource {
|
|
|
58
63
|
/**
|
|
59
64
|
* Delete an app permanently
|
|
60
65
|
*
|
|
66
|
+
* Credential: `workspace_key`.
|
|
67
|
+
* - `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.
|
|
68
|
+
*
|
|
61
69
|
* @param appId - Id of the app.
|
|
62
70
|
* @param options - Per-request options.
|
|
63
71
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -68,7 +76,7 @@ var AppsResource = class extends APIResource {
|
|
|
68
76
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id
|
|
69
77
|
* @example
|
|
70
78
|
* ```ts
|
|
71
|
-
* await auth.apps.delete("
|
|
79
|
+
* await auth.apps.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
72
80
|
* ```
|
|
73
81
|
*/
|
|
74
82
|
delete(appId, options) {
|
|
@@ -77,6 +85,9 @@ var AppsResource = class extends APIResource {
|
|
|
77
85
|
/**
|
|
78
86
|
* 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.
|
|
79
87
|
*
|
|
88
|
+
* Credential: `workspace_key`.
|
|
89
|
+
* - `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.
|
|
90
|
+
*
|
|
80
91
|
* @param params - `Auth.AppListParams`.
|
|
81
92
|
* @param options - Per-request options.
|
|
82
93
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid pagination cursor.
|
|
@@ -98,6 +109,9 @@ var AppsResource = class extends APIResource {
|
|
|
98
109
|
/**
|
|
99
110
|
* Get app details
|
|
100
111
|
*
|
|
112
|
+
* Credential: `workspace_key`.
|
|
113
|
+
* - `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.
|
|
114
|
+
*
|
|
101
115
|
* @param appId - Id of the app.
|
|
102
116
|
* @param options - Per-request options.
|
|
103
117
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -108,7 +122,7 @@ var AppsResource = class extends APIResource {
|
|
|
108
122
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id
|
|
109
123
|
* @example
|
|
110
124
|
* ```ts
|
|
111
|
-
* const app = await auth.apps.retrieve("
|
|
125
|
+
* const app = await auth.apps.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
112
126
|
* ```
|
|
113
127
|
*/
|
|
114
128
|
retrieve(appId, options) {
|
|
@@ -117,6 +131,9 @@ var AppsResource = class extends APIResource {
|
|
|
117
131
|
/**
|
|
118
132
|
* Update app display name, slug, metadata, and retention settings
|
|
119
133
|
*
|
|
134
|
+
* Credential: `workspace_key`.
|
|
135
|
+
* - `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.
|
|
136
|
+
*
|
|
120
137
|
* @param appId - Id of the app.
|
|
121
138
|
* @param params - `Auth.AppUpdateParams`.
|
|
122
139
|
* @param options - Per-request options.
|
|
@@ -127,7 +144,7 @@ var AppsResource = class extends APIResource {
|
|
|
127
144
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id
|
|
128
145
|
* @example
|
|
129
146
|
* ```ts
|
|
130
|
-
* const app = await auth.apps.update("
|
|
147
|
+
* const app = await auth.apps.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { audit_retention_days: 365 });
|
|
131
148
|
* ```
|
|
132
149
|
*/
|
|
133
150
|
update(appId, params, options) {
|
|
@@ -140,6 +157,9 @@ var StatsResource = class extends APIResource {
|
|
|
140
157
|
*
|
|
141
158
|
* 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.
|
|
142
159
|
*
|
|
160
|
+
* Credential: `workspace_key`.
|
|
161
|
+
* - `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.
|
|
162
|
+
*
|
|
143
163
|
* @param params - `Auth.StatsMeParams`.
|
|
144
164
|
* @param options - Per-request options.
|
|
145
165
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -163,6 +183,9 @@ var StatsResource = class extends APIResource {
|
|
|
163
183
|
*
|
|
164
184
|
* Days are UTC. Counts only: no end-user identifiers. Cached for up to 60 seconds (`generated_at`).
|
|
165
185
|
*
|
|
186
|
+
* Credential: `workspace_key`.
|
|
187
|
+
* - `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.
|
|
188
|
+
*
|
|
166
189
|
* @param params - `Auth.StatsRetrieveParams`.
|
|
167
190
|
* @param options - Per-request options.
|
|
168
191
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `workspaceId` is not a UUID or `window` is not one of 1d, 7d, 30d.
|
|
@@ -200,6 +223,16 @@ var WebhooksResource = class extends APIResource {
|
|
|
200
223
|
unwrap(params) {
|
|
201
224
|
return this._client.unwrapWebhook(params, "PRODUCTCRAFT_AUTH_WEBHOOK_SECRET");
|
|
202
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Sign a test event the way ProductCraft signs deliveries (Standard Webhooks), so a handler
|
|
228
|
+
* test can call `unwrap` without a live delivery. Returns the exact body and the headers.
|
|
229
|
+
*
|
|
230
|
+
* @param params - The event (an object is JSON-encoded), and optionally the secret, `id` and `timestamp`.
|
|
231
|
+
* @throws {ConfigurationError} No secret was passed or configured.
|
|
232
|
+
*/
|
|
233
|
+
sign(params) {
|
|
234
|
+
return this._client.signWebhook(params, "PRODUCTCRAFT_AUTH_WEBHOOK_SECRET");
|
|
235
|
+
}
|
|
203
236
|
};
|
|
204
237
|
var AuthResources = class extends APIResource {
|
|
205
238
|
#apps;
|
|
@@ -219,6 +252,9 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
219
252
|
/**
|
|
220
253
|
* Mint a new hdk_live_* API key with an explicit permission scope. The raw key is returned ONCE.
|
|
221
254
|
*
|
|
255
|
+
* Credential: `workspace_key`.
|
|
256
|
+
* - `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.
|
|
257
|
+
*
|
|
222
258
|
* @param params - `Auth.ApiKeyCreateParams`.
|
|
223
259
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
224
260
|
* @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`.
|
|
@@ -231,7 +267,7 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
231
267
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-api-keys
|
|
232
268
|
* @example
|
|
233
269
|
* ```ts
|
|
234
|
-
* const createApiKey = await auth.admin.app("
|
|
270
|
+
* const createApiKey = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").apiKeys.create({ name: "CI deploy bot", permissions: ["user.read", "user.list"] });
|
|
235
271
|
* ```
|
|
236
272
|
*/
|
|
237
273
|
create(params, options) {
|
|
@@ -240,6 +276,9 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
240
276
|
/**
|
|
241
277
|
* 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.
|
|
242
278
|
*
|
|
279
|
+
* Credential: `workspace_key`.
|
|
280
|
+
* - `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.
|
|
281
|
+
*
|
|
243
282
|
* @param keyId - Id of the key.
|
|
244
283
|
* @param options - Per-request options.
|
|
245
284
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -249,7 +288,7 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
249
288
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-api-keys-key-id
|
|
250
289
|
* @example
|
|
251
290
|
* ```ts
|
|
252
|
-
* await auth.admin.app("
|
|
291
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").apiKeys.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
253
292
|
* ```
|
|
254
293
|
*/
|
|
255
294
|
delete(keyId, options) {
|
|
@@ -258,6 +297,9 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
258
297
|
/**
|
|
259
298
|
* List API keys for an app (no raw secret), newest first. Cursor-paginated: 20/page by default, 100 max.
|
|
260
299
|
*
|
|
300
|
+
* Credential: `workspace_key`.
|
|
301
|
+
* - `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.
|
|
302
|
+
*
|
|
261
303
|
* @param params - `Auth.ApiKeyListParams`.
|
|
262
304
|
* @param options - Per-request options.
|
|
263
305
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Malformed `cursor`.
|
|
@@ -267,10 +309,10 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
267
309
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-api-keys
|
|
268
310
|
* @example
|
|
269
311
|
* ```ts
|
|
270
|
-
* for await (const apiKey of auth.admin.app("
|
|
312
|
+
* for await (const apiKey of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").apiKeys.list()) {
|
|
271
313
|
* console.log(apiKey);
|
|
272
314
|
* }
|
|
273
|
-
* const page = await auth.admin.app("
|
|
315
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").apiKeys.list({}, { timeout: 5_000 });
|
|
274
316
|
* ```
|
|
275
317
|
*/
|
|
276
318
|
list(params, options) {
|
|
@@ -279,6 +321,9 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
279
321
|
/**
|
|
280
322
|
* 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.
|
|
281
323
|
*
|
|
324
|
+
* Credential: `workspace_key`.
|
|
325
|
+
* - `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.
|
|
326
|
+
*
|
|
282
327
|
* @param keyId - Id of the key.
|
|
283
328
|
* @param params - `Auth.ApiKeyRotateParams`.
|
|
284
329
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -290,7 +335,7 @@ var AppApiKeysResource = class extends APIResource {
|
|
|
290
335
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-api-keys-key-id-rotate
|
|
291
336
|
* @example
|
|
292
337
|
* ```ts
|
|
293
|
-
* const rotateApiKey = await auth.admin.app("
|
|
338
|
+
* const rotateApiKey = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").apiKeys.rotate("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { grace_hours: 24 });
|
|
294
339
|
* ```
|
|
295
340
|
*/
|
|
296
341
|
rotate(keyId, params, options) {
|
|
@@ -303,6 +348,9 @@ var AppAuditLogsResource = class extends APIResource {
|
|
|
303
348
|
*
|
|
304
349
|
* 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.
|
|
305
350
|
*
|
|
351
|
+
* Credential: `workspace_key`.
|
|
352
|
+
* - `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.
|
|
353
|
+
*
|
|
306
354
|
* @param params - `Auth.AuditLogExportParams`.
|
|
307
355
|
* @param options - Per-request options.
|
|
308
356
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `format`, or malformed `since` / `until`.
|
|
@@ -315,7 +363,7 @@ var AppAuditLogsResource = class extends APIResource {
|
|
|
315
363
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-audit-logs-export
|
|
316
364
|
* @example
|
|
317
365
|
* ```ts
|
|
318
|
-
* const response = await auth.admin.app("
|
|
366
|
+
* const response = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditLogs.export();
|
|
319
367
|
* const text = await response.text();
|
|
320
368
|
* ```
|
|
321
369
|
*/
|
|
@@ -325,6 +373,9 @@ var AppAuditLogsResource = class extends APIResource {
|
|
|
325
373
|
/**
|
|
326
374
|
* 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.
|
|
327
375
|
*
|
|
376
|
+
* Credential: `workspace_key`.
|
|
377
|
+
* - `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.
|
|
378
|
+
*
|
|
328
379
|
* @param params - `Auth.AuditLogListParams`.
|
|
329
380
|
* @param options - Per-request options.
|
|
330
381
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Malformed `cursor`, `since`, or `until`.
|
|
@@ -336,10 +387,10 @@ var AppAuditLogsResource = class extends APIResource {
|
|
|
336
387
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-audit-logs
|
|
337
388
|
* @example
|
|
338
389
|
* ```ts
|
|
339
|
-
* for await (const auditLog of auth.admin.app("
|
|
390
|
+
* for await (const auditLog of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditLogs.list()) {
|
|
340
391
|
* console.log(auditLog);
|
|
341
392
|
* }
|
|
342
|
-
* const page = await auth.admin.app("
|
|
393
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditLogs.list({}, { timeout: 5_000 });
|
|
343
394
|
* ```
|
|
344
395
|
*/
|
|
345
396
|
list(params, options) {
|
|
@@ -350,6 +401,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
350
401
|
/**
|
|
351
402
|
* Remove the audit sink. Shipping stops immediately; the audit log itself is untouched.
|
|
352
403
|
*
|
|
404
|
+
* Credential: `workspace_key`.
|
|
405
|
+
* - `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.
|
|
406
|
+
*
|
|
353
407
|
* @param options - Per-request options.
|
|
354
408
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
355
409
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.update`.
|
|
@@ -359,7 +413,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
359
413
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-audit-sink
|
|
360
414
|
* @example
|
|
361
415
|
* ```ts
|
|
362
|
-
* await auth.admin.app("
|
|
416
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.disconnect();
|
|
363
417
|
* ```
|
|
364
418
|
*/
|
|
365
419
|
disconnect(options) {
|
|
@@ -370,6 +424,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
370
424
|
*
|
|
371
425
|
* 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.
|
|
372
426
|
*
|
|
427
|
+
* Credential: `workspace_key`.
|
|
428
|
+
* - `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.
|
|
429
|
+
*
|
|
373
430
|
* @param params - `Auth.AuditSinkReplaceParams`.
|
|
374
431
|
* @param options - Per-request options.
|
|
375
432
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: URL is not HTTPS, or the SSRF guard refused it (private address, unresolvable host, non-public TLD).
|
|
@@ -381,7 +438,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
381
438
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-audit-sink
|
|
382
439
|
* @example
|
|
383
440
|
* ```ts
|
|
384
|
-
* const auditSinkWithSecret = await auth.admin.app("
|
|
441
|
+
* const auditSinkWithSecret = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.replace({ url: "https://siem.customer.example.com/ingest/productcraft-auth" });
|
|
385
442
|
* ```
|
|
386
443
|
*/
|
|
387
444
|
replace(params, options) {
|
|
@@ -390,6 +447,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
390
447
|
/**
|
|
391
448
|
* Current audit sink for this app, or 404 when none is configured. Never returns the signing secret — only its last-4 hint.
|
|
392
449
|
*
|
|
450
|
+
* Credential: `workspace_key`.
|
|
451
|
+
* - `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.
|
|
452
|
+
*
|
|
393
453
|
* @param options - Per-request options.
|
|
394
454
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
395
455
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read`.
|
|
@@ -399,7 +459,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
399
459
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-audit-sink
|
|
400
460
|
* @example
|
|
401
461
|
* ```ts
|
|
402
|
-
* const auditSink = await auth.admin.app("
|
|
462
|
+
* const auditSink = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.retrieve();
|
|
403
463
|
* ```
|
|
404
464
|
*/
|
|
405
465
|
retrieve(options) {
|
|
@@ -410,6 +470,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
410
470
|
*
|
|
411
471
|
* 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.
|
|
412
472
|
*
|
|
473
|
+
* Credential: `workspace_key`.
|
|
474
|
+
* - `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.
|
|
475
|
+
*
|
|
413
476
|
* @param options - Per-request options.
|
|
414
477
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
415
478
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.update`.
|
|
@@ -419,7 +482,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
419
482
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-audit-sink-rotate-secret
|
|
420
483
|
* @example
|
|
421
484
|
* ```ts
|
|
422
|
-
* const auditSinkWithSecret = await auth.admin.app("
|
|
485
|
+
* const auditSinkWithSecret = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.rotateSecret();
|
|
423
486
|
* ```
|
|
424
487
|
*/
|
|
425
488
|
rotateSecret(options) {
|
|
@@ -430,6 +493,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
430
493
|
*
|
|
431
494
|
* 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.
|
|
432
495
|
*
|
|
496
|
+
* Credential: `workspace_key`.
|
|
497
|
+
* - `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.
|
|
498
|
+
*
|
|
433
499
|
* @param options - Per-request options.
|
|
434
500
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
435
501
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read`, or the app is suspended or archived.
|
|
@@ -439,7 +505,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
439
505
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-audit-sink-setup-status
|
|
440
506
|
* @example
|
|
441
507
|
* ```ts
|
|
442
|
-
* const setupStatus = await auth.admin.app("
|
|
508
|
+
* const setupStatus = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.setupStatus();
|
|
443
509
|
* ```
|
|
444
510
|
*/
|
|
445
511
|
setupStatus(options) {
|
|
@@ -450,6 +516,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
450
516
|
*
|
|
451
517
|
* 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.
|
|
452
518
|
*
|
|
519
|
+
* Credential: `workspace_key`.
|
|
520
|
+
* - `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.
|
|
521
|
+
*
|
|
453
522
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
454
523
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
455
524
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.update`.
|
|
@@ -460,7 +529,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
460
529
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-audit-sink-test
|
|
461
530
|
* @example
|
|
462
531
|
* ```ts
|
|
463
|
-
* const auditSinkTestResult = await auth.admin.app("
|
|
532
|
+
* const auditSinkTestResult = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.test();
|
|
464
533
|
* ```
|
|
465
534
|
*/
|
|
466
535
|
test(options) {
|
|
@@ -471,6 +540,9 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
471
540
|
*
|
|
472
541
|
* 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`.
|
|
473
542
|
*
|
|
543
|
+
* Credential: `workspace_key`.
|
|
544
|
+
* - `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.
|
|
545
|
+
*
|
|
474
546
|
* @param params - `Auth.AuditSinkUpdateParams`.
|
|
475
547
|
* @param options - Per-request options.
|
|
476
548
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: URL is not HTTPS, or the address guard refused it (private address, unresolvable host).
|
|
@@ -482,7 +554,7 @@ var AppAuditSinkResource = class extends APIResource {
|
|
|
482
554
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-audit-sink
|
|
483
555
|
* @example
|
|
484
556
|
* ```ts
|
|
485
|
-
* const auditSink = await auth.admin.app("
|
|
557
|
+
* const auditSink = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.update({ enabled: true });
|
|
486
558
|
* ```
|
|
487
559
|
*/
|
|
488
560
|
update(params, options) {
|
|
@@ -495,6 +567,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
495
567
|
*
|
|
496
568
|
* 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.
|
|
497
569
|
*
|
|
570
|
+
* Credential: `workspace_key`.
|
|
571
|
+
* - `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.
|
|
572
|
+
*
|
|
498
573
|
* @param provider - The sign-in provider: `google`, `github` or `apple`.
|
|
499
574
|
* @param options - Per-request options.
|
|
500
575
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown provider id, or the saved config can no longer be read.
|
|
@@ -506,7 +581,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
506
581
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-auth-config-providers-provider-check
|
|
507
582
|
* @example
|
|
508
583
|
* ```ts
|
|
509
|
-
* const providerCheck = await auth.admin.app("
|
|
584
|
+
* const providerCheck = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.check("google");
|
|
510
585
|
* ```
|
|
511
586
|
*/
|
|
512
587
|
check(provider, options) {
|
|
@@ -515,6 +590,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
515
590
|
/**
|
|
516
591
|
* 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.
|
|
517
592
|
*
|
|
593
|
+
* Credential: `workspace_key`.
|
|
594
|
+
* - `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.
|
|
595
|
+
*
|
|
518
596
|
* @param provider - The sign-in provider: `google`, `github` or `apple`.
|
|
519
597
|
* @param options - Per-request options.
|
|
520
598
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown provider id.
|
|
@@ -524,7 +602,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
524
602
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-auth-config-providers-provider
|
|
525
603
|
* @example
|
|
526
604
|
* ```ts
|
|
527
|
-
* await auth.admin.app("
|
|
605
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.delete("google");
|
|
528
606
|
* ```
|
|
529
607
|
*/
|
|
530
608
|
delete(provider, options) {
|
|
@@ -535,6 +613,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
535
613
|
*
|
|
536
614
|
* 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.
|
|
537
615
|
*
|
|
616
|
+
* Credential: `workspace_key`.
|
|
617
|
+
* - `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.
|
|
618
|
+
*
|
|
538
619
|
* @param options - Per-request options.
|
|
539
620
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
540
621
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -544,7 +625,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
544
625
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-auth-config-providers
|
|
545
626
|
* @example
|
|
546
627
|
* ```ts
|
|
547
|
-
* const result = await auth.admin.app("
|
|
628
|
+
* const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.list();
|
|
548
629
|
* ```
|
|
549
630
|
*/
|
|
550
631
|
list(options) {
|
|
@@ -553,6 +634,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
553
634
|
/**
|
|
554
635
|
* 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`.
|
|
555
636
|
*
|
|
637
|
+
* Credential: `workspace_key`.
|
|
638
|
+
* - `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.
|
|
639
|
+
*
|
|
556
640
|
* @param provider - The sign-in provider: `google`, `github` or `apple`.
|
|
557
641
|
* @param params - `Auth.AuthConfigProviderReplaceParams`.
|
|
558
642
|
* @param options - Per-request options.
|
|
@@ -563,7 +647,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
563
647
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-auth-config-providers-provider
|
|
564
648
|
* @example
|
|
565
649
|
* ```ts
|
|
566
|
-
* const providerDetail = await auth.admin.app("
|
|
650
|
+
* const providerDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.replace("google", { config: {} });
|
|
567
651
|
* ```
|
|
568
652
|
*/
|
|
569
653
|
replace(provider, params, options) {
|
|
@@ -572,6 +656,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
572
656
|
/**
|
|
573
657
|
* 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.
|
|
574
658
|
*
|
|
659
|
+
* Credential: `workspace_key`.
|
|
660
|
+
* - `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.
|
|
661
|
+
*
|
|
575
662
|
* @param provider - The sign-in provider: `google`, `github` or `apple`.
|
|
576
663
|
* @param options - Per-request options.
|
|
577
664
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown provider id.
|
|
@@ -582,7 +669,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
582
669
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-auth-config-providers-provider
|
|
583
670
|
* @example
|
|
584
671
|
* ```ts
|
|
585
|
-
* const providerDetail = await auth.admin.app("
|
|
672
|
+
* const providerDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.retrieve("google");
|
|
586
673
|
* ```
|
|
587
674
|
*/
|
|
588
675
|
retrieve(provider, options) {
|
|
@@ -591,6 +678,9 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
591
678
|
/**
|
|
592
679
|
* 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).
|
|
593
680
|
*
|
|
681
|
+
* Credential: `workspace_key`.
|
|
682
|
+
* - `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.
|
|
683
|
+
*
|
|
594
684
|
* @param provider - The sign-in provider: `google`, `github` or `apple`.
|
|
595
685
|
* @param params - `Auth.AuthConfigProviderUpdateParams`.
|
|
596
686
|
* @param options - Per-request options.
|
|
@@ -602,7 +692,7 @@ var AppAuthConfigProvidersResource = class extends APIResource {
|
|
|
602
692
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-auth-config-providers-provider
|
|
603
693
|
* @example
|
|
604
694
|
* ```ts
|
|
605
|
-
* const providerDetail = await auth.admin.app("
|
|
695
|
+
* const providerDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.providers.update("google", { config: {} });
|
|
606
696
|
* ```
|
|
607
697
|
*/
|
|
608
698
|
update(provider, params, options) {
|
|
@@ -617,6 +707,9 @@ var AppAuthConfigResource = class extends APIResource {
|
|
|
617
707
|
/**
|
|
618
708
|
* Get the per-app auth config (signup, signin, password policy, sessions).
|
|
619
709
|
*
|
|
710
|
+
* Credential: `workspace_key`.
|
|
711
|
+
* - `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.
|
|
712
|
+
*
|
|
620
713
|
* @param options - Per-request options.
|
|
621
714
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
622
715
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -626,7 +719,7 @@ var AppAuthConfigResource = class extends APIResource {
|
|
|
626
719
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-auth-config
|
|
627
720
|
* @example
|
|
628
721
|
* ```ts
|
|
629
|
-
* const authConfig = await auth.admin.app("
|
|
722
|
+
* const authConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.retrieve();
|
|
630
723
|
* ```
|
|
631
724
|
*/
|
|
632
725
|
retrieve(options) {
|
|
@@ -635,6 +728,9 @@ var AppAuthConfigResource = class extends APIResource {
|
|
|
635
728
|
/**
|
|
636
729
|
* Update the per-app auth config. Only fields you pass are changed.
|
|
637
730
|
*
|
|
731
|
+
* Credential: `workspace_key`.
|
|
732
|
+
* - `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.
|
|
733
|
+
*
|
|
638
734
|
* @param params - `Auth.AuthConfigUpdateParams`.
|
|
639
735
|
* @param options - Per-request options.
|
|
640
736
|
* @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.
|
|
@@ -647,7 +743,7 @@ var AppAuthConfigResource = class extends APIResource {
|
|
|
647
743
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-auth-config
|
|
648
744
|
* @example
|
|
649
745
|
* ```ts
|
|
650
|
-
* const authConfig = await auth.admin.app("
|
|
746
|
+
* const authConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.update({ access_token_minutes: 60 });
|
|
651
747
|
* ```
|
|
652
748
|
*/
|
|
653
749
|
update(params, options) {
|
|
@@ -666,6 +762,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
666
762
|
/**
|
|
667
763
|
* Create a new M2M client
|
|
668
764
|
*
|
|
765
|
+
* Credential: `workspace_key`.
|
|
766
|
+
* - `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.
|
|
767
|
+
*
|
|
669
768
|
* @param params - `Auth.CredentialCreateParams`.
|
|
670
769
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
671
770
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (missing or invalid name).
|
|
@@ -678,7 +777,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
678
777
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-credentials
|
|
679
778
|
* @example
|
|
680
779
|
* ```ts
|
|
681
|
-
* const m2mClientCreate = await auth.admin.app("
|
|
780
|
+
* const m2mClientCreate = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.create({ name: "CI Pipeline" });
|
|
682
781
|
* ```
|
|
683
782
|
*/
|
|
684
783
|
create(params, options) {
|
|
@@ -687,6 +786,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
687
786
|
/**
|
|
688
787
|
* Delete an M2M client
|
|
689
788
|
*
|
|
789
|
+
* Credential: `workspace_key`.
|
|
790
|
+
* - `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.
|
|
791
|
+
*
|
|
690
792
|
* @param clientId - Id of the client.
|
|
691
793
|
* @param options - Per-request options.
|
|
692
794
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -697,7 +799,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
697
799
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-credentials-client-id
|
|
698
800
|
* @example
|
|
699
801
|
* ```ts
|
|
700
|
-
* await auth.admin.app("
|
|
802
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.delete("m2m_a1b2c3d4e5f6");
|
|
701
803
|
* ```
|
|
702
804
|
*/
|
|
703
805
|
delete(clientId, options) {
|
|
@@ -706,6 +808,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
706
808
|
/**
|
|
707
809
|
* List M2M clients
|
|
708
810
|
*
|
|
811
|
+
* Credential: `workspace_key`.
|
|
812
|
+
* - `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.
|
|
813
|
+
*
|
|
709
814
|
* @param params - `Auth.CredentialListParams`.
|
|
710
815
|
* @param options - Per-request options.
|
|
711
816
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -716,10 +821,10 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
716
821
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-credentials
|
|
717
822
|
* @example
|
|
718
823
|
* ```ts
|
|
719
|
-
* for await (const credential of auth.admin.app("
|
|
824
|
+
* for await (const credential of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.list()) {
|
|
720
825
|
* console.log(credential);
|
|
721
826
|
* }
|
|
722
|
-
* const page = await auth.admin.app("
|
|
827
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.list({}, { timeout: 5_000 });
|
|
723
828
|
* ```
|
|
724
829
|
*/
|
|
725
830
|
list(params, options) {
|
|
@@ -728,6 +833,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
728
833
|
/**
|
|
729
834
|
* Get M2M client details
|
|
730
835
|
*
|
|
836
|
+
* Credential: `workspace_key`.
|
|
837
|
+
* - `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.
|
|
838
|
+
*
|
|
731
839
|
* @param clientId - Id of the client.
|
|
732
840
|
* @param options - Per-request options.
|
|
733
841
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -738,7 +846,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
738
846
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-credentials-client-id
|
|
739
847
|
* @example
|
|
740
848
|
* ```ts
|
|
741
|
-
* const m2mClientDetail = await auth.admin.app("
|
|
849
|
+
* const m2mClientDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.retrieve("m2m_a1b2c3d4e5f6");
|
|
742
850
|
* ```
|
|
743
851
|
*/
|
|
744
852
|
retrieve(clientId, options) {
|
|
@@ -747,6 +855,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
747
855
|
/**
|
|
748
856
|
* Rotate M2M client secret
|
|
749
857
|
*
|
|
858
|
+
* Credential: `workspace_key`.
|
|
859
|
+
* - `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.
|
|
860
|
+
*
|
|
750
861
|
* @param clientId - Id of the client.
|
|
751
862
|
* @param options - Per-request options.
|
|
752
863
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -757,7 +868,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
757
868
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-credentials-client-id-rotate
|
|
758
869
|
* @example
|
|
759
870
|
* ```ts
|
|
760
|
-
* const m2mRotateSecret = await auth.admin.app("
|
|
871
|
+
* const m2mRotateSecret = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.rotate("m2m_a1b2c3d4e5f6");
|
|
761
872
|
* ```
|
|
762
873
|
*/
|
|
763
874
|
rotate(clientId, options) {
|
|
@@ -766,6 +877,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
766
877
|
/**
|
|
767
878
|
* Update M2M client status
|
|
768
879
|
*
|
|
880
|
+
* Credential: `workspace_key`.
|
|
881
|
+
* - `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.
|
|
882
|
+
*
|
|
769
883
|
* @param clientId - Id of the client.
|
|
770
884
|
* @param params - `Auth.CredentialUpdateParams`.
|
|
771
885
|
* @param options - Per-request options.
|
|
@@ -778,7 +892,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
778
892
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-credentials-client-id
|
|
779
893
|
* @example
|
|
780
894
|
* ```ts
|
|
781
|
-
* const m2mClientDetail = await auth.admin.app("
|
|
895
|
+
* const m2mClientDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.update("m2m_a1b2c3d4e5f6", { is_active: true });
|
|
782
896
|
* ```
|
|
783
897
|
*/
|
|
784
898
|
update(clientId, params, options) {
|
|
@@ -787,6 +901,9 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
787
901
|
/**
|
|
788
902
|
* Set scopes for an M2M client
|
|
789
903
|
*
|
|
904
|
+
* Credential: `workspace_key`.
|
|
905
|
+
* - `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.
|
|
906
|
+
*
|
|
790
907
|
* @param clientId - Id of the client.
|
|
791
908
|
* @param params - `Auth.CredentialUpdateScopesParams`.
|
|
792
909
|
* @param options - Per-request options.
|
|
@@ -799,7 +916,7 @@ var AppCredentialsResource = class extends APIResource {
|
|
|
799
916
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-credentials-client-id-scopes
|
|
800
917
|
* @example
|
|
801
918
|
* ```ts
|
|
802
|
-
* const result = await auth.admin.app("
|
|
919
|
+
* const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.updateScopes("m2m_a1b2c3d4e5f6", { permissions: ["user.read", "app.read"] });
|
|
803
920
|
* ```
|
|
804
921
|
*/
|
|
805
922
|
updateScopes(clientId, params, options) {
|
|
@@ -836,6 +953,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
836
953
|
*
|
|
837
954
|
* 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).
|
|
838
955
|
*
|
|
956
|
+
* Credential: `workspace_key`.
|
|
957
|
+
* - `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.
|
|
958
|
+
*
|
|
839
959
|
* @param domainId - Id of the domain.
|
|
840
960
|
* @param params - `Auth.CustomDomainApplyParams`.
|
|
841
961
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -850,7 +970,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
850
970
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-custom-domains-domain-id-apply
|
|
851
971
|
* @example
|
|
852
972
|
* ```ts
|
|
853
|
-
* const customDomainApplyResult = await auth.admin.app("
|
|
973
|
+
* 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" });
|
|
854
974
|
* ```
|
|
855
975
|
*/
|
|
856
976
|
apply(domainId, params, options) {
|
|
@@ -861,6 +981,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
861
981
|
*
|
|
862
982
|
* 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.
|
|
863
983
|
*
|
|
984
|
+
* Credential: `workspace_key`.
|
|
985
|
+
* - `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.
|
|
986
|
+
*
|
|
864
987
|
* @param domainId - Id of the domain.
|
|
865
988
|
* @param options - Per-request options.
|
|
866
989
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `domainId` is not a UUID.
|
|
@@ -872,7 +995,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
872
995
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-custom-domains-domain-id-check
|
|
873
996
|
* @example
|
|
874
997
|
* ```ts
|
|
875
|
-
* const customDomain = await auth.admin.app("
|
|
998
|
+
* const customDomain = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.check("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
876
999
|
* ```
|
|
877
1000
|
*/
|
|
878
1001
|
check(domainId, options) {
|
|
@@ -883,6 +1006,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
883
1006
|
*
|
|
884
1007
|
* 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.
|
|
885
1008
|
*
|
|
1009
|
+
* Credential: `workspace_key`.
|
|
1010
|
+
* - `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.
|
|
1011
|
+
*
|
|
886
1012
|
* @param params - `Auth.CustomDomainCreateParams`.
|
|
887
1013
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
888
1014
|
* @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`).
|
|
@@ -895,7 +1021,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
895
1021
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-custom-domains
|
|
896
1022
|
* @example
|
|
897
1023
|
* ```ts
|
|
898
|
-
* const customDomain = await auth.admin.app("
|
|
1024
|
+
* const customDomain = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.create({ hostname: "auth.acme.com" });
|
|
899
1025
|
* ```
|
|
900
1026
|
*/
|
|
901
1027
|
create(params, options) {
|
|
@@ -906,6 +1032,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
906
1032
|
*
|
|
907
1033
|
* 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.
|
|
908
1034
|
*
|
|
1035
|
+
* Credential: `workspace_key`.
|
|
1036
|
+
* - `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.
|
|
1037
|
+
*
|
|
909
1038
|
* @param domainId - Id of the domain.
|
|
910
1039
|
* @param options - Per-request options.
|
|
911
1040
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `domainId` is not a UUID.
|
|
@@ -917,7 +1046,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
917
1046
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-custom-domains-domain-id
|
|
918
1047
|
* @example
|
|
919
1048
|
* ```ts
|
|
920
|
-
* await auth.admin.app("
|
|
1049
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
921
1050
|
* ```
|
|
922
1051
|
*/
|
|
923
1052
|
delete(domainId, options) {
|
|
@@ -928,6 +1057,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
928
1057
|
*
|
|
929
1058
|
* `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.
|
|
930
1059
|
*
|
|
1060
|
+
* Credential: `workspace_key`.
|
|
1061
|
+
* - `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.
|
|
1062
|
+
*
|
|
931
1063
|
* @param domainId - Id of the domain.
|
|
932
1064
|
* @param params - `Auth.CustomDomainExportParams`.
|
|
933
1065
|
* @param options - Per-request options.
|
|
@@ -940,7 +1072,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
940
1072
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-custom-domains-domain-id-export
|
|
941
1073
|
* @example
|
|
942
1074
|
* ```ts
|
|
943
|
-
* const response = await auth.admin.app("
|
|
1075
|
+
* const response = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.export("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { format: "bind" });
|
|
944
1076
|
* const text = await response.text();
|
|
945
1077
|
* ```
|
|
946
1078
|
*/
|
|
@@ -952,6 +1084,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
952
1084
|
*
|
|
953
1085
|
* 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.
|
|
954
1086
|
*
|
|
1087
|
+
* Credential: `workspace_key`.
|
|
1088
|
+
* - `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.
|
|
1089
|
+
*
|
|
955
1090
|
* @param options - Per-request options.
|
|
956
1091
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
957
1092
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -961,7 +1096,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
961
1096
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-custom-domains
|
|
962
1097
|
* @example
|
|
963
1098
|
* ```ts
|
|
964
|
-
* for await (const customDomain of auth.admin.app("
|
|
1099
|
+
* for await (const customDomain of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.list()) {
|
|
965
1100
|
* console.log(customDomain);
|
|
966
1101
|
* }
|
|
967
1102
|
* ```
|
|
@@ -974,6 +1109,9 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
974
1109
|
*
|
|
975
1110
|
* Reads stored state only; `POST …/check` runs a new DNS check.
|
|
976
1111
|
*
|
|
1112
|
+
* Credential: `workspace_key`.
|
|
1113
|
+
* - `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.
|
|
1114
|
+
*
|
|
977
1115
|
* @param domainId - Id of the domain.
|
|
978
1116
|
* @param options - Per-request options.
|
|
979
1117
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `domainId` is not a UUID.
|
|
@@ -985,7 +1123,7 @@ var AppCustomDomainsResource = class extends APIResource {
|
|
|
985
1123
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-custom-domains-domain-id
|
|
986
1124
|
* @example
|
|
987
1125
|
* ```ts
|
|
988
|
-
* const customDomain = await auth.admin.app("
|
|
1126
|
+
* const customDomain = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").customDomains.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
989
1127
|
* ```
|
|
990
1128
|
*/
|
|
991
1129
|
retrieve(domainId, options) {
|
|
@@ -996,6 +1134,9 @@ var AppEndUserInsightsUsersResource = class extends APIResource {
|
|
|
996
1134
|
/**
|
|
997
1135
|
* 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".
|
|
998
1136
|
*
|
|
1137
|
+
* Credential: `workspace_key`.
|
|
1138
|
+
* - `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.
|
|
1139
|
+
*
|
|
999
1140
|
* @param userId - Id of the user.
|
|
1000
1141
|
* @param options - Per-request options.
|
|
1001
1142
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `appId` or `userId` is not a UUID.
|
|
@@ -1007,7 +1148,7 @@ var AppEndUserInsightsUsersResource = class extends APIResource {
|
|
|
1007
1148
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-user-insights-users-user-id
|
|
1008
1149
|
* @example
|
|
1009
1150
|
* ```ts
|
|
1010
|
-
* const endUserDetailInsights = await auth.admin.app("
|
|
1151
|
+
* const endUserDetailInsights = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUserInsights.users.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1011
1152
|
* ```
|
|
1012
1153
|
*/
|
|
1013
1154
|
retrieve(userId, options) {
|
|
@@ -1022,6 +1163,9 @@ var AppEndUserInsightsResource = class extends APIResource {
|
|
|
1022
1163
|
/**
|
|
1023
1164
|
* 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.
|
|
1024
1165
|
*
|
|
1166
|
+
* Credential: `workspace_key`.
|
|
1167
|
+
* - `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.
|
|
1168
|
+
*
|
|
1025
1169
|
* @param options - Per-request options.
|
|
1026
1170
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `appId` is not a UUID.
|
|
1027
1171
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -1031,7 +1175,7 @@ var AppEndUserInsightsResource = class extends APIResource {
|
|
|
1031
1175
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-user-insights
|
|
1032
1176
|
* @example
|
|
1033
1177
|
* ```ts
|
|
1034
|
-
* const endUserInsights = await auth.admin.app("
|
|
1178
|
+
* const endUserInsights = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUserInsights.retrieve();
|
|
1035
1179
|
* ```
|
|
1036
1180
|
*/
|
|
1037
1181
|
retrieve(options) {
|
|
@@ -1042,6 +1186,9 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1042
1186
|
/**
|
|
1043
1187
|
* Add a contact for an end-user (unverified).
|
|
1044
1188
|
*
|
|
1189
|
+
* Credential: `workspace_key`.
|
|
1190
|
+
* - `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.
|
|
1191
|
+
*
|
|
1045
1192
|
* @param userId - Id of the user.
|
|
1046
1193
|
* @param params - `Auth.EndUserContactCreateParams`.
|
|
1047
1194
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -1055,7 +1202,7 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1055
1202
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-contacts
|
|
1056
1203
|
* @example
|
|
1057
1204
|
* ```ts
|
|
1058
|
-
* const accountContact = await auth.admin.app("
|
|
1205
|
+
* 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" });
|
|
1059
1206
|
* ```
|
|
1060
1207
|
*/
|
|
1061
1208
|
create(userId, params, options) {
|
|
@@ -1064,6 +1211,9 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1064
1211
|
/**
|
|
1065
1212
|
* Delete a contact from an end-user.
|
|
1066
1213
|
*
|
|
1214
|
+
* Credential: `workspace_key`.
|
|
1215
|
+
* - `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.
|
|
1216
|
+
*
|
|
1067
1217
|
* @param userId - Id of the user.
|
|
1068
1218
|
* @param contactId - Id of the contact.
|
|
1069
1219
|
* @param options - Per-request options.
|
|
@@ -1076,7 +1226,7 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1076
1226
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-end-users-user-id-contacts-contact-id
|
|
1077
1227
|
* @example
|
|
1078
1228
|
* ```ts
|
|
1079
|
-
* await auth.admin.app("
|
|
1229
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.contacts.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1080
1230
|
* ```
|
|
1081
1231
|
*/
|
|
1082
1232
|
delete(userId, contactId, options) {
|
|
@@ -1085,6 +1235,9 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1085
1235
|
/**
|
|
1086
1236
|
* List an end-user's contacts.
|
|
1087
1237
|
*
|
|
1238
|
+
* Credential: `workspace_key`.
|
|
1239
|
+
* - `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.
|
|
1240
|
+
*
|
|
1088
1241
|
* @param userId - Id of the user.
|
|
1089
1242
|
* @param options - Per-request options.
|
|
1090
1243
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1095,7 +1248,7 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1095
1248
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users-user-id-contacts
|
|
1096
1249
|
* @example
|
|
1097
1250
|
* ```ts
|
|
1098
|
-
* const accountContactList = await auth.admin.app("
|
|
1251
|
+
* const accountContactList = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.contacts.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1099
1252
|
* ```
|
|
1100
1253
|
*/
|
|
1101
1254
|
list(userId, options) {
|
|
@@ -1104,6 +1257,9 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1104
1257
|
/**
|
|
1105
1258
|
* Promote a verified contact to primary.
|
|
1106
1259
|
*
|
|
1260
|
+
* Credential: `workspace_key`.
|
|
1261
|
+
* - `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.
|
|
1262
|
+
*
|
|
1107
1263
|
* @param userId - Id of the user.
|
|
1108
1264
|
* @param contactId - Id of the contact.
|
|
1109
1265
|
* @param options - Per-request options.
|
|
@@ -1116,7 +1272,7 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1116
1272
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-contacts-contact-id-promote
|
|
1117
1273
|
* @example
|
|
1118
1274
|
* ```ts
|
|
1119
|
-
* await auth.admin.app("
|
|
1275
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.contacts.promote("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1120
1276
|
* ```
|
|
1121
1277
|
*/
|
|
1122
1278
|
promote(userId, contactId, options) {
|
|
@@ -1125,6 +1281,9 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1125
1281
|
/**
|
|
1126
1282
|
* Reissue a verification code for a contact.
|
|
1127
1283
|
*
|
|
1284
|
+
* Credential: `workspace_key`.
|
|
1285
|
+
* - `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.
|
|
1286
|
+
*
|
|
1128
1287
|
* @param userId - Id of the user.
|
|
1129
1288
|
* @param contactId - Id of the contact.
|
|
1130
1289
|
* @param options - Per-request options.
|
|
@@ -1137,7 +1296,7 @@ var AppEndUsersContactsResource = class extends APIResource {
|
|
|
1137
1296
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-contacts-contact-id-resend-verification
|
|
1138
1297
|
* @example
|
|
1139
1298
|
* ```ts
|
|
1140
|
-
* const issuedVerificationCode = await auth.admin.app("
|
|
1299
|
+
* const issuedVerificationCode = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.contacts.resendVerification("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1141
1300
|
* ```
|
|
1142
1301
|
*/
|
|
1143
1302
|
resendVerification(userId, contactId, options) {
|
|
@@ -1150,6 +1309,9 @@ var AppEndUsersImportsResource = class extends APIResource {
|
|
|
1150
1309
|
*
|
|
1151
1310
|
* 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.
|
|
1152
1311
|
*
|
|
1312
|
+
* Credential: `workspace_key`.
|
|
1313
|
+
* - `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.
|
|
1314
|
+
*
|
|
1153
1315
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
1154
1316
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Body is empty or contains no NDJSON rows.
|
|
1155
1317
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -1161,7 +1323,7 @@ var AppEndUsersImportsResource = class extends APIResource {
|
|
|
1161
1323
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-import
|
|
1162
1324
|
* @example
|
|
1163
1325
|
* ```ts
|
|
1164
|
-
* const importJob = await auth.admin.app("
|
|
1326
|
+
* const importJob = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.imports.create();
|
|
1165
1327
|
* ```
|
|
1166
1328
|
*/
|
|
1167
1329
|
create(options) {
|
|
@@ -1172,6 +1334,9 @@ var AppEndUsersImportsResource = class extends APIResource {
|
|
|
1172
1334
|
*
|
|
1173
1335
|
* `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.
|
|
1174
1336
|
*
|
|
1337
|
+
* Credential: `workspace_key`.
|
|
1338
|
+
* - `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.
|
|
1339
|
+
*
|
|
1175
1340
|
* @param jobId - Id of the job.
|
|
1176
1341
|
* @param options - Per-request options.
|
|
1177
1342
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -1182,7 +1347,7 @@ var AppEndUsersImportsResource = class extends APIResource {
|
|
|
1182
1347
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users-import-job-id
|
|
1183
1348
|
* @example
|
|
1184
1349
|
* ```ts
|
|
1185
|
-
* const importJob = await auth.admin.app("
|
|
1350
|
+
* const importJob = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.imports.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1186
1351
|
* ```
|
|
1187
1352
|
*/
|
|
1188
1353
|
retrieve(jobId, options) {
|
|
@@ -1193,6 +1358,9 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1193
1358
|
/**
|
|
1194
1359
|
* Pre-allocate an EndUser invite. Dispatches an invitation email via the workspace's Mail sender.
|
|
1195
1360
|
*
|
|
1361
|
+
* Credential: `workspace_key`.
|
|
1362
|
+
* - `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.
|
|
1363
|
+
*
|
|
1196
1364
|
* @param params - `Auth.EndUserInviteCreateParams`.
|
|
1197
1365
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
1198
1366
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown role, or maxUses / expiresInHours out of range.
|
|
@@ -1203,7 +1371,7 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1203
1371
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-invites
|
|
1204
1372
|
* @example
|
|
1205
1373
|
* ```ts
|
|
1206
|
-
* const endUserInvite = await auth.admin.app("
|
|
1374
|
+
* const endUserInvite = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.invites.create({ email: "alice@example.com" });
|
|
1207
1375
|
* ```
|
|
1208
1376
|
*/
|
|
1209
1377
|
create(params, options) {
|
|
@@ -1212,6 +1380,9 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1212
1380
|
/**
|
|
1213
1381
|
* Revoke an EndUser invite (soft-delete).
|
|
1214
1382
|
*
|
|
1383
|
+
* Credential: `workspace_key`.
|
|
1384
|
+
* - `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.
|
|
1385
|
+
*
|
|
1215
1386
|
* @param inviteId - Id of the invite.
|
|
1216
1387
|
* @param options - Per-request options.
|
|
1217
1388
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1222,7 +1393,7 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1222
1393
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-end-users-invites-invite-id
|
|
1223
1394
|
* @example
|
|
1224
1395
|
* ```ts
|
|
1225
|
-
* await auth.admin.app("
|
|
1396
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.invites.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1226
1397
|
* ```
|
|
1227
1398
|
*/
|
|
1228
1399
|
delete(inviteId, options) {
|
|
@@ -1231,6 +1402,9 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1231
1402
|
/**
|
|
1232
1403
|
* List EndUser invites for this app, newest first. Filter by `?status=`.
|
|
1233
1404
|
*
|
|
1405
|
+
* Credential: `workspace_key`.
|
|
1406
|
+
* - `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.
|
|
1407
|
+
*
|
|
1234
1408
|
* @param params - `Auth.EndUserInviteListParams`.
|
|
1235
1409
|
* @param options - Per-request options.
|
|
1236
1410
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `status` value.
|
|
@@ -1240,10 +1414,10 @@ var AppEndUsersInvitesResource = class extends APIResource {
|
|
|
1240
1414
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users-invites
|
|
1241
1415
|
* @example
|
|
1242
1416
|
* ```ts
|
|
1243
|
-
* for await (const invite of auth.admin.app("
|
|
1417
|
+
* for await (const invite of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.invites.list()) {
|
|
1244
1418
|
* console.log(invite);
|
|
1245
1419
|
* }
|
|
1246
|
-
* const page = await auth.admin.app("
|
|
1420
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.invites.list({}, { timeout: 5_000 });
|
|
1247
1421
|
* ```
|
|
1248
1422
|
*/
|
|
1249
1423
|
list(params, options) {
|
|
@@ -1256,6 +1430,9 @@ var AppEndUsersMfaResource = class extends APIResource {
|
|
|
1256
1430
|
*
|
|
1257
1431
|
* 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.
|
|
1258
1432
|
*
|
|
1433
|
+
* Credential: `workspace_key`.
|
|
1434
|
+
* - `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.
|
|
1435
|
+
*
|
|
1259
1436
|
* @param userId - Id of the user.
|
|
1260
1437
|
* @param options - Per-request options.
|
|
1261
1438
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -1266,7 +1443,7 @@ var AppEndUsersMfaResource = class extends APIResource {
|
|
|
1266
1443
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-mfa-require-reenrollment
|
|
1267
1444
|
* @example
|
|
1268
1445
|
* ```ts
|
|
1269
|
-
* const requireMfaReenrollment = await auth.admin.app("
|
|
1446
|
+
* const requireMfaReenrollment = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.mfa.requireReenrollment("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1270
1447
|
* ```
|
|
1271
1448
|
*/
|
|
1272
1449
|
requireReenrollment(userId, options) {
|
|
@@ -1277,6 +1454,9 @@ var AppEndUsersSessionsResource = class extends APIResource {
|
|
|
1277
1454
|
/**
|
|
1278
1455
|
* Revoke every active session for an end-user.
|
|
1279
1456
|
*
|
|
1457
|
+
* Credential: `workspace_key`.
|
|
1458
|
+
* - `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.
|
|
1459
|
+
*
|
|
1280
1460
|
* @param userId - Id of the user.
|
|
1281
1461
|
* @param options - Per-request options.
|
|
1282
1462
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1287,7 +1467,7 @@ var AppEndUsersSessionsResource = class extends APIResource {
|
|
|
1287
1467
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-sessions-revoke-all
|
|
1288
1468
|
* @example
|
|
1289
1469
|
* ```ts
|
|
1290
|
-
* await auth.admin.app("
|
|
1470
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.sessions.revokeAll("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1291
1471
|
* ```
|
|
1292
1472
|
*/
|
|
1293
1473
|
revokeAll(userId, options) {
|
|
@@ -1320,6 +1500,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1320
1500
|
*
|
|
1321
1501
|
* 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.
|
|
1322
1502
|
*
|
|
1503
|
+
* Credential: `workspace_key`.
|
|
1504
|
+
* - `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.
|
|
1505
|
+
*
|
|
1323
1506
|
* @param params - `Auth.EndUserBulkDeleteParams`.
|
|
1324
1507
|
* @param options - Per-request options.
|
|
1325
1508
|
* @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).
|
|
@@ -1331,7 +1514,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1331
1514
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-bulk-delete
|
|
1332
1515
|
* @example
|
|
1333
1516
|
* ```ts
|
|
1334
|
-
* const bulkAffectedUsers = await auth.admin.app("
|
|
1517
|
+
* const bulkAffectedUsers = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.bulkDelete({ selection: { mode: "ids" } });
|
|
1335
1518
|
* ```
|
|
1336
1519
|
*/
|
|
1337
1520
|
bulkDelete(params, options) {
|
|
@@ -1340,6 +1523,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1340
1523
|
/**
|
|
1341
1524
|
* Bulk-revoke sessions across a selection.
|
|
1342
1525
|
*
|
|
1526
|
+
* Credential: `workspace_key`.
|
|
1527
|
+
* - `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.
|
|
1528
|
+
*
|
|
1343
1529
|
* @param params - `Auth.EndUserBulkRevokeSessionsParams`.
|
|
1344
1530
|
* @param options - Per-request options.
|
|
1345
1531
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid `selection` body (including more than 5,000 ids).
|
|
@@ -1351,7 +1537,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1351
1537
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-bulk-revoke-sessions
|
|
1352
1538
|
* @example
|
|
1353
1539
|
* ```ts
|
|
1354
|
-
* const bulkAffectedUsers = await auth.admin.app("
|
|
1540
|
+
* const bulkAffectedUsers = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.bulkRevokeSessions({ selection: { mode: "ids" } });
|
|
1355
1541
|
* ```
|
|
1356
1542
|
*/
|
|
1357
1543
|
bulkRevokeSessions(params, options) {
|
|
@@ -1360,6 +1546,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1360
1546
|
/**
|
|
1361
1547
|
* Bulk-assign a role across a selection.
|
|
1362
1548
|
*
|
|
1549
|
+
* Credential: `workspace_key`.
|
|
1550
|
+
* - `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.
|
|
1551
|
+
*
|
|
1363
1552
|
* @param params - `Auth.EndUserBulkUpdateRoleParams`.
|
|
1364
1553
|
* @param options - Per-request options.
|
|
1365
1554
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid `selection` body or empty `roleName`.
|
|
@@ -1371,7 +1560,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1371
1560
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-bulk-update-role
|
|
1372
1561
|
* @example
|
|
1373
1562
|
* ```ts
|
|
1374
|
-
* const bulkAffectedUsers = await auth.admin.app("
|
|
1563
|
+
* const bulkAffectedUsers = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.bulkUpdateRole({ role_name: "member", selection: { mode: "ids" } });
|
|
1375
1564
|
* ```
|
|
1376
1565
|
*/
|
|
1377
1566
|
bulkUpdateRole(params, options) {
|
|
@@ -1380,6 +1569,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1380
1569
|
/**
|
|
1381
1570
|
* Bulk-update status across a selection.
|
|
1382
1571
|
*
|
|
1572
|
+
* Credential: `workspace_key`.
|
|
1573
|
+
* - `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.
|
|
1574
|
+
*
|
|
1383
1575
|
* @param params - `Auth.EndUserBulkUpdateStatusParams`.
|
|
1384
1576
|
* @param options - Per-request options.
|
|
1385
1577
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid `selection` body, or `status` is not one of active, suspended, deactivated.
|
|
@@ -1391,7 +1583,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1391
1583
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-bulk-update-status
|
|
1392
1584
|
* @example
|
|
1393
1585
|
* ```ts
|
|
1394
|
-
* const bulkAffectedUsers = await auth.admin.app("
|
|
1586
|
+
* const bulkAffectedUsers = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.bulkUpdateStatus({ selection: { mode: "ids" }, status: "suspended" });
|
|
1395
1587
|
* ```
|
|
1396
1588
|
*/
|
|
1397
1589
|
bulkUpdateStatus(params, options) {
|
|
@@ -1402,6 +1594,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1402
1594
|
*
|
|
1403
1595
|
* 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"`.
|
|
1404
1596
|
*
|
|
1597
|
+
* Credential: `workspace_key`.
|
|
1598
|
+
* - `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.
|
|
1599
|
+
*
|
|
1405
1600
|
* @param userId - Id of the user.
|
|
1406
1601
|
* @param options - Per-request options.
|
|
1407
1602
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1412,7 +1607,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1412
1607
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-end-users-user-id
|
|
1413
1608
|
* @example
|
|
1414
1609
|
* ```ts
|
|
1415
|
-
* await auth.admin.app("
|
|
1610
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1416
1611
|
* ```
|
|
1417
1612
|
*/
|
|
1418
1613
|
delete(userId, options) {
|
|
@@ -1423,6 +1618,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1423
1618
|
*
|
|
1424
1619
|
* 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.
|
|
1425
1620
|
*
|
|
1621
|
+
* Credential: `workspace_key`.
|
|
1622
|
+
* - `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.
|
|
1623
|
+
*
|
|
1426
1624
|
* @param params - `Auth.EndUserExportParams`.
|
|
1427
1625
|
* @param options - Per-request options.
|
|
1428
1626
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `format`.
|
|
@@ -1435,7 +1633,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1435
1633
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users-export
|
|
1436
1634
|
* @example
|
|
1437
1635
|
* ```ts
|
|
1438
|
-
* const response = await auth.admin.app("
|
|
1636
|
+
* const response = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.export();
|
|
1439
1637
|
* const text = await response.text();
|
|
1440
1638
|
* ```
|
|
1441
1639
|
*/
|
|
@@ -1445,6 +1643,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1445
1643
|
/**
|
|
1446
1644
|
* List end-users in this app (cursor-paginated).
|
|
1447
1645
|
*
|
|
1646
|
+
* Credential: `workspace_key`.
|
|
1647
|
+
* - `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.
|
|
1648
|
+
*
|
|
1448
1649
|
* @param params - `Auth.EndUserListParams`.
|
|
1449
1650
|
* @param options - Per-request options.
|
|
1450
1651
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `signal` / `sort` / `order`, or a `cursor` minted under a different ordering than the one requested.
|
|
@@ -1454,10 +1655,10 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1454
1655
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users
|
|
1455
1656
|
* @example
|
|
1456
1657
|
* ```ts
|
|
1457
|
-
* for await (const endUser of auth.admin.app("
|
|
1658
|
+
* for await (const endUser of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.list()) {
|
|
1458
1659
|
* console.log(endUser);
|
|
1459
1660
|
* }
|
|
1460
|
-
* const page = await auth.admin.app("
|
|
1661
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.list({}, { timeout: 5_000 });
|
|
1461
1662
|
* ```
|
|
1462
1663
|
*/
|
|
1463
1664
|
list(params, options) {
|
|
@@ -1466,6 +1667,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1466
1667
|
/**
|
|
1467
1668
|
* Resend verification to the primary email contact.
|
|
1468
1669
|
*
|
|
1670
|
+
* Credential: `workspace_key`.
|
|
1671
|
+
* - `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.
|
|
1672
|
+
*
|
|
1469
1673
|
* @param userId - Id of the user.
|
|
1470
1674
|
* @param options - Per-request options.
|
|
1471
1675
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1477,7 +1681,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1477
1681
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-end-users-user-id-resend-verification
|
|
1478
1682
|
* @example
|
|
1479
1683
|
* ```ts
|
|
1480
|
-
* const issuedVerificationCode = await auth.admin.app("
|
|
1684
|
+
* const issuedVerificationCode = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.resendVerification("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1481
1685
|
* ```
|
|
1482
1686
|
*/
|
|
1483
1687
|
resendVerification(userId, options) {
|
|
@@ -1486,6 +1690,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1486
1690
|
/**
|
|
1487
1691
|
* Get one end-user.
|
|
1488
1692
|
*
|
|
1693
|
+
* Credential: `workspace_key`.
|
|
1694
|
+
* - `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.
|
|
1695
|
+
*
|
|
1489
1696
|
* @param userId - Id of the user.
|
|
1490
1697
|
* @param options - Per-request options.
|
|
1491
1698
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1496,7 +1703,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1496
1703
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-end-users-user-id
|
|
1497
1704
|
* @example
|
|
1498
1705
|
* ```ts
|
|
1499
|
-
* const endUserSummary = await auth.admin.app("
|
|
1706
|
+
* const endUserSummary = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1500
1707
|
* ```
|
|
1501
1708
|
*/
|
|
1502
1709
|
retrieve(userId, options) {
|
|
@@ -1505,6 +1712,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1505
1712
|
/**
|
|
1506
1713
|
* Update end-user display name, primary email, or metadata keys (merged).
|
|
1507
1714
|
*
|
|
1715
|
+
* Credential: `workspace_key`.
|
|
1716
|
+
* - `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.
|
|
1717
|
+
*
|
|
1508
1718
|
* @param userId - Id of the user.
|
|
1509
1719
|
* @param params - `Auth.EndUserUpdateParams`.
|
|
1510
1720
|
* @param options - Per-request options.
|
|
@@ -1517,7 +1727,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1517
1727
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-end-users-user-id
|
|
1518
1728
|
* @example
|
|
1519
1729
|
* ```ts
|
|
1520
|
-
* const endUserSummary = await auth.admin.app("
|
|
1730
|
+
* const endUserSummary = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { display_name: "Ada Lovelace" });
|
|
1521
1731
|
* ```
|
|
1522
1732
|
*/
|
|
1523
1733
|
update(userId, params, options) {
|
|
@@ -1526,6 +1736,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1526
1736
|
/**
|
|
1527
1737
|
* Assign an end-user a role.
|
|
1528
1738
|
*
|
|
1739
|
+
* Credential: `workspace_key`.
|
|
1740
|
+
* - `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.
|
|
1741
|
+
*
|
|
1529
1742
|
* @param userId - Id of the user.
|
|
1530
1743
|
* @param params - `Auth.EndUserUpdateRoleParams`.
|
|
1531
1744
|
* @param options - Per-request options.
|
|
@@ -1538,7 +1751,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1538
1751
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-end-users-user-id-role
|
|
1539
1752
|
* @example
|
|
1540
1753
|
* ```ts
|
|
1541
|
-
* const endUserRoleAssignment = await auth.admin.app("
|
|
1754
|
+
* const endUserRoleAssignment = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.updateRole("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "admin" });
|
|
1542
1755
|
* ```
|
|
1543
1756
|
*/
|
|
1544
1757
|
updateRole(userId, params, options) {
|
|
@@ -1547,6 +1760,9 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1547
1760
|
/**
|
|
1548
1761
|
* Change end-user status (active / suspended / deactivated).
|
|
1549
1762
|
*
|
|
1763
|
+
* Credential: `workspace_key`.
|
|
1764
|
+
* - `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.
|
|
1765
|
+
*
|
|
1550
1766
|
* @param userId - Id of the user.
|
|
1551
1767
|
* @param params - `Auth.EndUserUpdateStatusParams`.
|
|
1552
1768
|
* @param options - Per-request options.
|
|
@@ -1559,7 +1775,7 @@ var AppEndUsersResource = class extends APIResource {
|
|
|
1559
1775
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-end-users-user-id-status
|
|
1560
1776
|
* @example
|
|
1561
1777
|
* ```ts
|
|
1562
|
-
* const endUserSummary = await auth.admin.app("
|
|
1778
|
+
* const endUserSummary = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.updateStatus("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { status: "suspended" });
|
|
1563
1779
|
* ```
|
|
1564
1780
|
*/
|
|
1565
1781
|
updateStatus(userId, params, options) {
|
|
@@ -1612,6 +1828,9 @@ var AppMembersResource = class extends APIResource {
|
|
|
1612
1828
|
/**
|
|
1613
1829
|
* Remove a member from the app
|
|
1614
1830
|
*
|
|
1831
|
+
* Credential: `workspace_key`.
|
|
1832
|
+
* - `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.
|
|
1833
|
+
*
|
|
1615
1834
|
* @param accountId - Id of the account.
|
|
1616
1835
|
* @param options - Per-request options.
|
|
1617
1836
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1622,7 +1841,7 @@ var AppMembersResource = class extends APIResource {
|
|
|
1622
1841
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-members-account-id
|
|
1623
1842
|
* @example
|
|
1624
1843
|
* ```ts
|
|
1625
|
-
* await auth.admin.app("
|
|
1844
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").members.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
1626
1845
|
* ```
|
|
1627
1846
|
*/
|
|
1628
1847
|
delete(accountId, options) {
|
|
@@ -1631,6 +1850,9 @@ var AppMembersResource = class extends APIResource {
|
|
|
1631
1850
|
/**
|
|
1632
1851
|
* List app members (PlatformUser view of EndUser memberships)
|
|
1633
1852
|
*
|
|
1853
|
+
* Credential: `workspace_key`.
|
|
1854
|
+
* - `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.
|
|
1855
|
+
*
|
|
1634
1856
|
* @param params - `Auth.MemberListParams`.
|
|
1635
1857
|
* @param options - Per-request options.
|
|
1636
1858
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid pagination cursor.
|
|
@@ -1642,10 +1864,10 @@ var AppMembersResource = class extends APIResource {
|
|
|
1642
1864
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-members
|
|
1643
1865
|
* @example
|
|
1644
1866
|
* ```ts
|
|
1645
|
-
* for await (const member of auth.admin.app("
|
|
1867
|
+
* for await (const member of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").members.list()) {
|
|
1646
1868
|
* console.log(member);
|
|
1647
1869
|
* }
|
|
1648
|
-
* const page = await auth.admin.app("
|
|
1870
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").members.list({}, { timeout: 5_000 });
|
|
1649
1871
|
* ```
|
|
1650
1872
|
*/
|
|
1651
1873
|
list(params, options) {
|
|
@@ -1666,6 +1888,9 @@ var AppNotificationSettingsResource = class extends APIResource {
|
|
|
1666
1888
|
*
|
|
1667
1889
|
* `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).
|
|
1668
1890
|
*
|
|
1891
|
+
* Credential: `workspace_key`.
|
|
1892
|
+
* - `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.
|
|
1893
|
+
*
|
|
1669
1894
|
* @param options - Per-request options.
|
|
1670
1895
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
1671
1896
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -1675,7 +1900,7 @@ var AppNotificationSettingsResource = class extends APIResource {
|
|
|
1675
1900
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-notification-settings
|
|
1676
1901
|
* @example
|
|
1677
1902
|
* ```ts
|
|
1678
|
-
* const appNotificationSettings = await auth.admin.app("
|
|
1903
|
+
* const appNotificationSettings = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").notificationSettings.retrieve();
|
|
1679
1904
|
* ```
|
|
1680
1905
|
*/
|
|
1681
1906
|
retrieve(options) {
|
|
@@ -1686,6 +1911,9 @@ var AppNotificationSettingsResource = class extends APIResource {
|
|
|
1686
1911
|
*
|
|
1687
1912
|
* 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.
|
|
1688
1913
|
*
|
|
1914
|
+
* Credential: `workspace_key`.
|
|
1915
|
+
* - `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.
|
|
1916
|
+
*
|
|
1689
1917
|
* @param params - `Auth.NotificationSettingUpdateParams`.
|
|
1690
1918
|
* @param options - Per-request options.
|
|
1691
1919
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid payload.
|
|
@@ -1698,7 +1926,7 @@ var AppNotificationSettingsResource = class extends APIResource {
|
|
|
1698
1926
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-notification-settings
|
|
1699
1927
|
* @example
|
|
1700
1928
|
* ```ts
|
|
1701
|
-
* const appNotificationSettings = await auth.admin.app("
|
|
1929
|
+
* const appNotificationSettings = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").notificationSettings.update({ default_sender_address: "ada@example.com" });
|
|
1702
1930
|
* ```
|
|
1703
1931
|
*/
|
|
1704
1932
|
update(params, options) {
|
|
@@ -1711,6 +1939,9 @@ var AppNotificationsResource = class extends APIResource {
|
|
|
1711
1939
|
*
|
|
1712
1940
|
* 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).
|
|
1713
1941
|
*
|
|
1942
|
+
* Credential: `workspace_key`.
|
|
1943
|
+
* - `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.
|
|
1944
|
+
*
|
|
1714
1945
|
* @param slot - The email to test.
|
|
1715
1946
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
1716
1947
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `slot`.
|
|
@@ -1726,7 +1957,7 @@ var AppNotificationsResource = class extends APIResource {
|
|
|
1726
1957
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-notifications-slot-test
|
|
1727
1958
|
* @example
|
|
1728
1959
|
* ```ts
|
|
1729
|
-
* const notificationTest = await auth.admin.app("
|
|
1960
|
+
* const notificationTest = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").notifications.test("verification");
|
|
1730
1961
|
* ```
|
|
1731
1962
|
*/
|
|
1732
1963
|
test(slot, options) {
|
|
@@ -1739,6 +1970,9 @@ var AppPermissionsEnforcementResource = class extends APIResource {
|
|
|
1739
1970
|
*
|
|
1740
1971
|
* 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.
|
|
1741
1972
|
*
|
|
1973
|
+
* Credential: `workspace_key`.
|
|
1974
|
+
* - `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.
|
|
1975
|
+
*
|
|
1742
1976
|
* @param options - Per-request options.
|
|
1743
1977
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
1744
1978
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -1748,7 +1982,7 @@ var AppPermissionsEnforcementResource = class extends APIResource {
|
|
|
1748
1982
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-permissions-enforcement
|
|
1749
1983
|
* @example
|
|
1750
1984
|
* ```ts
|
|
1751
|
-
* const enforcedPermissions = await auth.admin.app("
|
|
1985
|
+
* const enforcedPermissions = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").permissions.enforcement.list();
|
|
1752
1986
|
* ```
|
|
1753
1987
|
*/
|
|
1754
1988
|
list(options) {
|
|
@@ -1763,6 +1997,9 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1763
1997
|
/**
|
|
1764
1998
|
* Create a custom permission
|
|
1765
1999
|
*
|
|
2000
|
+
* Credential: `workspace_key`.
|
|
2001
|
+
* - `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.
|
|
2002
|
+
*
|
|
1766
2003
|
* @param params - `Auth.AppScopedPermissionCreateParams`.
|
|
1767
2004
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
1768
2005
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (`resource` / `action` segment format, or `description` over 256 chars).
|
|
@@ -1775,7 +2012,7 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1775
2012
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-permissions
|
|
1776
2013
|
* @example
|
|
1777
2014
|
* ```ts
|
|
1778
|
-
* const permission = await auth.admin.app("
|
|
2015
|
+
* const permission = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").permissions.create({ action: "read", resource: "project" });
|
|
1779
2016
|
* ```
|
|
1780
2017
|
*/
|
|
1781
2018
|
create(params, options) {
|
|
@@ -1784,6 +2021,9 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1784
2021
|
/**
|
|
1785
2022
|
* Delete a custom permission
|
|
1786
2023
|
*
|
|
2024
|
+
* Credential: `workspace_key`.
|
|
2025
|
+
* - `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.
|
|
2026
|
+
*
|
|
1787
2027
|
* @param permissionKey - Permission key, `resource.action` (e.g. `invoice.read`).
|
|
1788
2028
|
* @param options - Per-request options.
|
|
1789
2029
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `permissionKey` is not in `resource.action` format.
|
|
@@ -1795,7 +2035,7 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1795
2035
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-permissions-permission-key
|
|
1796
2036
|
* @example
|
|
1797
2037
|
* ```ts
|
|
1798
|
-
* await auth.admin.app("
|
|
2038
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").permissions.delete("invoice.read");
|
|
1799
2039
|
* ```
|
|
1800
2040
|
*/
|
|
1801
2041
|
delete(permissionKey, options) {
|
|
@@ -1804,6 +2044,9 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1804
2044
|
/**
|
|
1805
2045
|
* List all permissions (system + custom)
|
|
1806
2046
|
*
|
|
2047
|
+
* Credential: `workspace_key`.
|
|
2048
|
+
* - `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.
|
|
2049
|
+
*
|
|
1807
2050
|
* @param options - Per-request options.
|
|
1808
2051
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
1809
2052
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -1813,7 +2056,7 @@ var AppPermissionsResource = class extends APIResource {
|
|
|
1813
2056
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-permissions
|
|
1814
2057
|
* @example
|
|
1815
2058
|
* ```ts
|
|
1816
|
-
* const result = await auth.admin.app("
|
|
2059
|
+
* const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").permissions.list();
|
|
1817
2060
|
* ```
|
|
1818
2061
|
*/
|
|
1819
2062
|
list(options) {
|
|
@@ -1824,6 +2067,9 @@ var AppRolesPermissionsResource = class extends APIResource {
|
|
|
1824
2067
|
/**
|
|
1825
2068
|
* List all available permissions
|
|
1826
2069
|
*
|
|
2070
|
+
* Credential: `workspace_key`.
|
|
2071
|
+
* - `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.
|
|
2072
|
+
*
|
|
1827
2073
|
* @param options - Per-request options.
|
|
1828
2074
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
1829
2075
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -1833,7 +2079,7 @@ var AppRolesPermissionsResource = class extends APIResource {
|
|
|
1833
2079
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-roles-permissions
|
|
1834
2080
|
* @example
|
|
1835
2081
|
* ```ts
|
|
1836
|
-
* const result = await auth.admin.app("
|
|
2082
|
+
* const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.permissions.list();
|
|
1837
2083
|
* ```
|
|
1838
2084
|
*/
|
|
1839
2085
|
list(options) {
|
|
@@ -1848,6 +2094,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1848
2094
|
/**
|
|
1849
2095
|
* Assign a role to a user
|
|
1850
2096
|
*
|
|
2097
|
+
* Credential: `workspace_key`.
|
|
2098
|
+
* - `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.
|
|
2099
|
+
*
|
|
1851
2100
|
* @param params - `Auth.RoleAssignParams`.
|
|
1852
2101
|
* @param options - Per-request options.
|
|
1853
2102
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (`accountId` not a UUID, or `role` empty / over 64 chars).
|
|
@@ -1859,7 +2108,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1859
2108
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-roles-assign
|
|
1860
2109
|
* @example
|
|
1861
2110
|
* ```ts
|
|
1862
|
-
* const appMembership = await auth.admin.app("
|
|
2111
|
+
* const appMembership = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.assign({ account_id: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", role: "admin" });
|
|
1863
2112
|
* ```
|
|
1864
2113
|
*/
|
|
1865
2114
|
assign(params, options) {
|
|
@@ -1868,6 +2117,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1868
2117
|
/**
|
|
1869
2118
|
* Create a new role (no permissions yet — set them via PUT /:roleName/permissions)
|
|
1870
2119
|
*
|
|
2120
|
+
* Credential: `workspace_key`.
|
|
2121
|
+
* - `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.
|
|
2122
|
+
*
|
|
1871
2123
|
* @param params - `Auth.AppScopedRoleCreateParams`.
|
|
1872
2124
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
1873
2125
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (`name` 1-64 chars, `description` up to 256).
|
|
@@ -1880,7 +2132,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1880
2132
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-roles
|
|
1881
2133
|
* @example
|
|
1882
2134
|
* ```ts
|
|
1883
|
-
* const role = await auth.admin.app("
|
|
2135
|
+
* const role = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.create({ name: "editor" });
|
|
1884
2136
|
* ```
|
|
1885
2137
|
*/
|
|
1886
2138
|
create(params, options) {
|
|
@@ -1889,6 +2141,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1889
2141
|
/**
|
|
1890
2142
|
* Delete a custom role
|
|
1891
2143
|
*
|
|
2144
|
+
* Credential: `workspace_key`.
|
|
2145
|
+
* - `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.
|
|
2146
|
+
*
|
|
1892
2147
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
1893
2148
|
* @param options - Per-request options.
|
|
1894
2149
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1900,7 +2155,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1900
2155
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-roles-role-name
|
|
1901
2156
|
* @example
|
|
1902
2157
|
* ```ts
|
|
1903
|
-
* await auth.admin.app("
|
|
2158
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.delete("admin");
|
|
1904
2159
|
* ```
|
|
1905
2160
|
*/
|
|
1906
2161
|
delete(roleName, options) {
|
|
@@ -1909,6 +2164,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1909
2164
|
/**
|
|
1910
2165
|
* List all roles in an app. Filter by `?search=` on the role name.
|
|
1911
2166
|
*
|
|
2167
|
+
* Credential: `workspace_key`.
|
|
2168
|
+
* - `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.
|
|
2169
|
+
*
|
|
1912
2170
|
* @param params - `Auth.AppScopedRoleListParams`.
|
|
1913
2171
|
* @param options - Per-request options.
|
|
1914
2172
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Malformed `cursor`.
|
|
@@ -1920,10 +2178,10 @@ var AppRolesResource = class extends APIResource {
|
|
|
1920
2178
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-roles
|
|
1921
2179
|
* @example
|
|
1922
2180
|
* ```ts
|
|
1923
|
-
* for await (const role of auth.admin.app("
|
|
2181
|
+
* for await (const role of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.list()) {
|
|
1924
2182
|
* console.log(role);
|
|
1925
2183
|
* }
|
|
1926
|
-
* const page = await auth.admin.app("
|
|
2184
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.list({}, { timeout: 5_000 });
|
|
1927
2185
|
* ```
|
|
1928
2186
|
*/
|
|
1929
2187
|
list(params, options) {
|
|
@@ -1932,6 +2190,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1932
2190
|
/**
|
|
1933
2191
|
* Get role details with permissions
|
|
1934
2192
|
*
|
|
2193
|
+
* Credential: `workspace_key`.
|
|
2194
|
+
* - `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.
|
|
2195
|
+
*
|
|
1935
2196
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
1936
2197
|
* @param options - Per-request options.
|
|
1937
2198
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -1942,7 +2203,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1942
2203
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-roles-role-name
|
|
1943
2204
|
* @example
|
|
1944
2205
|
* ```ts
|
|
1945
|
-
* const roleWithPermissions = await auth.admin.app("
|
|
2206
|
+
* const roleWithPermissions = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.retrieve("admin");
|
|
1946
2207
|
* ```
|
|
1947
2208
|
*/
|
|
1948
2209
|
retrieve(roleName, options) {
|
|
@@ -1951,6 +2212,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1951
2212
|
/**
|
|
1952
2213
|
* Update role name or description
|
|
1953
2214
|
*
|
|
2215
|
+
* Credential: `workspace_key`.
|
|
2216
|
+
* - `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.
|
|
2217
|
+
*
|
|
1954
2218
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
1955
2219
|
* @param params - `Auth.AppScopedRoleUpdateParams`.
|
|
1956
2220
|
* @param options - Per-request options.
|
|
@@ -1963,7 +2227,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1963
2227
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-roles-role-name
|
|
1964
2228
|
* @example
|
|
1965
2229
|
* ```ts
|
|
1966
|
-
* const role = await auth.admin.app("
|
|
2230
|
+
* const role = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.update("admin", { description: "Updated description" });
|
|
1967
2231
|
* ```
|
|
1968
2232
|
*/
|
|
1969
2233
|
update(roleName, params, options) {
|
|
@@ -1972,6 +2236,9 @@ var AppRolesResource = class extends APIResource {
|
|
|
1972
2236
|
/**
|
|
1973
2237
|
* Set permissions for a role (caller-narrowed: caller must hold every requested permission)
|
|
1974
2238
|
*
|
|
2239
|
+
* Credential: `workspace_key`.
|
|
2240
|
+
* - `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.
|
|
2241
|
+
*
|
|
1975
2242
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
1976
2243
|
* @param params - `Auth.AppScopedRoleUpdatePermissionsParams`.
|
|
1977
2244
|
* @param options - Per-request options.
|
|
@@ -1984,7 +2251,7 @@ var AppRolesResource = class extends APIResource {
|
|
|
1984
2251
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-roles-role-name-permissions
|
|
1985
2252
|
* @example
|
|
1986
2253
|
* ```ts
|
|
1987
|
-
* const result = await auth.admin.app("
|
|
2254
|
+
* const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").roles.updatePermissions("admin", { permissions: ["user.read", "role.create"] });
|
|
1988
2255
|
* ```
|
|
1989
2256
|
*/
|
|
1990
2257
|
updatePermissions(roleName, params, options) {
|
|
@@ -2021,6 +2288,9 @@ var AppSetupStatusResource = class extends APIResource {
|
|
|
2021
2288
|
*
|
|
2022
2289
|
* 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 }`.
|
|
2023
2290
|
*
|
|
2291
|
+
* Credential: `workspace_key`.
|
|
2292
|
+
* - `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.
|
|
2293
|
+
*
|
|
2024
2294
|
* @param options - Per-request options.
|
|
2025
2295
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
2026
2296
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -2030,7 +2300,7 @@ var AppSetupStatusResource = class extends APIResource {
|
|
|
2030
2300
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-setup-status
|
|
2031
2301
|
* @example
|
|
2032
2302
|
* ```ts
|
|
2033
|
-
* const setupStatus = await auth.admin.app("
|
|
2303
|
+
* const setupStatus = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").setupStatus.retrieve();
|
|
2034
2304
|
* ```
|
|
2035
2305
|
*/
|
|
2036
2306
|
retrieve(options) {
|
|
@@ -2043,6 +2313,9 @@ var AppSignInTestsResource = class extends APIResource {
|
|
|
2043
2313
|
*
|
|
2044
2314
|
* 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.
|
|
2045
2315
|
*
|
|
2316
|
+
* Credential: `workspace_key`.
|
|
2317
|
+
* - `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.
|
|
2318
|
+
*
|
|
2046
2319
|
* @param params - `Auth.SignInTestCreateParams`.
|
|
2047
2320
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2048
2321
|
* @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`).
|
|
@@ -2055,7 +2328,7 @@ var AppSignInTestsResource = class extends APIResource {
|
|
|
2055
2328
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-sign-in-tests
|
|
2056
2329
|
* @example
|
|
2057
2330
|
* ```ts
|
|
2058
|
-
* const signInTest = await auth.admin.app("
|
|
2331
|
+
* const signInTest = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").signInTests.create({ method: "oauth" });
|
|
2059
2332
|
* ```
|
|
2060
2333
|
*/
|
|
2061
2334
|
create(params, options) {
|
|
@@ -2066,6 +2339,9 @@ var AppSignInTestsResource = class extends APIResource {
|
|
|
2066
2339
|
*
|
|
2067
2340
|
* 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.
|
|
2068
2341
|
*
|
|
2342
|
+
* Credential: `workspace_key`.
|
|
2343
|
+
* - `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.
|
|
2344
|
+
*
|
|
2069
2345
|
* @param testId - Id of the test.
|
|
2070
2346
|
* @param options - Per-request options.
|
|
2071
2347
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `testId` is not a UUID.
|
|
@@ -2077,7 +2353,7 @@ var AppSignInTestsResource = class extends APIResource {
|
|
|
2077
2353
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-sign-in-tests-test-id
|
|
2078
2354
|
* @example
|
|
2079
2355
|
* ```ts
|
|
2080
|
-
* const signInTest = await auth.admin.app("
|
|
2356
|
+
* const signInTest = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").signInTests.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2081
2357
|
* ```
|
|
2082
2358
|
*/
|
|
2083
2359
|
retrieve(testId, options) {
|
|
@@ -2090,6 +2366,9 @@ var AppTenantApiKeysConfigResource = class extends APIResource {
|
|
|
2090
2366
|
*
|
|
2091
2367
|
* Includes the platform kill switch `suspended`. Requires `auth.read` on the app.
|
|
2092
2368
|
*
|
|
2369
|
+
* Credential: `workspace_key`.
|
|
2370
|
+
* - `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.
|
|
2371
|
+
*
|
|
2093
2372
|
* @param options - Per-request options.
|
|
2094
2373
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
2095
2374
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app.
|
|
@@ -2099,7 +2378,7 @@ var AppTenantApiKeysConfigResource = class extends APIResource {
|
|
|
2099
2378
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenant-api-keys-config
|
|
2100
2379
|
* @example
|
|
2101
2380
|
* ```ts
|
|
2102
|
-
* const tenantApiKeysConfig = await auth.admin.app("
|
|
2381
|
+
* const tenantApiKeysConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenantApiKeys.config.retrieve();
|
|
2103
2382
|
* ```
|
|
2104
2383
|
*/
|
|
2105
2384
|
retrieve(options) {
|
|
@@ -2110,6 +2389,9 @@ var AppTenantApiKeysConfigResource = class extends APIResource {
|
|
|
2110
2389
|
*
|
|
2111
2390
|
* 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.
|
|
2112
2391
|
*
|
|
2392
|
+
* Credential: `workspace_key`.
|
|
2393
|
+
* - `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.
|
|
2394
|
+
*
|
|
2113
2395
|
* @param params - `Auth.AppScopedTenantApiKeyConfigUpdateParams`.
|
|
2114
2396
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2115
2397
|
* @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`.
|
|
@@ -2122,7 +2404,7 @@ var AppTenantApiKeysConfigResource = class extends APIResource {
|
|
|
2122
2404
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-tenant-api-keys-config
|
|
2123
2405
|
* @example
|
|
2124
2406
|
* ```ts
|
|
2125
|
-
* const tenantApiKeysConfig = await auth.admin.app("
|
|
2407
|
+
* const tenantApiKeysConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenantApiKeys.config.update({ default_expiry_days: 7 });
|
|
2126
2408
|
* ```
|
|
2127
2409
|
*/
|
|
2128
2410
|
update(params, options) {
|
|
@@ -2139,6 +2421,9 @@ var AppTenantApiKeysResource = class extends APIResource {
|
|
|
2139
2421
|
*
|
|
2140
2422
|
* 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.
|
|
2141
2423
|
*
|
|
2424
|
+
* Credential: `workspace_key`.
|
|
2425
|
+
* - `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.
|
|
2426
|
+
*
|
|
2142
2427
|
* @param keyId - Key id (UUID) or display id (`tak_…`).
|
|
2143
2428
|
* @param options - Per-request options.
|
|
2144
2429
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -2149,7 +2434,7 @@ var AppTenantApiKeysResource = class extends APIResource {
|
|
|
2149
2434
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-tenant-api-keys-key-id
|
|
2150
2435
|
* @example
|
|
2151
2436
|
* ```ts
|
|
2152
|
-
* await auth.admin.app("
|
|
2437
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenantApiKeys.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2153
2438
|
* ```
|
|
2154
2439
|
*/
|
|
2155
2440
|
delete(keyId, options) {
|
|
@@ -2160,6 +2445,9 @@ var AppTenantApiKeysResource = class extends APIResource {
|
|
|
2160
2445
|
*
|
|
2161
2446
|
* 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.
|
|
2162
2447
|
*
|
|
2448
|
+
* Credential: `workspace_key`.
|
|
2449
|
+
* - `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.
|
|
2450
|
+
*
|
|
2163
2451
|
* @param params - `Auth.AppScopedTenantApiKeyListParams`.
|
|
2164
2452
|
* @param options - Per-request options.
|
|
2165
2453
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `status` or malformed `cursor`.
|
|
@@ -2171,10 +2459,10 @@ var AppTenantApiKeysResource = class extends APIResource {
|
|
|
2171
2459
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenant-api-keys
|
|
2172
2460
|
* @example
|
|
2173
2461
|
* ```ts
|
|
2174
|
-
* for await (const tenantApiKey of auth.admin.app("
|
|
2462
|
+
* for await (const tenantApiKey of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenantApiKeys.list()) {
|
|
2175
2463
|
* console.log(tenantApiKey);
|
|
2176
2464
|
* }
|
|
2177
|
-
* const page = await auth.admin.app("
|
|
2465
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenantApiKeys.list({}, { timeout: 5_000 });
|
|
2178
2466
|
* ```
|
|
2179
2467
|
*/
|
|
2180
2468
|
list(params, options) {
|
|
@@ -2185,6 +2473,9 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2185
2473
|
/**
|
|
2186
2474
|
* Invite an email address into a tenant. Returns the plaintext code once; only its SHA-256 digest is stored.
|
|
2187
2475
|
*
|
|
2476
|
+
* Credential: `workspace_key`.
|
|
2477
|
+
* - `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.
|
|
2478
|
+
*
|
|
2188
2479
|
* @param tenantId - Id of the tenant.
|
|
2189
2480
|
* @param params - `Auth.AppScopedTenantInviteCreateParams`.
|
|
2190
2481
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2197,7 +2488,7 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2197
2488
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-tenants-tenant-id-invites
|
|
2198
2489
|
* @example
|
|
2199
2490
|
* ```ts
|
|
2200
|
-
* const createTenantInvite = await auth.admin.app("
|
|
2491
|
+
* 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" });
|
|
2201
2492
|
* ```
|
|
2202
2493
|
*/
|
|
2203
2494
|
create(tenantId, params, options) {
|
|
@@ -2206,6 +2497,9 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2206
2497
|
/**
|
|
2207
2498
|
* Revoke a pending invite. Idempotent — a second revoke is a 204 no-op and fires no second webhook.
|
|
2208
2499
|
*
|
|
2500
|
+
* Credential: `workspace_key`.
|
|
2501
|
+
* - `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.
|
|
2502
|
+
*
|
|
2209
2503
|
* @param tenantId - Id of the tenant.
|
|
2210
2504
|
* @param inviteId - Id of the invite.
|
|
2211
2505
|
* @param options - Per-request options.
|
|
@@ -2216,7 +2510,7 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2216
2510
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-tenants-tenant-id-invites-invite-id
|
|
2217
2511
|
* @example
|
|
2218
2512
|
* ```ts
|
|
2219
|
-
* await auth.admin.app("
|
|
2513
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.invites.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2220
2514
|
* ```
|
|
2221
2515
|
*/
|
|
2222
2516
|
delete(tenantId, inviteId, options) {
|
|
@@ -2225,6 +2519,9 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2225
2519
|
/**
|
|
2226
2520
|
* List a tenant's invites, newest first. Optional `?status=pending|revoked|expired|used`. Codes are never returned.
|
|
2227
2521
|
*
|
|
2522
|
+
* Credential: `workspace_key`.
|
|
2523
|
+
* - `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.
|
|
2524
|
+
*
|
|
2228
2525
|
* @param tenantId - Id of the tenant.
|
|
2229
2526
|
* @param params - `Auth.AppScopedTenantInviteListParams`.
|
|
2230
2527
|
* @param options - Per-request options.
|
|
@@ -2236,10 +2533,10 @@ var AppTenantsInvitesResource = class extends APIResource {
|
|
|
2236
2533
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenants-tenant-id-invites
|
|
2237
2534
|
* @example
|
|
2238
2535
|
* ```ts
|
|
2239
|
-
* for await (const invite of auth.admin.app("
|
|
2536
|
+
* for await (const invite of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.invites.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
|
|
2240
2537
|
* console.log(invite);
|
|
2241
2538
|
* }
|
|
2242
|
-
* const page = await auth.admin.app("
|
|
2539
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.invites.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
|
|
2243
2540
|
* ```
|
|
2244
2541
|
*/
|
|
2245
2542
|
list(tenantId, params, options) {
|
|
@@ -2250,6 +2547,9 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2250
2547
|
/**
|
|
2251
2548
|
* Add a member to a tenant.
|
|
2252
2549
|
*
|
|
2550
|
+
* Credential: `workspace_key`.
|
|
2551
|
+
* - `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.
|
|
2552
|
+
*
|
|
2253
2553
|
* @param tenantId - Id of the tenant.
|
|
2254
2554
|
* @param params - `Auth.AppScopedTenantMemberCreateParams`.
|
|
2255
2555
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2263,7 +2563,7 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2263
2563
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-tenants-tenant-id-members
|
|
2264
2564
|
* @example
|
|
2265
2565
|
* ```ts
|
|
2266
|
-
* const addMember = await auth.admin.app("
|
|
2566
|
+
* const addMember = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.members.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "member" });
|
|
2267
2567
|
* ```
|
|
2268
2568
|
*/
|
|
2269
2569
|
create(tenantId, params, options) {
|
|
@@ -2272,6 +2572,9 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2272
2572
|
/**
|
|
2273
2573
|
* Remove a member from a tenant.
|
|
2274
2574
|
*
|
|
2575
|
+
* Credential: `workspace_key`.
|
|
2576
|
+
* - `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.
|
|
2577
|
+
*
|
|
2275
2578
|
* @param tenantId - Id of the tenant.
|
|
2276
2579
|
* @param accountId - Id of the account.
|
|
2277
2580
|
* @param options - Per-request options.
|
|
@@ -2283,7 +2586,7 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2283
2586
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-tenants-tenant-id-members-account-id
|
|
2284
2587
|
* @example
|
|
2285
2588
|
* ```ts
|
|
2286
|
-
* await auth.admin.app("
|
|
2589
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.members.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2287
2590
|
* ```
|
|
2288
2591
|
*/
|
|
2289
2592
|
delete(tenantId, accountId, options) {
|
|
@@ -2292,6 +2595,9 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2292
2595
|
/**
|
|
2293
2596
|
* List members of a tenant, newest membership first. Filter by `?search=` and/or `?role=`.
|
|
2294
2597
|
*
|
|
2598
|
+
* Credential: `workspace_key`.
|
|
2599
|
+
* - `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.
|
|
2600
|
+
*
|
|
2295
2601
|
* @param tenantId - Id of the tenant.
|
|
2296
2602
|
* @param params - `Auth.AppScopedTenantMemberListParams`.
|
|
2297
2603
|
* @param options - Per-request options.
|
|
@@ -2304,10 +2610,10 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2304
2610
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenants-tenant-id-members
|
|
2305
2611
|
* @example
|
|
2306
2612
|
* ```ts
|
|
2307
|
-
* for await (const member of auth.admin.app("
|
|
2613
|
+
* for await (const member of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.members.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
|
|
2308
2614
|
* console.log(member);
|
|
2309
2615
|
* }
|
|
2310
|
-
* const page = await auth.admin.app("
|
|
2616
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.members.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
|
|
2311
2617
|
* ```
|
|
2312
2618
|
*/
|
|
2313
2619
|
list(tenantId, params, options) {
|
|
@@ -2316,6 +2622,9 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2316
2622
|
/**
|
|
2317
2623
|
* Change a member's role inside a tenant.
|
|
2318
2624
|
*
|
|
2625
|
+
* Credential: `workspace_key`.
|
|
2626
|
+
* - `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.
|
|
2627
|
+
*
|
|
2319
2628
|
* @param tenantId - Id of the tenant.
|
|
2320
2629
|
* @param accountId - Id of the account.
|
|
2321
2630
|
* @param params - `Auth.AppScopedTenantMemberUpdateParams`.
|
|
@@ -2329,7 +2638,7 @@ var AppTenantsMembersResource = class extends APIResource {
|
|
|
2329
2638
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-tenants-tenant-id-members-account-id
|
|
2330
2639
|
* @example
|
|
2331
2640
|
* ```ts
|
|
2332
|
-
* const tenantMembership = await auth.admin.app("
|
|
2641
|
+
* 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" });
|
|
2333
2642
|
* ```
|
|
2334
2643
|
*/
|
|
2335
2644
|
update(tenantId, accountId, params, options) {
|
|
@@ -2348,6 +2657,9 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2348
2657
|
/**
|
|
2349
2658
|
* Create a tenant in this app. Auth-admin lane; requires auth.tenant.create on the app URN.
|
|
2350
2659
|
*
|
|
2660
|
+
* Credential: `workspace_key`.
|
|
2661
|
+
* - `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.
|
|
2662
|
+
*
|
|
2351
2663
|
* @param params - `Auth.AppScopedTenantCreateParams`.
|
|
2352
2664
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2353
2665
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid body, empty `displayName`, or `slug` not 1-64 chars of [a-z0-9-].
|
|
@@ -2360,7 +2672,7 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2360
2672
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-tenants
|
|
2361
2673
|
* @example
|
|
2362
2674
|
* ```ts
|
|
2363
|
-
* const tenant = await auth.admin.app("
|
|
2675
|
+
* const tenant = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.create({ display_name: "Acme Co" });
|
|
2364
2676
|
* ```
|
|
2365
2677
|
*/
|
|
2366
2678
|
create(params, options) {
|
|
@@ -2369,6 +2681,9 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2369
2681
|
/**
|
|
2370
2682
|
* Delete a tenant.
|
|
2371
2683
|
*
|
|
2684
|
+
* Credential: `workspace_key`.
|
|
2685
|
+
* - `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.
|
|
2686
|
+
*
|
|
2372
2687
|
* @param tenantId - Id of the tenant.
|
|
2373
2688
|
* @param options - Per-request options.
|
|
2374
2689
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -2379,7 +2694,7 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2379
2694
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-tenants-tenant-id
|
|
2380
2695
|
* @example
|
|
2381
2696
|
* ```ts
|
|
2382
|
-
* await auth.admin.app("
|
|
2697
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2383
2698
|
* ```
|
|
2384
2699
|
*/
|
|
2385
2700
|
delete(tenantId, options) {
|
|
@@ -2388,6 +2703,9 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2388
2703
|
/**
|
|
2389
2704
|
* List tenants in this app, paginated by created_at desc.
|
|
2390
2705
|
*
|
|
2706
|
+
* Credential: `workspace_key`.
|
|
2707
|
+
* - `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.
|
|
2708
|
+
*
|
|
2391
2709
|
* @param params - `Auth.AppScopedTenantListParams`.
|
|
2392
2710
|
* @param options - Per-request options.
|
|
2393
2711
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `status` value.
|
|
@@ -2399,10 +2717,10 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2399
2717
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenants
|
|
2400
2718
|
* @example
|
|
2401
2719
|
* ```ts
|
|
2402
|
-
* for await (const tenant of auth.admin.app("
|
|
2720
|
+
* for await (const tenant of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.list()) {
|
|
2403
2721
|
* console.log(tenant);
|
|
2404
2722
|
* }
|
|
2405
|
-
* const page = await auth.admin.app("
|
|
2723
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.list({}, { timeout: 5_000 });
|
|
2406
2724
|
* ```
|
|
2407
2725
|
*/
|
|
2408
2726
|
list(params, options) {
|
|
@@ -2411,6 +2729,9 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2411
2729
|
/**
|
|
2412
2730
|
* Get a single tenant by id or display id.
|
|
2413
2731
|
*
|
|
2732
|
+
* Credential: `workspace_key`.
|
|
2733
|
+
* - `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.
|
|
2734
|
+
*
|
|
2414
2735
|
* @param tenantId - Id of the tenant.
|
|
2415
2736
|
* @param options - Per-request options.
|
|
2416
2737
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -2421,7 +2742,7 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2421
2742
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-tenants-tenant-id
|
|
2422
2743
|
* @example
|
|
2423
2744
|
* ```ts
|
|
2424
|
-
* const tenant = await auth.admin.app("
|
|
2745
|
+
* const tenant = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2425
2746
|
* ```
|
|
2426
2747
|
*/
|
|
2427
2748
|
retrieve(tenantId, options) {
|
|
@@ -2430,6 +2751,9 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2430
2751
|
/**
|
|
2431
2752
|
* Update a tenant (display_name, slug, status, metadata).
|
|
2432
2753
|
*
|
|
2754
|
+
* Credential: `workspace_key`.
|
|
2755
|
+
* - `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.
|
|
2756
|
+
*
|
|
2433
2757
|
* @param tenantId - Id of the tenant.
|
|
2434
2758
|
* @param params - `Auth.AppScopedTenantUpdateParams`.
|
|
2435
2759
|
* @param options - Per-request options.
|
|
@@ -2443,7 +2767,7 @@ var AppTenantsResource = class extends APIResource {
|
|
|
2443
2767
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-tenants-tenant-id
|
|
2444
2768
|
* @example
|
|
2445
2769
|
* ```ts
|
|
2446
|
-
* const tenant = await auth.admin.app("
|
|
2770
|
+
* const tenant = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").tenants.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { display_name: "Acme Inc" });
|
|
2447
2771
|
* ```
|
|
2448
2772
|
*/
|
|
2449
2773
|
update(tenantId, params, options) {
|
|
@@ -2454,6 +2778,9 @@ var AppUnverifiedAccountExpiryResource = class extends APIResource {
|
|
|
2454
2778
|
/**
|
|
2455
2779
|
* Get the unverified-account expiry setting and how many accounts it deleted in the last 30 days.
|
|
2456
2780
|
*
|
|
2781
|
+
* Credential: `workspace_key`.
|
|
2782
|
+
* - `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.
|
|
2783
|
+
*
|
|
2457
2784
|
* @param options - Per-request options.
|
|
2458
2785
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
2459
2786
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -2463,7 +2790,7 @@ var AppUnverifiedAccountExpiryResource = class extends APIResource {
|
|
|
2463
2790
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-unverified-account-expiry
|
|
2464
2791
|
* @example
|
|
2465
2792
|
* ```ts
|
|
2466
|
-
* const unverifiedAccountExpiryStatus = await auth.admin.app("
|
|
2793
|
+
* const unverifiedAccountExpiryStatus = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").unverifiedAccountExpiry.retrieve();
|
|
2467
2794
|
* ```
|
|
2468
2795
|
*/
|
|
2469
2796
|
retrieve(options) {
|
|
@@ -2474,6 +2801,9 @@ var AppUnverifiedAccountExpiryResource = class extends APIResource {
|
|
|
2474
2801
|
*
|
|
2475
2802
|
* 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.
|
|
2476
2803
|
*
|
|
2804
|
+
* Credential: `workspace_key`.
|
|
2805
|
+
* - `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.
|
|
2806
|
+
*
|
|
2477
2807
|
* @param params - `Auth.UnverifiedAccountExpiryRunParams`.
|
|
2478
2808
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2479
2809
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure (`min_age_minutes` out of range).
|
|
@@ -2487,7 +2817,7 @@ var AppUnverifiedAccountExpiryResource = class extends APIResource {
|
|
|
2487
2817
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-unverified-account-expiry-run
|
|
2488
2818
|
* @example
|
|
2489
2819
|
* ```ts
|
|
2490
|
-
* const unverifiedAccountExpiryRun = await auth.admin.app("
|
|
2820
|
+
* const unverifiedAccountExpiryRun = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").unverifiedAccountExpiry.run({ dry_run: false });
|
|
2491
2821
|
* ```
|
|
2492
2822
|
*/
|
|
2493
2823
|
run(params, options) {
|
|
@@ -2500,6 +2830,9 @@ var AppWebauthnConfigResource = class extends APIResource {
|
|
|
2500
2830
|
*
|
|
2501
2831
|
* Returns defaults with `enabled: false` and a null `rp_id` when passkeys have never been configured for the app.
|
|
2502
2832
|
*
|
|
2833
|
+
* Credential: `workspace_key`.
|
|
2834
|
+
* - `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.
|
|
2835
|
+
*
|
|
2503
2836
|
* @param options - Per-request options.
|
|
2504
2837
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
2505
2838
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` on this app, or the app is suspended or archived.
|
|
@@ -2509,7 +2842,7 @@ var AppWebauthnConfigResource = class extends APIResource {
|
|
|
2509
2842
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webauthn-config
|
|
2510
2843
|
* @example
|
|
2511
2844
|
* ```ts
|
|
2512
|
-
* const webauthnConfig = await auth.admin.app("
|
|
2845
|
+
* const webauthnConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webauthnConfig.retrieve();
|
|
2513
2846
|
* ```
|
|
2514
2847
|
*/
|
|
2515
2848
|
retrieve(options) {
|
|
@@ -2518,6 +2851,9 @@ var AppWebauthnConfigResource = class extends APIResource {
|
|
|
2518
2851
|
/**
|
|
2519
2852
|
* Set the per-app passkey (WebAuthn) relying-party settings.
|
|
2520
2853
|
*
|
|
2854
|
+
* Credential: `workspace_key`.
|
|
2855
|
+
* - `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.
|
|
2856
|
+
*
|
|
2521
2857
|
* @param params - `Auth.WebauthnConfigUpdateParams`.
|
|
2522
2858
|
* @param options - Per-request options.
|
|
2523
2859
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `rp_id` is malformed, or is not a registrable suffix of any origin in `allowed_redirect_origins`.
|
|
@@ -2529,7 +2865,7 @@ var AppWebauthnConfigResource = class extends APIResource {
|
|
|
2529
2865
|
* @see https://productcraft.co/docs/auth/api-reference#put-v1-apps-app-id-webauthn-config
|
|
2530
2866
|
* @example
|
|
2531
2867
|
* ```ts
|
|
2532
|
-
* const webauthnConfig = await auth.admin.app("
|
|
2868
|
+
* const webauthnConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webauthnConfig.update({ enabled: true, rp_id: "example.com" });
|
|
2533
2869
|
* ```
|
|
2534
2870
|
*/
|
|
2535
2871
|
update(params, options) {
|
|
@@ -2542,6 +2878,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2542
2878
|
*
|
|
2543
2879
|
* 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.
|
|
2544
2880
|
*
|
|
2881
|
+
* Credential: `workspace_key`.
|
|
2882
|
+
* - `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.
|
|
2883
|
+
*
|
|
2545
2884
|
* @param params - `Auth.WebhookEndpointCreateParams`.
|
|
2546
2885
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2547
2886
|
* @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`).
|
|
@@ -2555,7 +2894,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2555
2894
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-webhooks-endpoints
|
|
2556
2895
|
* @example
|
|
2557
2896
|
* ```ts
|
|
2558
|
-
* const webhookEndpointWithSecret = await auth.admin.app("
|
|
2897
|
+
* const webhookEndpointWithSecret = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.create({ url: "https://api.acme.com/webhooks" });
|
|
2559
2898
|
* ```
|
|
2560
2899
|
*/
|
|
2561
2900
|
create(params, options) {
|
|
@@ -2566,6 +2905,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2566
2905
|
*
|
|
2567
2906
|
* Queued retries are dropped. Its past attempts stay in the event log until the events expire.
|
|
2568
2907
|
*
|
|
2908
|
+
* Credential: `workspace_key`.
|
|
2909
|
+
* - `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.
|
|
2910
|
+
*
|
|
2569
2911
|
* @param endpointId - Id of the endpoint.
|
|
2570
2912
|
* @param options - Per-request options.
|
|
2571
2913
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `endpoint_id` is not a UUID.
|
|
@@ -2577,7 +2919,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2577
2919
|
* @see https://productcraft.co/docs/auth/api-reference#delete-v1-apps-app-id-webhooks-endpoints-endpoint-id
|
|
2578
2920
|
* @example
|
|
2579
2921
|
* ```ts
|
|
2580
|
-
* await auth.admin.app("
|
|
2922
|
+
* await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2581
2923
|
* ```
|
|
2582
2924
|
*/
|
|
2583
2925
|
delete(endpointId, options) {
|
|
@@ -2588,6 +2930,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2588
2930
|
*
|
|
2589
2931
|
* At most 10, so this is always one page. Signing secrets are never returned here, only their last 4 characters.
|
|
2590
2932
|
*
|
|
2933
|
+
* Credential: `workspace_key`.
|
|
2934
|
+
* - `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.
|
|
2935
|
+
*
|
|
2591
2936
|
* @param options - Per-request options.
|
|
2592
2937
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: The scope id in the path is malformed.
|
|
2593
2938
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
@@ -2598,7 +2943,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2598
2943
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webhooks-endpoints
|
|
2599
2944
|
* @example
|
|
2600
2945
|
* ```ts
|
|
2601
|
-
* for await (const endpoint of auth.admin.app("
|
|
2946
|
+
* for await (const endpoint of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.list()) {
|
|
2602
2947
|
* console.log(endpoint);
|
|
2603
2948
|
* }
|
|
2604
2949
|
* ```
|
|
@@ -2611,6 +2956,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2611
2956
|
*
|
|
2612
2957
|
* 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.
|
|
2613
2958
|
*
|
|
2959
|
+
* Credential: `workspace_key`.
|
|
2960
|
+
* - `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.
|
|
2961
|
+
*
|
|
2614
2962
|
* @param endpointId - Id of the endpoint.
|
|
2615
2963
|
* @param options - Per-request options.
|
|
2616
2964
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `endpoint_id` is not a UUID.
|
|
@@ -2622,7 +2970,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2622
2970
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webhooks-endpoints-endpoint-id
|
|
2623
2971
|
* @example
|
|
2624
2972
|
* ```ts
|
|
2625
|
-
* const webhookEndpoint = await auth.admin.app("
|
|
2973
|
+
* const webhookEndpoint = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2626
2974
|
* ```
|
|
2627
2975
|
*/
|
|
2628
2976
|
retrieve(endpointId, options) {
|
|
@@ -2633,6 +2981,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2633
2981
|
*
|
|
2634
2982
|
* 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.
|
|
2635
2983
|
*
|
|
2984
|
+
* Credential: `workspace_key`.
|
|
2985
|
+
* - `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.
|
|
2986
|
+
*
|
|
2636
2987
|
* @param endpointId - Id of the endpoint.
|
|
2637
2988
|
* @param params - `Auth.WebhookEndpointRotateSecretParams`.
|
|
2638
2989
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2646,7 +2997,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2646
2997
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-webhooks-endpoints-endpoint-id-rotate-secret
|
|
2647
2998
|
* @example
|
|
2648
2999
|
* ```ts
|
|
2649
|
-
* const webhookEndpointWithSecret = await auth.admin.app("
|
|
3000
|
+
* const webhookEndpointWithSecret = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.rotateSecret("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { grace_hours: 24 });
|
|
2650
3001
|
* ```
|
|
2651
3002
|
*/
|
|
2652
3003
|
rotateSecret(endpointId, params, options) {
|
|
@@ -2657,6 +3008,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2657
3008
|
*
|
|
2658
3009
|
* 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.
|
|
2659
3010
|
*
|
|
3011
|
+
* Credential: `workspace_key`.
|
|
3012
|
+
* - `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.
|
|
3013
|
+
*
|
|
2660
3014
|
* @param endpointId - Id of the endpoint.
|
|
2661
3015
|
* @param params - `Auth.WebhookEndpointTestParams`.
|
|
2662
3016
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2670,7 +3024,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2670
3024
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-webhooks-endpoints-endpoint-id-test
|
|
2671
3025
|
* @example
|
|
2672
3026
|
* ```ts
|
|
2673
|
-
* const webhookDeliveryAttempt = await auth.admin.app("
|
|
3027
|
+
* const webhookDeliveryAttempt = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.test("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { event_type: "user.signup" });
|
|
2674
3028
|
* ```
|
|
2675
3029
|
*/
|
|
2676
3030
|
test(endpointId, params, options) {
|
|
@@ -2681,6 +3035,9 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2681
3035
|
*
|
|
2682
3036
|
* 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`.
|
|
2683
3037
|
*
|
|
3038
|
+
* Credential: `workspace_key`.
|
|
3039
|
+
* - `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.
|
|
3040
|
+
*
|
|
2684
3041
|
* @param endpointId - Id of the endpoint.
|
|
2685
3042
|
* @param params - `Auth.WebhookEndpointUpdateParams`.
|
|
2686
3043
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2695,7 +3052,7 @@ var AppWebhooksEndpointsResource = class extends APIResource {
|
|
|
2695
3052
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-webhooks-endpoints-endpoint-id
|
|
2696
3053
|
* @example
|
|
2697
3054
|
* ```ts
|
|
2698
|
-
* const webhookEndpoint = await auth.admin.app("
|
|
3055
|
+
* const webhookEndpoint = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.endpoints.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { description: "Production receiver" });
|
|
2699
3056
|
* ```
|
|
2700
3057
|
*/
|
|
2701
3058
|
update(endpointId, params, options) {
|
|
@@ -2708,6 +3065,9 @@ var AppWebhooksEventTypesResource = class extends APIResource {
|
|
|
2708
3065
|
*
|
|
2709
3066
|
* Each type with a plain description, its group and an example `data` object (what "Send test" delivers).
|
|
2710
3067
|
*
|
|
3068
|
+
* Credential: `workspace_key`.
|
|
3069
|
+
* - `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.
|
|
3070
|
+
*
|
|
2711
3071
|
* @param options - Per-request options.
|
|
2712
3072
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
|
|
2713
3073
|
* @throws {PermissionDeniedError} 403 FORBIDDEN: Caller lacks `auth.read` (reads) or `auth.update` (changes, Send test, replay), or the app is suspended or archived.
|
|
@@ -2717,7 +3077,7 @@ var AppWebhooksEventTypesResource = class extends APIResource {
|
|
|
2717
3077
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webhooks-event-types
|
|
2718
3078
|
* @example
|
|
2719
3079
|
* ```ts
|
|
2720
|
-
* const listWebhookEventTypes = await auth.admin.app("
|
|
3080
|
+
* const listWebhookEventTypes = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.eventTypes.list();
|
|
2721
3081
|
* ```
|
|
2722
3082
|
*/
|
|
2723
3083
|
list(options) {
|
|
@@ -2730,6 +3090,9 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2730
3090
|
*
|
|
2731
3091
|
* Every event logged while at least one endpoint existed, with the latest state per endpoint and when the next retry is due.
|
|
2732
3092
|
*
|
|
3093
|
+
* Credential: `workspace_key`.
|
|
3094
|
+
* - `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.
|
|
3095
|
+
*
|
|
2733
3096
|
* @param params - `Auth.WebhookEventListParams`.
|
|
2734
3097
|
* @param options - Per-request options.
|
|
2735
3098
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid filter value or cursor.
|
|
@@ -2741,10 +3104,10 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2741
3104
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webhooks-events
|
|
2742
3105
|
* @example
|
|
2743
3106
|
* ```ts
|
|
2744
|
-
* for await (const event of auth.admin.app("
|
|
3107
|
+
* for await (const event of auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.events.list()) {
|
|
2745
3108
|
* console.log(event);
|
|
2746
3109
|
* }
|
|
2747
|
-
* const page = await auth.admin.app("
|
|
3110
|
+
* const page = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.events.list({}, { timeout: 5_000 });
|
|
2748
3111
|
* ```
|
|
2749
3112
|
*/
|
|
2750
3113
|
list(params, options) {
|
|
@@ -2755,6 +3118,9 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2755
3118
|
*
|
|
2756
3119
|
* 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.
|
|
2757
3120
|
*
|
|
3121
|
+
* Credential: `workspace_key`.
|
|
3122
|
+
* - `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.
|
|
3123
|
+
*
|
|
2758
3124
|
* @param eventId - The event id, `evt_<uuid>`.
|
|
2759
3125
|
* @param params - `Auth.WebhookEventReplayParams`.
|
|
2760
3126
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -2768,7 +3134,7 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2768
3134
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-webhooks-events-event-id-replay
|
|
2769
3135
|
* @example
|
|
2770
3136
|
* ```ts
|
|
2771
|
-
* const replayWebhookEvent = await auth.admin.app("
|
|
3137
|
+
* const replayWebhookEvent = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.events.replay("evt_3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2772
3138
|
* ```
|
|
2773
3139
|
*/
|
|
2774
3140
|
replay(eventId, params, options) {
|
|
@@ -2779,6 +3145,9 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2779
3145
|
*
|
|
2780
3146
|
* 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.
|
|
2781
3147
|
*
|
|
3148
|
+
* Credential: `workspace_key`.
|
|
3149
|
+
* - `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.
|
|
3150
|
+
*
|
|
2782
3151
|
* @param eventId - The event id, `evt_<uuid>`.
|
|
2783
3152
|
* @param options - Per-request options.
|
|
2784
3153
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `event_id` is not `evt_<uuid>`.
|
|
@@ -2790,7 +3159,7 @@ var AppWebhooksEventsResource = class extends APIResource {
|
|
|
2790
3159
|
* @see https://productcraft.co/docs/auth/api-reference#get-v1-apps-app-id-webhooks-events-event-id
|
|
2791
3160
|
* @example
|
|
2792
3161
|
* ```ts
|
|
2793
|
-
* const webhookEventDetail = await auth.admin.app("
|
|
3162
|
+
* const webhookEventDetail = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").webhooks.events.retrieve("evt_3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
2794
3163
|
* ```
|
|
2795
3164
|
*/
|
|
2796
3165
|
retrieve(eventId, options) {
|
|
@@ -2904,6 +3273,9 @@ var AuthApp = class extends APIResource {
|
|
|
2904
3273
|
/**
|
|
2905
3274
|
* 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.
|
|
2906
3275
|
*
|
|
3276
|
+
* Credential: `workspace_key`.
|
|
3277
|
+
* - `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.
|
|
3278
|
+
*
|
|
2907
3279
|
* @param params - `Auth.CloneParams`.
|
|
2908
3280
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
2909
3281
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure, or the slug matches the source.
|
|
@@ -2916,7 +3288,7 @@ var AuthApp = class extends APIResource {
|
|
|
2916
3288
|
* @see https://productcraft.co/docs/auth/api-reference#post-v1-apps-app-id-clone
|
|
2917
3289
|
* @example
|
|
2918
3290
|
* ```ts
|
|
2919
|
-
* const cloneApp = await auth.admin.app("
|
|
3291
|
+
* const cloneApp = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").clone({ environment: "staging", slug: "acme-app-staging" });
|
|
2920
3292
|
* ```
|
|
2921
3293
|
*/
|
|
2922
3294
|
clone(params, options) {
|
|
@@ -2925,6 +3297,9 @@ var AuthApp = class extends APIResource {
|
|
|
2925
3297
|
/**
|
|
2926
3298
|
* Update app status (active, suspended, archived)
|
|
2927
3299
|
*
|
|
3300
|
+
* Credential: `workspace_key`.
|
|
3301
|
+
* - `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.
|
|
3302
|
+
*
|
|
2928
3303
|
* @param params - `Auth.UpdateStatusParams`.
|
|
2929
3304
|
* @param options - Per-request options.
|
|
2930
3305
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid status transition (e.g. archived → active).
|
|
@@ -2936,7 +3311,7 @@ var AuthApp = class extends APIResource {
|
|
|
2936
3311
|
* @see https://productcraft.co/docs/auth/api-reference#patch-v1-apps-app-id-status
|
|
2937
3312
|
* @example
|
|
2938
3313
|
* ```ts
|
|
2939
|
-
* const app = await auth.admin.app("
|
|
3314
|
+
* const app = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").updateStatus({ status: "suspended" });
|
|
2940
3315
|
* ```
|
|
2941
3316
|
*/
|
|
2942
3317
|
updateStatus(params, options) {
|
|
@@ -3072,6 +3447,9 @@ var ConsumerMeActivityResource = class extends APIResource {
|
|
|
3072
3447
|
*
|
|
3073
3448
|
* Login events, password changes, and other security-relevant records, scoped to this EndUser.
|
|
3074
3449
|
*
|
|
3450
|
+
* Credential: `end_user_token`.
|
|
3451
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3452
|
+
*
|
|
3075
3453
|
* @param options - Per-request options.
|
|
3076
3454
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3077
3455
|
* @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.
|
|
@@ -3079,7 +3457,7 @@ var ConsumerMeActivityResource = class extends APIResource {
|
|
|
3079
3457
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me-activity
|
|
3080
3458
|
* @example
|
|
3081
3459
|
* ```ts
|
|
3082
|
-
* for await (const activity of auth.consumer("app").me.activity.list()) {
|
|
3460
|
+
* for await (const activity of auth.consumer("my-app").me.activity.list()) {
|
|
3083
3461
|
* console.log(activity);
|
|
3084
3462
|
* }
|
|
3085
3463
|
* ```
|
|
@@ -3094,6 +3472,9 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3094
3472
|
*
|
|
3095
3473
|
* 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.
|
|
3096
3474
|
*
|
|
3475
|
+
* Credential: `end_user_token`.
|
|
3476
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3477
|
+
*
|
|
3097
3478
|
* @param params - `Auth.MeContactCreateParams`.
|
|
3098
3479
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
3099
3480
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Request validation failed: unsupported `type`, invalid email, or empty/over-long `value`.
|
|
@@ -3104,7 +3485,7 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3104
3485
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-contacts
|
|
3105
3486
|
* @example
|
|
3106
3487
|
* ```ts
|
|
3107
|
-
* const meContact = await auth.consumer("app").me.contacts.create({ type: "email", value: "
|
|
3488
|
+
* const meContact = await auth.consumer("my-app").me.contacts.create({ type: "email", value: "ada@example.com" });
|
|
3108
3489
|
* ```
|
|
3109
3490
|
*/
|
|
3110
3491
|
create(params, options) {
|
|
@@ -3113,6 +3494,9 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3113
3494
|
/**
|
|
3114
3495
|
* Delete a contact
|
|
3115
3496
|
*
|
|
3497
|
+
* Credential: `end_user_token`.
|
|
3498
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3499
|
+
*
|
|
3116
3500
|
* @param id - Id of the contact.
|
|
3117
3501
|
* @param options - Per-request options.
|
|
3118
3502
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
@@ -3123,7 +3507,7 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3123
3507
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-me-contacts-id
|
|
3124
3508
|
* @example
|
|
3125
3509
|
* ```ts
|
|
3126
|
-
* await auth.consumer("app").me.contacts.delete("
|
|
3510
|
+
* await auth.consumer("my-app").me.contacts.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
3127
3511
|
* ```
|
|
3128
3512
|
*/
|
|
3129
3513
|
delete(id, options) {
|
|
@@ -3132,6 +3516,9 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3132
3516
|
/**
|
|
3133
3517
|
* List the EndUser's contacts
|
|
3134
3518
|
*
|
|
3519
|
+
* Credential: `end_user_token`.
|
|
3520
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3521
|
+
*
|
|
3135
3522
|
* @param options - Per-request options.
|
|
3136
3523
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3137
3524
|
* @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).
|
|
@@ -3139,7 +3526,7 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3139
3526
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me-contacts
|
|
3140
3527
|
* @example
|
|
3141
3528
|
* ```ts
|
|
3142
|
-
* const meContacts = await auth.consumer("app").me.contacts.list();
|
|
3529
|
+
* const meContacts = await auth.consumer("my-app").me.contacts.list();
|
|
3143
3530
|
* ```
|
|
3144
3531
|
*/
|
|
3145
3532
|
list(options) {
|
|
@@ -3150,6 +3537,9 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3150
3537
|
*
|
|
3151
3538
|
* 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.
|
|
3152
3539
|
*
|
|
3540
|
+
* Credential: `end_user_token`.
|
|
3541
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3542
|
+
*
|
|
3153
3543
|
* @param id - Id of the contact.
|
|
3154
3544
|
* @param options - Per-request options.
|
|
3155
3545
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
@@ -3160,7 +3550,7 @@ var ConsumerMeContactsResource = class extends APIResource {
|
|
|
3160
3550
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-contacts-id-promote
|
|
3161
3551
|
* @example
|
|
3162
3552
|
* ```ts
|
|
3163
|
-
* await auth.consumer("app").me.contacts.promote("
|
|
3553
|
+
* await auth.consumer("my-app").me.contacts.promote("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
3164
3554
|
* ```
|
|
3165
3555
|
*/
|
|
3166
3556
|
promote(id, options) {
|
|
@@ -3173,6 +3563,9 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3173
3563
|
*
|
|
3174
3564
|
* 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.
|
|
3175
3565
|
*
|
|
3566
|
+
* Credential: `end_user_token`.
|
|
3567
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3568
|
+
*
|
|
3176
3569
|
* @param params - `Auth.MeMfaFactorCreateParams`.
|
|
3177
3570
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
3178
3571
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Request validation failed: unsupported `type`, over-long `label`, or `contact_id` is not a UUID.
|
|
@@ -3185,7 +3578,7 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3185
3578
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-factors
|
|
3186
3579
|
* @example
|
|
3187
3580
|
* ```ts
|
|
3188
|
-
* const startEnrollment = await auth.consumer("app").me.mfa.factors.create({ type: "totp" });
|
|
3581
|
+
* const startEnrollment = await auth.consumer("my-app").me.mfa.factors.create({ type: "totp" });
|
|
3189
3582
|
* ```
|
|
3190
3583
|
*/
|
|
3191
3584
|
create(params, options) {
|
|
@@ -3196,6 +3589,9 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3196
3589
|
*
|
|
3197
3590
|
* 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.
|
|
3198
3591
|
*
|
|
3592
|
+
* Credential: `end_user_token`.
|
|
3593
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3594
|
+
*
|
|
3199
3595
|
* @param id - Id of the factor.
|
|
3200
3596
|
* @param options - Per-request options.
|
|
3201
3597
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
@@ -3205,7 +3601,7 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3205
3601
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-me-mfa-factors-id
|
|
3206
3602
|
* @example
|
|
3207
3603
|
* ```ts
|
|
3208
|
-
* await auth.consumer("app").me.mfa.factors.delete("
|
|
3604
|
+
* await auth.consumer("my-app").me.mfa.factors.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
3209
3605
|
* ```
|
|
3210
3606
|
*/
|
|
3211
3607
|
delete(id, options) {
|
|
@@ -3216,6 +3612,9 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3216
3612
|
*
|
|
3217
3613
|
* Includes factors in any state (pending enrollment + enabled). Disabled factors are not listed.
|
|
3218
3614
|
*
|
|
3615
|
+
* Credential: `end_user_token`.
|
|
3616
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3617
|
+
*
|
|
3219
3618
|
* @param options - Per-request options.
|
|
3220
3619
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3221
3620
|
* @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.
|
|
@@ -3223,7 +3622,7 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3223
3622
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me-mfa-factors
|
|
3224
3623
|
* @example
|
|
3225
3624
|
* ```ts
|
|
3226
|
-
* const factorList = await auth.consumer("app").me.mfa.factors.list();
|
|
3625
|
+
* const factorList = await auth.consumer("my-app").me.mfa.factors.list();
|
|
3227
3626
|
* ```
|
|
3228
3627
|
*/
|
|
3229
3628
|
list(options) {
|
|
@@ -3234,6 +3633,9 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3234
3633
|
*
|
|
3235
3634
|
* 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.
|
|
3236
3635
|
*
|
|
3636
|
+
* Credential: `end_user_token`.
|
|
3637
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3638
|
+
*
|
|
3237
3639
|
* @param id - Id of the factor.
|
|
3238
3640
|
* @param params - `Auth.MeMfaFactorVerifyParams`.
|
|
3239
3641
|
* @param options - Per-request options.
|
|
@@ -3244,7 +3646,7 @@ var ConsumerMeMfaFactorsResource = class extends APIResource {
|
|
|
3244
3646
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-factors-id-verify
|
|
3245
3647
|
* @example
|
|
3246
3648
|
* ```ts
|
|
3247
|
-
* const confirmEnrollment = await auth.consumer("app").me.mfa.factors.verify("
|
|
3649
|
+
* const confirmEnrollment = await auth.consumer("my-app").me.mfa.factors.verify("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { code: "123456" });
|
|
3248
3650
|
* ```
|
|
3249
3651
|
*/
|
|
3250
3652
|
verify(id, params, options) {
|
|
@@ -3257,6 +3659,9 @@ var ConsumerMeMfaRecoveryCodesResource = class extends APIResource {
|
|
|
3257
3659
|
*
|
|
3258
3660
|
* 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.
|
|
3259
3661
|
*
|
|
3662
|
+
* Credential: `end_user_token`.
|
|
3663
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3664
|
+
*
|
|
3260
3665
|
* @param options - Per-request options.
|
|
3261
3666
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3262
3667
|
* @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.
|
|
@@ -3264,7 +3669,7 @@ var ConsumerMeMfaRecoveryCodesResource = class extends APIResource {
|
|
|
3264
3669
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-recovery-codes-regenerate
|
|
3265
3670
|
* @example
|
|
3266
3671
|
* ```ts
|
|
3267
|
-
* const recoveryCodes = await auth.consumer("app").me.mfa.recoveryCodes.regenerate();
|
|
3672
|
+
* const recoveryCodes = await auth.consumer("my-app").me.mfa.recoveryCodes.regenerate();
|
|
3268
3673
|
* ```
|
|
3269
3674
|
*/
|
|
3270
3675
|
regenerate(options) {
|
|
@@ -3277,6 +3682,9 @@ var ConsumerMeMfaStepUpWebauthnResource = class extends APIResource {
|
|
|
3277
3682
|
*
|
|
3278
3683
|
* 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.
|
|
3279
3684
|
*
|
|
3685
|
+
* Credential: `end_user_token`.
|
|
3686
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3687
|
+
*
|
|
3280
3688
|
* @param options - Per-request options.
|
|
3281
3689
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: No passkey is enrolled on this account.
|
|
3282
3690
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3286,7 +3694,7 @@ var ConsumerMeMfaStepUpWebauthnResource = class extends APIResource {
|
|
|
3286
3694
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-step-up-webauthn-options
|
|
3287
3695
|
* @example
|
|
3288
3696
|
* ```ts
|
|
3289
|
-
* const webauthnOptions = await auth.consumer("app").me.mfa.stepUp.webauthn.options();
|
|
3697
|
+
* const webauthnOptions = await auth.consumer("my-app").me.mfa.stepUp.webauthn.options();
|
|
3290
3698
|
* ```
|
|
3291
3699
|
*/
|
|
3292
3700
|
options(options) {
|
|
@@ -3303,6 +3711,9 @@ var ConsumerMeMfaStepUpResource = class extends APIResource {
|
|
|
3303
3711
|
*
|
|
3304
3712
|
* 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.
|
|
3305
3713
|
*
|
|
3714
|
+
* Credential: `end_user_token`.
|
|
3715
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3716
|
+
*
|
|
3306
3717
|
* @param params - `Auth.MeMfaStepUpSendCodeParams`.
|
|
3307
3718
|
* @param options - Per-request options.
|
|
3308
3719
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Account has no enabled email factor (or the named factor is not an email factor).
|
|
@@ -3314,7 +3725,7 @@ var ConsumerMeMfaStepUpResource = class extends APIResource {
|
|
|
3314
3725
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-step-up-send-code
|
|
3315
3726
|
* @example
|
|
3316
3727
|
* ```ts
|
|
3317
|
-
* const stepUpSendCode = await auth.consumer("app").me.mfa.stepUp.sendCode({ factor_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b" });
|
|
3728
|
+
* const stepUpSendCode = await auth.consumer("my-app").me.mfa.stepUp.sendCode({ factor_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b" });
|
|
3318
3729
|
* ```
|
|
3319
3730
|
*/
|
|
3320
3731
|
sendCode(params, options) {
|
|
@@ -3325,6 +3736,9 @@ var ConsumerMeMfaStepUpResource = class extends APIResource {
|
|
|
3325
3736
|
*
|
|
3326
3737
|
* 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.
|
|
3327
3738
|
*
|
|
3739
|
+
* Credential: `end_user_token`.
|
|
3740
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3741
|
+
*
|
|
3328
3742
|
* @param params - `Auth.MeMfaStepUpVerifyParams`.
|
|
3329
3743
|
* @param options - Per-request options.
|
|
3330
3744
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Code did not match any enabled factor or recovery code.
|
|
@@ -3334,7 +3748,7 @@ var ConsumerMeMfaStepUpResource = class extends APIResource {
|
|
|
3334
3748
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-mfa-step-up
|
|
3335
3749
|
* @example
|
|
3336
3750
|
* ```ts
|
|
3337
|
-
* const stepUp = await auth.consumer("app").me.mfa.stepUp.verify({ code: "123456" });
|
|
3751
|
+
* const stepUp = await auth.consumer("my-app").me.mfa.stepUp.verify({ code: "123456" });
|
|
3338
3752
|
* ```
|
|
3339
3753
|
*/
|
|
3340
3754
|
verify(params, options) {
|
|
@@ -3361,6 +3775,9 @@ var ConsumerMeSessionsResource = class extends APIResource {
|
|
|
3361
3775
|
*
|
|
3362
3776
|
* 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.
|
|
3363
3777
|
*
|
|
3778
|
+
* Credential: `end_user_token`.
|
|
3779
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3780
|
+
*
|
|
3364
3781
|
* @param id - Id of the session.
|
|
3365
3782
|
* @param options - Per-request options.
|
|
3366
3783
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
@@ -3370,7 +3787,7 @@ var ConsumerMeSessionsResource = class extends APIResource {
|
|
|
3370
3787
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-me-sessions-id
|
|
3371
3788
|
* @example
|
|
3372
3789
|
* ```ts
|
|
3373
|
-
* await auth.consumer("app").me.sessions.delete("
|
|
3790
|
+
* await auth.consumer("my-app").me.sessions.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
3374
3791
|
* ```
|
|
3375
3792
|
*/
|
|
3376
3793
|
delete(id, options) {
|
|
@@ -3381,6 +3798,9 @@ var ConsumerMeSessionsResource = class extends APIResource {
|
|
|
3381
3798
|
*
|
|
3382
3799
|
* Each session includes a `current` flag identifying the one belonging to the bearer token used for this request.
|
|
3383
3800
|
*
|
|
3801
|
+
* Credential: `end_user_token`.
|
|
3802
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3803
|
+
*
|
|
3384
3804
|
* @param options - Per-request options.
|
|
3385
3805
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3386
3806
|
* @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.
|
|
@@ -3388,7 +3808,7 @@ var ConsumerMeSessionsResource = class extends APIResource {
|
|
|
3388
3808
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me-sessions
|
|
3389
3809
|
* @example
|
|
3390
3810
|
* ```ts
|
|
3391
|
-
* for await (const session of auth.consumer("app").me.sessions.list()) {
|
|
3811
|
+
* for await (const session of auth.consumer("my-app").me.sessions.list()) {
|
|
3392
3812
|
* console.log(session);
|
|
3393
3813
|
* }
|
|
3394
3814
|
* ```
|
|
@@ -3403,6 +3823,9 @@ var ConsumerMeTenantInvitesResource = class extends APIResource {
|
|
|
3403
3823
|
*
|
|
3404
3824
|
* 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.
|
|
3405
3825
|
*
|
|
3826
|
+
* Credential: `end_user_token`.
|
|
3827
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3828
|
+
*
|
|
3406
3829
|
* @param params - `Auth.MeTenantInviteAcceptParams`.
|
|
3407
3830
|
* @param options - Per-request options.
|
|
3408
3831
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3415,7 +3838,7 @@ var ConsumerMeTenantInvitesResource = class extends APIResource {
|
|
|
3415
3838
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-tenant-invites-accept
|
|
3416
3839
|
* @example
|
|
3417
3840
|
* ```ts
|
|
3418
|
-
* const acceptedTenantInvite = await auth.consumer("app").me.tenantInvites.accept({ code: "tinv_9dK2mQ7pR4vXbN1sT6yZ0hLcJeW3fAgU" });
|
|
3841
|
+
* const acceptedTenantInvite = await auth.consumer("my-app").me.tenantInvites.accept({ code: "tinv_9dK2mQ7pR4vXbN1sT6yZ0hLcJeW3fAgU" });
|
|
3419
3842
|
* ```
|
|
3420
3843
|
*/
|
|
3421
3844
|
accept(params, options) {
|
|
@@ -3428,6 +3851,9 @@ var ConsumerMeTenantsResource = class extends APIResource {
|
|
|
3428
3851
|
*
|
|
3429
3852
|
* 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.
|
|
3430
3853
|
*
|
|
3854
|
+
* Credential: `end_user_token`.
|
|
3855
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3856
|
+
*
|
|
3431
3857
|
* @param options - Per-request options.
|
|
3432
3858
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing / invalid bearer, or the session behind the token is revoked, expired or no longer exists.
|
|
3433
3859
|
* @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.
|
|
@@ -3437,7 +3863,7 @@ var ConsumerMeTenantsResource = class extends APIResource {
|
|
|
3437
3863
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-auth-me-tenants
|
|
3438
3864
|
* @example
|
|
3439
3865
|
* ```ts
|
|
3440
|
-
* const myTenants = await auth.consumer("app").me.tenants.list();
|
|
3866
|
+
* const myTenants = await auth.consumer("my-app").me.tenants.list();
|
|
3441
3867
|
* ```
|
|
3442
3868
|
*/
|
|
3443
3869
|
list(options) {
|
|
@@ -3474,6 +3900,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3474
3900
|
*
|
|
3475
3901
|
* 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.
|
|
3476
3902
|
*
|
|
3903
|
+
* Credential: `end_user_token`.
|
|
3904
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3905
|
+
*
|
|
3477
3906
|
* @param params - `Auth.MeChangePasswordParams`.
|
|
3478
3907
|
* @param options - Per-request options.
|
|
3479
3908
|
* @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.
|
|
@@ -3484,7 +3913,10 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3484
3913
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-change-password
|
|
3485
3914
|
* @example
|
|
3486
3915
|
* ```ts
|
|
3487
|
-
* await auth.consumer("app").me.changePassword({
|
|
3916
|
+
* await auth.consumer("my-app").me.changePassword({
|
|
3917
|
+
* current_password: "correct horse battery staple",
|
|
3918
|
+
* new_password: "a new long passphrase 42",
|
|
3919
|
+
* });
|
|
3488
3920
|
* ```
|
|
3489
3921
|
*/
|
|
3490
3922
|
changePassword(params, options) {
|
|
@@ -3495,6 +3927,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3495
3927
|
*
|
|
3496
3928
|
* 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"`.
|
|
3497
3929
|
*
|
|
3930
|
+
* Credential: `end_user_token`.
|
|
3931
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3932
|
+
*
|
|
3498
3933
|
* @param options - Per-request options.
|
|
3499
3934
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3500
3935
|
* @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.
|
|
@@ -3502,7 +3937,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3502
3937
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-me
|
|
3503
3938
|
* @example
|
|
3504
3939
|
* ```ts
|
|
3505
|
-
* await auth.consumer("app").me.deleteAccount();
|
|
3940
|
+
* await auth.consumer("my-app").me.deleteAccount();
|
|
3506
3941
|
* ```
|
|
3507
3942
|
*/
|
|
3508
3943
|
deleteAccount(options) {
|
|
@@ -3513,6 +3948,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3513
3948
|
*
|
|
3514
3949
|
* 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.
|
|
3515
3950
|
*
|
|
3951
|
+
* Credential: `end_user_token`.
|
|
3952
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3953
|
+
*
|
|
3516
3954
|
* @param options - Per-request options.
|
|
3517
3955
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3518
3956
|
* @throws {NotFoundError} 404 NOT_FOUND, ACCOUNT_NOT_FOUND: Account not found in this app (`ACCOUNT_NOT_FOUND`).
|
|
@@ -3521,7 +3959,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3521
3959
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-me-avatar
|
|
3522
3960
|
* @example
|
|
3523
3961
|
* ```ts
|
|
3524
|
-
* await auth.consumer("app").me.deleteAvatar();
|
|
3962
|
+
* await auth.consumer("my-app").me.deleteAvatar();
|
|
3525
3963
|
* ```
|
|
3526
3964
|
*/
|
|
3527
3965
|
deleteAvatar(options) {
|
|
@@ -3532,6 +3970,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3532
3970
|
*
|
|
3533
3971
|
* 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.
|
|
3534
3972
|
*
|
|
3973
|
+
* Credential: `end_user_token`.
|
|
3974
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3975
|
+
*
|
|
3535
3976
|
* @param options - Per-request options.
|
|
3536
3977
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token, unknown or inactive app, or the account/session is no longer active.
|
|
3537
3978
|
* @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.
|
|
@@ -3539,7 +3980,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3539
3980
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me-permissions
|
|
3540
3981
|
* @example
|
|
3541
3982
|
* ```ts
|
|
3542
|
-
* const mePermissions = await auth.consumer("app").me.permissions();
|
|
3983
|
+
* const mePermissions = await auth.consumer("my-app").me.permissions();
|
|
3543
3984
|
* ```
|
|
3544
3985
|
*/
|
|
3545
3986
|
permissions(options) {
|
|
@@ -3550,6 +3991,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3550
3991
|
*
|
|
3551
3992
|
* 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.
|
|
3552
3993
|
*
|
|
3994
|
+
* Credential: `end_user_token`.
|
|
3995
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
3996
|
+
*
|
|
3553
3997
|
* @param options - Per-request options.
|
|
3554
3998
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
3555
3999
|
* @throws {NotFoundError} 404 NOT_FOUND: Account not found.
|
|
@@ -3558,7 +4002,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3558
4002
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-me
|
|
3559
4003
|
* @example
|
|
3560
4004
|
* ```ts
|
|
3561
|
-
* const meProfile = await auth.consumer("app").me.retrieve();
|
|
4005
|
+
* const meProfile = await auth.consumer("my-app").me.retrieve();
|
|
3562
4006
|
* ```
|
|
3563
4007
|
*/
|
|
3564
4008
|
retrieve(options) {
|
|
@@ -3569,6 +4013,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3569
4013
|
*
|
|
3570
4014
|
* 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.
|
|
3571
4015
|
*
|
|
4016
|
+
* Credential: `end_user_token`.
|
|
4017
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4018
|
+
*
|
|
3572
4019
|
* @param params - `Auth.MeUpdateParams`.
|
|
3573
4020
|
* @param options - Per-request options.
|
|
3574
4021
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3578,7 +4025,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3578
4025
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-me
|
|
3579
4026
|
* @example
|
|
3580
4027
|
* ```ts
|
|
3581
|
-
* const meUpdatedAccount = await auth.consumer("app").me.update({ display_name: "Ada Lovelace" });
|
|
4028
|
+
* const meUpdatedAccount = await auth.consumer("my-app").me.update({ display_name: "Ada Lovelace" });
|
|
3582
4029
|
* ```
|
|
3583
4030
|
*/
|
|
3584
4031
|
update(params, options) {
|
|
@@ -3589,6 +4036,9 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3589
4036
|
*
|
|
3590
4037
|
* 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.
|
|
3591
4038
|
*
|
|
4039
|
+
* Credential: `end_user_token`.
|
|
4040
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4041
|
+
*
|
|
3592
4042
|
* @param params - `Auth.MeUploadAvatarParams`.
|
|
3593
4043
|
* @param options - Per-request options.
|
|
3594
4044
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3599,7 +4049,7 @@ var ConsumerMeResource = class extends APIResource {
|
|
|
3599
4049
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-me-avatar
|
|
3600
4050
|
* @example
|
|
3601
4051
|
* ```ts
|
|
3602
|
-
* const avatarUrl = await auth.consumer("app").me.uploadAvatar({ file: new File(["…"], "image.png", { type: "image/png" }) });
|
|
4052
|
+
* const avatarUrl = await auth.consumer("my-app").me.uploadAvatar({ file: new File(["…"], "image.png", { type: "image/png" }) });
|
|
3603
4053
|
* ```
|
|
3604
4054
|
*/
|
|
3605
4055
|
uploadAvatar(params, options) {
|
|
@@ -3665,7 +4115,7 @@ var ConsumerMfaWebauthnResource = class extends APIResource {
|
|
|
3665
4115
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-webauthn-options
|
|
3666
4116
|
* @example
|
|
3667
4117
|
* ```ts
|
|
3668
|
-
* const consumerWebauthnOptions = await auth.consumer("app").mfa.webauthn.options({ mfa_token: "
|
|
4118
|
+
* const consumerWebauthnOptions = await auth.consumer("my-app").mfa.webauthn.options({ mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f" });
|
|
3669
4119
|
* ```
|
|
3670
4120
|
*/
|
|
3671
4121
|
options(params, options) {
|
|
@@ -3695,7 +4145,7 @@ var ConsumerMfaResource = class extends APIResource {
|
|
|
3695
4145
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-enroll
|
|
3696
4146
|
* @example
|
|
3697
4147
|
* ```ts
|
|
3698
|
-
* const startEnrollment = await auth.consumer("app").mfa.enroll({ mfa_token: "
|
|
4148
|
+
* const startEnrollment = await auth.consumer("my-app").mfa.enroll({ mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", type: "totp" });
|
|
3699
4149
|
* ```
|
|
3700
4150
|
*/
|
|
3701
4151
|
enroll(params, options) {
|
|
@@ -3719,7 +4169,10 @@ var ConsumerMfaResource = class extends APIResource {
|
|
|
3719
4169
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-recover
|
|
3720
4170
|
* @example
|
|
3721
4171
|
* ```ts
|
|
3722
|
-
* const consumerToken = await auth.consumer("app").mfa.recover({
|
|
4172
|
+
* const consumerToken = await auth.consumer("my-app").mfa.recover({
|
|
4173
|
+
* mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f",
|
|
4174
|
+
* recovery_code: "1a2b-3c4d-5e6f-7890",
|
|
4175
|
+
* });
|
|
3723
4176
|
* ```
|
|
3724
4177
|
*/
|
|
3725
4178
|
recover(params, options) {
|
|
@@ -3744,7 +4197,10 @@ var ConsumerMfaResource = class extends APIResource {
|
|
|
3744
4197
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-send-code
|
|
3745
4198
|
* @example
|
|
3746
4199
|
* ```ts
|
|
3747
|
-
* const consumerMfaSendCode = await auth.consumer("app").mfa.sendCode({
|
|
4200
|
+
* const consumerMfaSendCode = await auth.consumer("my-app").mfa.sendCode({
|
|
4201
|
+
* factor_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
4202
|
+
* mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f",
|
|
4203
|
+
* });
|
|
3748
4204
|
* ```
|
|
3749
4205
|
*/
|
|
3750
4206
|
sendCode(params, options) {
|
|
@@ -3767,7 +4223,7 @@ var ConsumerMfaResource = class extends APIResource {
|
|
|
3767
4223
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-verify
|
|
3768
4224
|
* @example
|
|
3769
4225
|
* ```ts
|
|
3770
|
-
* const consumerToken = await auth.consumer("app").mfa.verify({ mfa_token: "
|
|
4226
|
+
* const consumerToken = await auth.consumer("my-app").mfa.verify({ mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f" });
|
|
3771
4227
|
* ```
|
|
3772
4228
|
*/
|
|
3773
4229
|
verify(params, options) {
|
|
@@ -3790,7 +4246,10 @@ var ConsumerMfaResource = class extends APIResource {
|
|
|
3790
4246
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-mfa-enroll-verify
|
|
3791
4247
|
* @example
|
|
3792
4248
|
* ```ts
|
|
3793
|
-
* const consumerMfaEnrollVerify = await auth.consumer("app").mfa.verifyEnrollment({
|
|
4249
|
+
* const consumerMfaEnrollVerify = await auth.consumer("my-app").mfa.verifyEnrollment({
|
|
4250
|
+
* factor_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
4251
|
+
* mfa_token: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f",
|
|
4252
|
+
* });
|
|
3794
4253
|
* ```
|
|
3795
4254
|
*/
|
|
3796
4255
|
verifyEnrollment(params, options) {
|
|
@@ -3803,6 +4262,10 @@ var ConsumerOauthResource = class extends APIResource {
|
|
|
3803
4262
|
*
|
|
3804
4263
|
* 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.
|
|
3805
4264
|
*
|
|
4265
|
+
* Credential: one of `m2m_token`, `end_user_token`.
|
|
4266
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4267
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4268
|
+
*
|
|
3806
4269
|
* @param params - `Auth.OauthIntrospectParams`.
|
|
3807
4270
|
* @param options - Per-request options.
|
|
3808
4271
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Request validation failed in the global `ValidationPipe`.
|
|
@@ -3815,7 +4278,7 @@ var ConsumerOauthResource = class extends APIResource {
|
|
|
3815
4278
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-oauth-introspect
|
|
3816
4279
|
* @example
|
|
3817
4280
|
* ```ts
|
|
3818
|
-
* const introspect = await auth.consumer("app").oauth.introspect({ token: "
|
|
4281
|
+
* const introspect = await auth.consumer("my-app").oauth.introspect({ token: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJzdWIiOiJ1c3JfMSJ9.c2lnbmF0dXJl" });
|
|
3819
4282
|
* ```
|
|
3820
4283
|
*/
|
|
3821
4284
|
introspect(params, options) {
|
|
@@ -3838,9 +4301,9 @@ var ConsumerOauthResource = class extends APIResource {
|
|
|
3838
4301
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-oauth-token
|
|
3839
4302
|
* @example
|
|
3840
4303
|
* ```ts
|
|
3841
|
-
* const oAuthToken = await auth.consumer("app").oauth.token({
|
|
4304
|
+
* const oAuthToken = await auth.consumer("my-app").oauth.token({
|
|
3842
4305
|
* client_id: "m2m_a1b2c3d4e5f6...",
|
|
3843
|
-
* client_secret: "
|
|
4306
|
+
* client_secret: "the-secret-returned-by-credentials-create",
|
|
3844
4307
|
* grant_type: "client_credentials",
|
|
3845
4308
|
* });
|
|
3846
4309
|
* ```
|
|
@@ -3875,7 +4338,7 @@ var ConsumerPasskeyResource = class extends APIResource {
|
|
|
3875
4338
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-passkey-options
|
|
3876
4339
|
* @example
|
|
3877
4340
|
* ```ts
|
|
3878
|
-
* const consumerWebauthnOptions = await auth.consumer("app").passkey.options({ tenant_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b" });
|
|
4341
|
+
* const consumerWebauthnOptions = await auth.consumer("my-app").passkey.options({ tenant_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b" });
|
|
3879
4342
|
* ```
|
|
3880
4343
|
*/
|
|
3881
4344
|
options(params, options) {
|
|
@@ -3898,7 +4361,7 @@ var ConsumerPasskeyResource = class extends APIResource {
|
|
|
3898
4361
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-passkey-verify
|
|
3899
4362
|
* @example
|
|
3900
4363
|
* ```ts
|
|
3901
|
-
* const consumerToken = await auth.consumer("app").passkey.verify({ credential: {} });
|
|
4364
|
+
* const consumerToken = await auth.consumer("my-app").passkey.verify({ credential: {} });
|
|
3902
4365
|
* ```
|
|
3903
4366
|
*/
|
|
3904
4367
|
verify(params, options) {
|
|
@@ -3911,6 +4374,11 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3911
4374
|
*
|
|
3912
4375
|
* 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`.
|
|
3913
4376
|
*
|
|
4377
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4378
|
+
* - `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.
|
|
4379
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4380
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4381
|
+
*
|
|
3914
4382
|
* @param params - `Auth.ConsumerScopedPermissionCreateParams`.
|
|
3915
4383
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
3916
4384
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3920,7 +4388,7 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3920
4388
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-admin-permissions
|
|
3921
4389
|
* @example
|
|
3922
4390
|
* ```ts
|
|
3923
|
-
* const consumerAdminPermission = await auth.consumer("app").permissions.create({ action: "read", resource: "project" });
|
|
4391
|
+
* const consumerAdminPermission = await auth.consumer("my-app").permissions.create({ action: "read", resource: "project" });
|
|
3924
4392
|
* ```
|
|
3925
4393
|
*/
|
|
3926
4394
|
create(params, options) {
|
|
@@ -3931,6 +4399,11 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3931
4399
|
*
|
|
3932
4400
|
* 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.
|
|
3933
4401
|
*
|
|
4402
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4403
|
+
* - `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.
|
|
4404
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4405
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4406
|
+
*
|
|
3934
4407
|
* @param permissionKey - Permission key, `resource.action` (e.g. `invoice.read`).
|
|
3935
4408
|
* @param options - Per-request options.
|
|
3936
4409
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: permissionKey must be in `resource.action` format.
|
|
@@ -3942,7 +4415,7 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3942
4415
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-admin-permissions-permission-key
|
|
3943
4416
|
* @example
|
|
3944
4417
|
* ```ts
|
|
3945
|
-
* await auth.consumer("app").permissions.delete("
|
|
4418
|
+
* await auth.consumer("my-app").permissions.delete("invoice.read");
|
|
3946
4419
|
* ```
|
|
3947
4420
|
*/
|
|
3948
4421
|
delete(permissionKey, options) {
|
|
@@ -3953,6 +4426,11 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3953
4426
|
*
|
|
3954
4427
|
* 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.
|
|
3955
4428
|
*
|
|
4429
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4430
|
+
* - `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.
|
|
4431
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4432
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4433
|
+
*
|
|
3956
4434
|
* @param options - Per-request options.
|
|
3957
4435
|
* @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.
|
|
3958
4436
|
* @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.
|
|
@@ -3962,7 +4440,7 @@ var ConsumerPermissionsResource = class extends APIResource {
|
|
|
3962
4440
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-admin-permissions
|
|
3963
4441
|
* @example
|
|
3964
4442
|
* ```ts
|
|
3965
|
-
* const result = await auth.consumer("app").permissions.list();
|
|
4443
|
+
* const result = await auth.consumer("my-app").permissions.list();
|
|
3966
4444
|
* ```
|
|
3967
4445
|
*/
|
|
3968
4446
|
list(options) {
|
|
@@ -3975,6 +4453,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
3975
4453
|
*
|
|
3976
4454
|
* 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.
|
|
3977
4455
|
*
|
|
4456
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4457
|
+
* - `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.
|
|
4458
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4459
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4460
|
+
*
|
|
3978
4461
|
* @param params - `Auth.ConsumerScopedRoleCreateParams`.
|
|
3979
4462
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
3980
4463
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -3984,7 +4467,7 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
3984
4467
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-admin-roles
|
|
3985
4468
|
* @example
|
|
3986
4469
|
* ```ts
|
|
3987
|
-
* const consumerRole = await auth.consumer("app").roles.create({ name: "editor" });
|
|
4470
|
+
* const consumerRole = await auth.consumer("my-app").roles.create({ name: "editor" });
|
|
3988
4471
|
* ```
|
|
3989
4472
|
*/
|
|
3990
4473
|
create(params, options) {
|
|
@@ -3995,6 +4478,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
3995
4478
|
*
|
|
3996
4479
|
* 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.
|
|
3997
4480
|
*
|
|
4481
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4482
|
+
* - `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.
|
|
4483
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4484
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4485
|
+
*
|
|
3998
4486
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
3999
4487
|
* @param options - Per-request options.
|
|
4000
4488
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -4005,7 +4493,7 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4005
4493
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-admin-roles-role-name
|
|
4006
4494
|
* @example
|
|
4007
4495
|
* ```ts
|
|
4008
|
-
* await auth.consumer("app").roles.delete("
|
|
4496
|
+
* await auth.consumer("my-app").roles.delete("admin");
|
|
4009
4497
|
* ```
|
|
4010
4498
|
*/
|
|
4011
4499
|
delete(roleName, options) {
|
|
@@ -4016,6 +4504,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4016
4504
|
*
|
|
4017
4505
|
* Cursor-paginated by `created_at`. Use the returned `next_cursor` in subsequent calls — offset pagination is not exposed.
|
|
4018
4506
|
*
|
|
4507
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4508
|
+
* - `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.
|
|
4509
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4510
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4511
|
+
*
|
|
4019
4512
|
* @param params - `Auth.ConsumerScopedRoleListParams`.
|
|
4020
4513
|
* @param options - Per-request options.
|
|
4021
4514
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Malformed `cursor`.
|
|
@@ -4027,10 +4520,10 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4027
4520
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-admin-roles
|
|
4028
4521
|
* @example
|
|
4029
4522
|
* ```ts
|
|
4030
|
-
* for await (const role of auth.consumer("app").roles.list()) {
|
|
4523
|
+
* for await (const role of auth.consumer("my-app").roles.list()) {
|
|
4031
4524
|
* console.log(role);
|
|
4032
4525
|
* }
|
|
4033
|
-
* const page = await auth.consumer("app").roles.list({}, { timeout: 5_000 });
|
|
4526
|
+
* const page = await auth.consumer("my-app").roles.list({}, { timeout: 5_000 });
|
|
4034
4527
|
* ```
|
|
4035
4528
|
*/
|
|
4036
4529
|
list(params, options) {
|
|
@@ -4041,6 +4534,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4041
4534
|
*
|
|
4042
4535
|
* 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.
|
|
4043
4536
|
*
|
|
4537
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4538
|
+
* - `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.
|
|
4539
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4540
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4541
|
+
*
|
|
4044
4542
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
4045
4543
|
* @param options - Per-request options.
|
|
4046
4544
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -4050,7 +4548,7 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4050
4548
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-admin-roles-role-name
|
|
4051
4549
|
* @example
|
|
4052
4550
|
* ```ts
|
|
4053
|
-
* const consumerRoleWithPermissions = await auth.consumer("app").roles.retrieve("
|
|
4551
|
+
* const consumerRoleWithPermissions = await auth.consumer("my-app").roles.retrieve("admin");
|
|
4054
4552
|
* ```
|
|
4055
4553
|
*/
|
|
4056
4554
|
retrieve(roleName, options) {
|
|
@@ -4061,6 +4559,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4061
4559
|
*
|
|
4062
4560
|
* 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.
|
|
4063
4561
|
*
|
|
4562
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4563
|
+
* - `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.
|
|
4564
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4565
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4566
|
+
*
|
|
4064
4567
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
4065
4568
|
* @param params - `Auth.ConsumerScopedRoleUpdateParams`.
|
|
4066
4569
|
* @param options - Per-request options.
|
|
@@ -4071,7 +4574,7 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4071
4574
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-admin-roles-role-name
|
|
4072
4575
|
* @example
|
|
4073
4576
|
* ```ts
|
|
4074
|
-
* const consumerRole = await auth.consumer("app").roles.update("
|
|
4577
|
+
* const consumerRole = await auth.consumer("my-app").roles.update("admin", { description: "Updated description" });
|
|
4075
4578
|
* ```
|
|
4076
4579
|
*/
|
|
4077
4580
|
update(roleName, params, options) {
|
|
@@ -4082,6 +4585,11 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4082
4585
|
*
|
|
4083
4586
|
* 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.
|
|
4084
4587
|
*
|
|
4588
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
4589
|
+
* - `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.
|
|
4590
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
4591
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4592
|
+
*
|
|
4085
4593
|
* @param roleName - Name of the role (e.g. `admin`).
|
|
4086
4594
|
* @param params - `Auth.ConsumerScopedRoleUpdatePermissionsParams`.
|
|
4087
4595
|
* @param options - Per-request options.
|
|
@@ -4094,7 +4602,7 @@ var ConsumerRolesResource = class extends APIResource {
|
|
|
4094
4602
|
* @see https://productcraft.co/docs/auth/api-reference#put-app-slug-v1-admin-roles-role-name-permissions
|
|
4095
4603
|
* @example
|
|
4096
4604
|
* ```ts
|
|
4097
|
-
* const result = await auth.consumer("app").roles.updatePermissions("
|
|
4605
|
+
* const result = await auth.consumer("my-app").roles.updatePermissions("admin", { permissions: ["user.read", "role.create"] });
|
|
4098
4606
|
* ```
|
|
4099
4607
|
*/
|
|
4100
4608
|
updatePermissions(roleName, params, options) {
|
|
@@ -4107,6 +4615,9 @@ var ConsumerTenantApiKeysConfigResource = class extends APIResource {
|
|
|
4107
4615
|
*
|
|
4108
4616
|
* Requires `auth.tenant.api_keys.configure` on the app.
|
|
4109
4617
|
*
|
|
4618
|
+
* Credential: `workspace_key`.
|
|
4619
|
+
* - `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.
|
|
4620
|
+
*
|
|
4110
4621
|
* @param options - Per-request options.
|
|
4111
4622
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, malformed or revoked Platform API Key (`Authorization: Bearer pcft_live_…`).
|
|
4112
4623
|
* @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>`.
|
|
@@ -4117,7 +4628,7 @@ var ConsumerTenantApiKeysConfigResource = class extends APIResource {
|
|
|
4117
4628
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenant-api-keys-config
|
|
4118
4629
|
* @example
|
|
4119
4630
|
* ```ts
|
|
4120
|
-
* const tenantApiKeysConfig = await auth.consumer("app").tenantApiKeys.config.retrieve();
|
|
4631
|
+
* const tenantApiKeysConfig = await auth.consumer("my-app").tenantApiKeys.config.retrieve();
|
|
4121
4632
|
* ```
|
|
4122
4633
|
*/
|
|
4123
4634
|
retrieve(options) {
|
|
@@ -4128,6 +4639,9 @@ var ConsumerTenantApiKeysConfigResource = class extends APIResource {
|
|
|
4128
4639
|
*
|
|
4129
4640
|
* 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.
|
|
4130
4641
|
*
|
|
4642
|
+
* Credential: `workspace_key`.
|
|
4643
|
+
* - `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.
|
|
4644
|
+
*
|
|
4131
4645
|
* @param params - `Auth.ConsumerScopedTenantApiKeyConfigUpdateParams`.
|
|
4132
4646
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
4133
4647
|
* @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`.
|
|
@@ -4140,7 +4654,7 @@ var ConsumerTenantApiKeysConfigResource = class extends APIResource {
|
|
|
4140
4654
|
* @see https://productcraft.co/docs/auth/api-reference#put-app-slug-v1-tenant-api-keys-config
|
|
4141
4655
|
* @example
|
|
4142
4656
|
* ```ts
|
|
4143
|
-
* const tenantApiKeysConfig = await auth.consumer("app").tenantApiKeys.config.update({ default_expiry_days: 7 });
|
|
4657
|
+
* const tenantApiKeysConfig = await auth.consumer("my-app").tenantApiKeys.config.update({ default_expiry_days: 7 });
|
|
4144
4658
|
* ```
|
|
4145
4659
|
*/
|
|
4146
4660
|
update(params, options) {
|
|
@@ -4157,6 +4671,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4157
4671
|
*
|
|
4158
4672
|
* 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`.
|
|
4159
4673
|
*
|
|
4674
|
+
* Credential: `end_user_token`.
|
|
4675
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4676
|
+
*
|
|
4160
4677
|
* @param params - `Auth.TenantApiKeyCreateParams`.
|
|
4161
4678
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
4162
4679
|
* @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`.
|
|
@@ -4169,7 +4686,7 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4169
4686
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenant-api-keys
|
|
4170
4687
|
* @example
|
|
4171
4688
|
* ```ts
|
|
4172
|
-
* const tenantApiKeyWithSecret = await auth.consumer("app").tenantApiKeys.create({ name: "CI e2e", scopes: ["disputes.read", "audit.read"] });
|
|
4689
|
+
* const tenantApiKeyWithSecret = await auth.consumer("my-app").tenantApiKeys.create({ name: "CI e2e", scopes: ["disputes.read", "audit.read"] });
|
|
4173
4690
|
* ```
|
|
4174
4691
|
*/
|
|
4175
4692
|
create(params, options) {
|
|
@@ -4180,6 +4697,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4180
4697
|
*
|
|
4181
4698
|
* Immediate and final. Idempotent: revoking a revoked key is a 204 that changes nothing.
|
|
4182
4699
|
*
|
|
4700
|
+
* Credential: `end_user_token`.
|
|
4701
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4702
|
+
*
|
|
4183
4703
|
* @param keyId - Key id (UUID) or display id (`tak_…`).
|
|
4184
4704
|
* @param options - Per-request options.
|
|
4185
4705
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid end-user bearer token (M2M tokens, PAKs and API keys are refused).
|
|
@@ -4190,7 +4710,7 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4190
4710
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-tenant-api-keys-key-id
|
|
4191
4711
|
* @example
|
|
4192
4712
|
* ```ts
|
|
4193
|
-
* await auth.consumer("app").tenantApiKeys.delete("
|
|
4713
|
+
* await auth.consumer("my-app").tenantApiKeys.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4194
4714
|
* ```
|
|
4195
4715
|
*/
|
|
4196
4716
|
delete(keyId, options) {
|
|
@@ -4201,6 +4721,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4201
4721
|
*
|
|
4202
4722
|
* 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.
|
|
4203
4723
|
*
|
|
4724
|
+
* Credential: `workspace_key`.
|
|
4725
|
+
* - `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.
|
|
4726
|
+
*
|
|
4204
4727
|
* @param params - `Auth.TenantApiKeyIntrospectParams`.
|
|
4205
4728
|
* @param options - Per-request options.
|
|
4206
4729
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `key` missing or not a string.
|
|
@@ -4213,7 +4736,7 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4213
4736
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenant-api-keys-introspect
|
|
4214
4737
|
* @example
|
|
4215
4738
|
* ```ts
|
|
4216
|
-
* const tenantApiKeyIntrospection = await auth.consumer("app").tenantApiKeys.introspect({ key: "pctk_live_4fQ2aZ0000000000000000000000000000000000000_1a2B3c" });
|
|
4739
|
+
* const tenantApiKeyIntrospection = await auth.consumer("my-app").tenantApiKeys.introspect({ key: "pctk_live_4fQ2aZ0000000000000000000000000000000000000_1a2B3c" });
|
|
4217
4740
|
* ```
|
|
4218
4741
|
*/
|
|
4219
4742
|
introspect(params, options) {
|
|
@@ -4224,6 +4747,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4224
4747
|
*
|
|
4225
4748
|
* Newest first, cursor-paginated (20 per page, max 100). Secrets are never returned; `key_prefix` and `last4` identify a key.
|
|
4226
4749
|
*
|
|
4750
|
+
* Credential: `end_user_token`.
|
|
4751
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4752
|
+
*
|
|
4227
4753
|
* @param params - `Auth.ConsumerScopedTenantApiKeyListParams`.
|
|
4228
4754
|
* @param options - Per-request options.
|
|
4229
4755
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `status` or malformed `cursor`.
|
|
@@ -4235,10 +4761,10 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4235
4761
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenant-api-keys
|
|
4236
4762
|
* @example
|
|
4237
4763
|
* ```ts
|
|
4238
|
-
* for await (const tenantApiKey of auth.consumer("app").tenantApiKeys.list()) {
|
|
4764
|
+
* for await (const tenantApiKey of auth.consumer("my-app").tenantApiKeys.list()) {
|
|
4239
4765
|
* console.log(tenantApiKey);
|
|
4240
4766
|
* }
|
|
4241
|
-
* const page = await auth.consumer("app").tenantApiKeys.list({}, { timeout: 5_000 });
|
|
4767
|
+
* const page = await auth.consumer("my-app").tenantApiKeys.list({}, { timeout: 5_000 });
|
|
4242
4768
|
* ```
|
|
4243
4769
|
*/
|
|
4244
4770
|
list(params, options) {
|
|
@@ -4249,6 +4775,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4249
4775
|
*
|
|
4250
4776
|
* 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`.
|
|
4251
4777
|
*
|
|
4778
|
+
* Credential: `end_user_token`.
|
|
4779
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
4780
|
+
*
|
|
4252
4781
|
* @param keyId - Key id (UUID) or display id (`tak_…`).
|
|
4253
4782
|
* @param params - `Auth.TenantApiKeyRotateParams`.
|
|
4254
4783
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -4262,7 +4791,7 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4262
4791
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenant-api-keys-key-id-rotate
|
|
4263
4792
|
* @example
|
|
4264
4793
|
* ```ts
|
|
4265
|
-
* const tenantApiKeyWithSecret = await auth.consumer("app").tenantApiKeys.rotate("
|
|
4794
|
+
* const tenantApiKeyWithSecret = await auth.consumer("my-app").tenantApiKeys.rotate("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { expires_in_days: 7 });
|
|
4266
4795
|
* ```
|
|
4267
4796
|
*/
|
|
4268
4797
|
rotate(keyId, params, options) {
|
|
@@ -4273,6 +4802,9 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4273
4802
|
*
|
|
4274
4803
|
* 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.
|
|
4275
4804
|
*
|
|
4805
|
+
* Credential: `workspace_key`.
|
|
4806
|
+
* - `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.
|
|
4807
|
+
*
|
|
4276
4808
|
* @param keyId - Key id (UUID) or display id (`tak_…`), as `introspect` returned it.
|
|
4277
4809
|
* @param options - Per-request options.
|
|
4278
4810
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, malformed or revoked Platform API Key (`Authorization: Bearer pcft_live_…`).
|
|
@@ -4284,7 +4816,7 @@ var ConsumerTenantApiKeysResource = class extends APIResource {
|
|
|
4284
4816
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenant-api-keys-key-id-status
|
|
4285
4817
|
* @example
|
|
4286
4818
|
* ```ts
|
|
4287
|
-
* const tenantApiKeyStatus = await auth.consumer("app").tenantApiKeys.status("
|
|
4819
|
+
* const tenantApiKeyStatus = await auth.consumer("my-app").tenantApiKeys.status("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4288
4820
|
* ```
|
|
4289
4821
|
*/
|
|
4290
4822
|
status(keyId, options) {
|
|
@@ -4297,6 +4829,9 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4297
4829
|
*
|
|
4298
4830
|
* 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.
|
|
4299
4831
|
*
|
|
4832
|
+
* Credential: `workspace_key`.
|
|
4833
|
+
* - `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.
|
|
4834
|
+
*
|
|
4300
4835
|
* @param tenantId - Id of the tenant.
|
|
4301
4836
|
* @param params - `Auth.ConsumerScopedTenantInviteCreateParams`.
|
|
4302
4837
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -4310,7 +4845,7 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4310
4845
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenants-tenant-id-invites
|
|
4311
4846
|
* @example
|
|
4312
4847
|
* ```ts
|
|
4313
|
-
* const createTenantInvite = await auth.consumer("app").tenants.invites.create("
|
|
4848
|
+
* const createTenantInvite = await auth.consumer("my-app").tenants.invites.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { email: "alice@example.com", role_name: "member" });
|
|
4314
4849
|
* ```
|
|
4315
4850
|
*/
|
|
4316
4851
|
create(tenantId, params, options) {
|
|
@@ -4319,6 +4854,9 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4319
4854
|
/**
|
|
4320
4855
|
* 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.
|
|
4321
4856
|
*
|
|
4857
|
+
* Credential: `workspace_key`.
|
|
4858
|
+
* - `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.
|
|
4859
|
+
*
|
|
4322
4860
|
* @param tenantId - Id of the tenant.
|
|
4323
4861
|
* @param inviteId - Id of the invite.
|
|
4324
4862
|
* @param options - Per-request options.
|
|
@@ -4329,7 +4867,7 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4329
4867
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-tenants-tenant-id-invites-invite-id
|
|
4330
4868
|
* @example
|
|
4331
4869
|
* ```ts
|
|
4332
|
-
* await auth.consumer("app").tenants.invites.delete("
|
|
4870
|
+
* await auth.consumer("my-app").tenants.invites.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4333
4871
|
* ```
|
|
4334
4872
|
*/
|
|
4335
4873
|
delete(tenantId, inviteId, options) {
|
|
@@ -4340,6 +4878,9 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4340
4878
|
*
|
|
4341
4879
|
* Codes are never returned here — only the digest is stored. Use `status=pending` to show outstanding invitations.
|
|
4342
4880
|
*
|
|
4881
|
+
* Credential: `workspace_key`.
|
|
4882
|
+
* - `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.
|
|
4883
|
+
*
|
|
4343
4884
|
* @param tenantId - Id of the tenant.
|
|
4344
4885
|
* @param params - `Auth.ConsumerScopedTenantInviteListParams`.
|
|
4345
4886
|
* @param options - Per-request options.
|
|
@@ -4351,10 +4892,10 @@ var ConsumerTenantsInvitesResource = class extends APIResource {
|
|
|
4351
4892
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenants-tenant-id-invites
|
|
4352
4893
|
* @example
|
|
4353
4894
|
* ```ts
|
|
4354
|
-
* for await (const invite of auth.consumer("app").tenants.invites.list("
|
|
4895
|
+
* for await (const invite of auth.consumer("my-app").tenants.invites.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
|
|
4355
4896
|
* console.log(invite);
|
|
4356
4897
|
* }
|
|
4357
|
-
* const page = await auth.consumer("app").tenants.invites.list("
|
|
4898
|
+
* const page = await auth.consumer("my-app").tenants.invites.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
|
|
4358
4899
|
* ```
|
|
4359
4900
|
*/
|
|
4360
4901
|
list(tenantId, params, options) {
|
|
@@ -4365,6 +4906,9 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4365
4906
|
/**
|
|
4366
4907
|
* 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.
|
|
4367
4908
|
*
|
|
4909
|
+
* Credential: `workspace_key`.
|
|
4910
|
+
* - `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.
|
|
4911
|
+
*
|
|
4368
4912
|
* @param tenantId - Id of the tenant.
|
|
4369
4913
|
* @param params - `Auth.ConsumerScopedTenantMemberCreateParams`.
|
|
4370
4914
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -4377,7 +4921,7 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4377
4921
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenants-tenant-id-members
|
|
4378
4922
|
* @example
|
|
4379
4923
|
* ```ts
|
|
4380
|
-
* const consumerAddMember = await auth.consumer("app").tenants.members.create("
|
|
4924
|
+
* const consumerAddMember = await auth.consumer("my-app").tenants.members.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "member" });
|
|
4381
4925
|
* ```
|
|
4382
4926
|
*/
|
|
4383
4927
|
create(tenantId, params, options) {
|
|
@@ -4386,6 +4930,9 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4386
4930
|
/**
|
|
4387
4931
|
* 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.
|
|
4388
4932
|
*
|
|
4933
|
+
* Credential: `workspace_key`.
|
|
4934
|
+
* - `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.
|
|
4935
|
+
*
|
|
4389
4936
|
* @param tenantId - Id of the tenant.
|
|
4390
4937
|
* @param accountId - Id of the account.
|
|
4391
4938
|
* @param options - Per-request options.
|
|
@@ -4396,7 +4943,7 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4396
4943
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-tenants-tenant-id-members-account-id
|
|
4397
4944
|
* @example
|
|
4398
4945
|
* ```ts
|
|
4399
|
-
* await auth.consumer("app").tenants.members.delete("
|
|
4946
|
+
* await auth.consumer("my-app").tenants.members.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4400
4947
|
* ```
|
|
4401
4948
|
*/
|
|
4402
4949
|
delete(tenantId, accountId, options) {
|
|
@@ -4405,6 +4952,9 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4405
4952
|
/**
|
|
4406
4953
|
* List members of a tenant. Cursor-paginated by joined_at desc. Filter by `?search=` and/or `?role=`. PAK must hold auth.tenant.read.
|
|
4407
4954
|
*
|
|
4955
|
+
* Credential: `workspace_key`.
|
|
4956
|
+
* - `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.
|
|
4957
|
+
*
|
|
4408
4958
|
* @param tenantId - Id of the tenant.
|
|
4409
4959
|
* @param params - `Auth.ConsumerScopedTenantMemberListParams`.
|
|
4410
4960
|
* @param options - Per-request options.
|
|
@@ -4418,10 +4968,10 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4418
4968
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenants-tenant-id-members
|
|
4419
4969
|
* @example
|
|
4420
4970
|
* ```ts
|
|
4421
|
-
* for await (const member of auth.consumer("app").tenants.members.list("
|
|
4971
|
+
* for await (const member of auth.consumer("my-app").tenants.members.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
|
|
4422
4972
|
* console.log(member);
|
|
4423
4973
|
* }
|
|
4424
|
-
* const page = await auth.consumer("app").tenants.members.list("
|
|
4974
|
+
* const page = await auth.consumer("my-app").tenants.members.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
|
|
4425
4975
|
* ```
|
|
4426
4976
|
*/
|
|
4427
4977
|
list(tenantId, params, options) {
|
|
@@ -4430,6 +4980,9 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4430
4980
|
/**
|
|
4431
4981
|
* Change a member's role. PAK must hold auth.tenant.members.update-role.
|
|
4432
4982
|
*
|
|
4983
|
+
* Credential: `workspace_key`.
|
|
4984
|
+
* - `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.
|
|
4985
|
+
*
|
|
4433
4986
|
* @param tenantId - Id of the tenant.
|
|
4434
4987
|
* @param accountId - Id of the account.
|
|
4435
4988
|
* @param params - `Auth.ConsumerScopedTenantMemberUpdateParams`.
|
|
@@ -4442,7 +4995,7 @@ var ConsumerTenantsMembersResource = class extends APIResource {
|
|
|
4442
4995
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-tenants-tenant-id-members-account-id
|
|
4443
4996
|
* @example
|
|
4444
4997
|
* ```ts
|
|
4445
|
-
* const consumerTenantMembership = await auth.consumer("app").tenants.members.update("
|
|
4998
|
+
* const consumerTenantMembership = await auth.consumer("my-app").tenants.members.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "admin" });
|
|
4446
4999
|
* ```
|
|
4447
5000
|
*/
|
|
4448
5001
|
update(tenantId, accountId, params, options) {
|
|
@@ -4461,6 +5014,9 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4461
5014
|
/**
|
|
4462
5015
|
* Create a tenant inside this app. Returns the new tenant with a `display_id` (`tnt_<12hex>`). PAK must hold auth.tenant.create.
|
|
4463
5016
|
*
|
|
5017
|
+
* Credential: `workspace_key`.
|
|
5018
|
+
* - `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.
|
|
5019
|
+
*
|
|
4464
5020
|
* @param params - `Auth.ConsumerScopedTenantCreateParams`.
|
|
4465
5021
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
4466
5022
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid display_name or slug.
|
|
@@ -4473,7 +5029,7 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4473
5029
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-tenants
|
|
4474
5030
|
* @example
|
|
4475
5031
|
* ```ts
|
|
4476
|
-
* const consumerTenant = await auth.consumer("app").tenants.create({ display_name: "Acme Co" });
|
|
5032
|
+
* const consumerTenant = await auth.consumer("my-app").tenants.create({ display_name: "Acme Co" });
|
|
4477
5033
|
* ```
|
|
4478
5034
|
*/
|
|
4479
5035
|
create(params, options) {
|
|
@@ -4482,6 +5038,9 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4482
5038
|
/**
|
|
4483
5039
|
* Delete a tenant. Cascades to tenant_membership rows; account rows are unaffected. PAK must hold auth.tenant.delete.
|
|
4484
5040
|
*
|
|
5041
|
+
* Credential: `workspace_key`.
|
|
5042
|
+
* - `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.
|
|
5043
|
+
*
|
|
4485
5044
|
* @param tenantId - Id of the tenant.
|
|
4486
5045
|
* @param options - Per-request options.
|
|
4487
5046
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -4491,7 +5050,7 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4491
5050
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-tenants-tenant-id
|
|
4492
5051
|
* @example
|
|
4493
5052
|
* ```ts
|
|
4494
|
-
* await auth.consumer("app").tenants.delete("
|
|
5053
|
+
* await auth.consumer("my-app").tenants.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4495
5054
|
* ```
|
|
4496
5055
|
*/
|
|
4497
5056
|
delete(tenantId, options) {
|
|
@@ -4500,6 +5059,9 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4500
5059
|
/**
|
|
4501
5060
|
* List tenants in this app, paginated by created_at desc. PAK must hold auth.tenant.read.
|
|
4502
5061
|
*
|
|
5062
|
+
* Credential: `workspace_key`.
|
|
5063
|
+
* - `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.
|
|
5064
|
+
*
|
|
4503
5065
|
* @param params - `Auth.ConsumerScopedTenantListParams`.
|
|
4504
5066
|
* @param options - Per-request options.
|
|
4505
5067
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid `status` filter or malformed `cursor`.
|
|
@@ -4512,10 +5074,10 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4512
5074
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenants
|
|
4513
5075
|
* @example
|
|
4514
5076
|
* ```ts
|
|
4515
|
-
* for await (const tenant of auth.consumer("app").tenants.list()) {
|
|
5077
|
+
* for await (const tenant of auth.consumer("my-app").tenants.list()) {
|
|
4516
5078
|
* console.log(tenant);
|
|
4517
5079
|
* }
|
|
4518
|
-
* const page = await auth.consumer("app").tenants.list({}, { timeout: 5_000 });
|
|
5080
|
+
* const page = await auth.consumer("my-app").tenants.list({}, { timeout: 5_000 });
|
|
4519
5081
|
* ```
|
|
4520
5082
|
*/
|
|
4521
5083
|
list(params, options) {
|
|
@@ -4524,6 +5086,9 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4524
5086
|
/**
|
|
4525
5087
|
* Fetch a single tenant by its UUID or `tnt_<12hex>` display id. PAK must hold auth.tenant.read.
|
|
4526
5088
|
*
|
|
5089
|
+
* Credential: `workspace_key`.
|
|
5090
|
+
* - `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.
|
|
5091
|
+
*
|
|
4527
5092
|
* @param tenantId - Id of the tenant.
|
|
4528
5093
|
* @param options - Per-request options.
|
|
4529
5094
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -4533,7 +5098,7 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4533
5098
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-tenants-tenant-id
|
|
4534
5099
|
* @example
|
|
4535
5100
|
* ```ts
|
|
4536
|
-
* const consumerTenant = await auth.consumer("app").tenants.retrieve("
|
|
5101
|
+
* const consumerTenant = await auth.consumer("my-app").tenants.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4537
5102
|
* ```
|
|
4538
5103
|
*/
|
|
4539
5104
|
retrieve(tenantId, options) {
|
|
@@ -4542,6 +5107,9 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4542
5107
|
/**
|
|
4543
5108
|
* Patch a tenant. Any subset of {display_name, slug, status, metadata}. PAK must hold auth.tenant.update.
|
|
4544
5109
|
*
|
|
5110
|
+
* Credential: `workspace_key`.
|
|
5111
|
+
* - `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.
|
|
5112
|
+
*
|
|
4545
5113
|
* @param tenantId - Id of the tenant.
|
|
4546
5114
|
* @param params - `Auth.ConsumerScopedTenantUpdateParams`.
|
|
4547
5115
|
* @param options - Per-request options.
|
|
@@ -4554,7 +5122,7 @@ var ConsumerTenantsResource = class extends APIResource {
|
|
|
4554
5122
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-tenants-tenant-id
|
|
4555
5123
|
* @example
|
|
4556
5124
|
* ```ts
|
|
4557
|
-
* const consumerTenant = await auth.consumer("app").tenants.update("
|
|
5125
|
+
* const consumerTenant = await auth.consumer("my-app").tenants.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { display_name: "Acme Inc" });
|
|
4558
5126
|
* ```
|
|
4559
5127
|
*/
|
|
4560
5128
|
update(tenantId, params, options) {
|
|
@@ -4567,6 +5135,9 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4567
5135
|
*
|
|
4568
5136
|
* 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`.
|
|
4569
5137
|
*
|
|
5138
|
+
* Credential: `workspace_key`.
|
|
5139
|
+
* - `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.
|
|
5140
|
+
*
|
|
4570
5141
|
* @param userId - Id of the user.
|
|
4571
5142
|
* @param params - `Auth.UserFactorCreateParams`.
|
|
4572
5143
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
@@ -4581,7 +5152,7 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4581
5152
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-users-user-id-factors
|
|
4582
5153
|
* @example
|
|
4583
5154
|
* ```ts
|
|
4584
|
-
* const adminProvisionFactor = await auth.consumer("app").users.factors.create("
|
|
5155
|
+
* const adminProvisionFactor = await auth.consumer("my-app").users.factors.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { type: "totp" });
|
|
4585
5156
|
* ```
|
|
4586
5157
|
*/
|
|
4587
5158
|
create(userId, params, options) {
|
|
@@ -4590,6 +5161,9 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4590
5161
|
/**
|
|
4591
5162
|
* Disable a user's MFA factor
|
|
4592
5163
|
*
|
|
5164
|
+
* Credential: `workspace_key`.
|
|
5165
|
+
* - `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.
|
|
5166
|
+
*
|
|
4593
5167
|
* @param userId - Id of the user.
|
|
4594
5168
|
* @param factorId - Id of the factor.
|
|
4595
5169
|
* @param options - Per-request options.
|
|
@@ -4602,7 +5176,7 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4602
5176
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-users-user-id-factors-factor-id
|
|
4603
5177
|
* @example
|
|
4604
5178
|
* ```ts
|
|
4605
|
-
* await auth.consumer("app").users.factors.delete("
|
|
5179
|
+
* await auth.consumer("my-app").users.factors.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4606
5180
|
* ```
|
|
4607
5181
|
*/
|
|
4608
5182
|
delete(userId, factorId, options) {
|
|
@@ -4611,6 +5185,9 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4611
5185
|
/**
|
|
4612
5186
|
* List a user's MFA factors
|
|
4613
5187
|
*
|
|
5188
|
+
* Credential: `workspace_key`.
|
|
5189
|
+
* - `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.
|
|
5190
|
+
*
|
|
4614
5191
|
* @param userId - Id of the user.
|
|
4615
5192
|
* @param options - Per-request options.
|
|
4616
5193
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing bearer token, or the Platform API Key is malformed, unknown or revoked.
|
|
@@ -4622,7 +5199,7 @@ var ConsumerUsersFactorsResource = class extends APIResource {
|
|
|
4622
5199
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-users-user-id-factors
|
|
4623
5200
|
* @example
|
|
4624
5201
|
* ```ts
|
|
4625
|
-
* const factorList = await auth.consumer("app").users.factors.list("
|
|
5202
|
+
* const factorList = await auth.consumer("my-app").users.factors.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4626
5203
|
* ```
|
|
4627
5204
|
*/
|
|
4628
5205
|
list(userId, options) {
|
|
@@ -4641,6 +5218,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4641
5218
|
*
|
|
4642
5219
|
* 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`.
|
|
4643
5220
|
*
|
|
5221
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5222
|
+
* - `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.
|
|
5223
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5224
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5225
|
+
*
|
|
4644
5226
|
* @param params - `Auth.UserCreateParams`.
|
|
4645
5227
|
* @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
|
|
4646
5228
|
* @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`.
|
|
@@ -4652,7 +5234,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4652
5234
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-admin-users
|
|
4653
5235
|
* @example
|
|
4654
5236
|
* ```ts
|
|
4655
|
-
* const consumerAdminCreatedUser = await auth.consumer("app").users.create({ email: "
|
|
5237
|
+
* const consumerAdminCreatedUser = await auth.consumer("my-app").users.create({ email: "ada@example.com" });
|
|
4656
5238
|
* ```
|
|
4657
5239
|
*/
|
|
4658
5240
|
create(params, options) {
|
|
@@ -4663,6 +5245,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4663
5245
|
*
|
|
4664
5246
|
* 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"`.
|
|
4665
5247
|
*
|
|
5248
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5249
|
+
* - `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.
|
|
5250
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5251
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5252
|
+
*
|
|
4666
5253
|
* @param userId - Id of the user.
|
|
4667
5254
|
* @param options - Per-request options.
|
|
4668
5255
|
* @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.
|
|
@@ -4673,7 +5260,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4673
5260
|
* @see https://productcraft.co/docs/auth/api-reference#delete-app-slug-v1-admin-users-user-id
|
|
4674
5261
|
* @example
|
|
4675
5262
|
* ```ts
|
|
4676
|
-
* await auth.consumer("app").users.delete("
|
|
5263
|
+
* await auth.consumer("my-app").users.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4677
5264
|
* ```
|
|
4678
5265
|
*/
|
|
4679
5266
|
delete(userId, options) {
|
|
@@ -4684,6 +5271,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4684
5271
|
*
|
|
4685
5272
|
* 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.
|
|
4686
5273
|
*
|
|
5274
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5275
|
+
* - `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.
|
|
5276
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5277
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5278
|
+
*
|
|
4687
5279
|
* @param params - `Auth.UserListParams`.
|
|
4688
5280
|
* @param options - Per-request options.
|
|
4689
5281
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Malformed `cursor`, or a cursor issued for a different sort order.
|
|
@@ -4695,10 +5287,10 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4695
5287
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-admin-users
|
|
4696
5288
|
* @example
|
|
4697
5289
|
* ```ts
|
|
4698
|
-
* for await (const user of auth.consumer("app").users.list()) {
|
|
5290
|
+
* for await (const user of auth.consumer("my-app").users.list()) {
|
|
4699
5291
|
* console.log(user);
|
|
4700
5292
|
* }
|
|
4701
|
-
* const page = await auth.consumer("app").users.list({}, { timeout: 5_000 });
|
|
5293
|
+
* const page = await auth.consumer("my-app").users.list({}, { timeout: 5_000 });
|
|
4702
5294
|
* ```
|
|
4703
5295
|
*/
|
|
4704
5296
|
list(params, options) {
|
|
@@ -4707,6 +5299,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4707
5299
|
/**
|
|
4708
5300
|
* Read one end-user
|
|
4709
5301
|
*
|
|
5302
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5303
|
+
* - `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.
|
|
5304
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5305
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5306
|
+
*
|
|
4710
5307
|
* @param userId - Id of the user.
|
|
4711
5308
|
* @param options - Per-request options.
|
|
4712
5309
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, invalid or expired bearer token.
|
|
@@ -4716,7 +5313,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4716
5313
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-v1-admin-users-user-id
|
|
4717
5314
|
* @example
|
|
4718
5315
|
* ```ts
|
|
4719
|
-
* const consumerAdminEndUser = await auth.consumer("app").users.retrieve("
|
|
5316
|
+
* const consumerAdminEndUser = await auth.consumer("my-app").users.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
|
|
4720
5317
|
* ```
|
|
4721
5318
|
*/
|
|
4722
5319
|
retrieve(userId, options) {
|
|
@@ -4727,6 +5324,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4727
5324
|
*
|
|
4728
5325
|
* Email update promotes an existing contact to primary (not for creating new contacts — that goes through the per-contact flow).
|
|
4729
5326
|
*
|
|
5327
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5328
|
+
* - `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.
|
|
5329
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5330
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5331
|
+
*
|
|
4730
5332
|
* @param userId - Id of the user.
|
|
4731
5333
|
* @param params - `Auth.UserUpdateParams`.
|
|
4732
5334
|
* @param options - Per-request options.
|
|
@@ -4739,7 +5341,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4739
5341
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-admin-users-user-id
|
|
4740
5342
|
* @example
|
|
4741
5343
|
* ```ts
|
|
4742
|
-
* const consumerAdminEndUser = await auth.consumer("app").users.update("
|
|
5344
|
+
* const consumerAdminEndUser = await auth.consumer("my-app").users.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { display_name: "Ada Lovelace" });
|
|
4743
5345
|
* ```
|
|
4744
5346
|
*/
|
|
4745
5347
|
update(userId, params, options) {
|
|
@@ -4750,6 +5352,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4750
5352
|
*
|
|
4751
5353
|
* 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.
|
|
4752
5354
|
*
|
|
5355
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5356
|
+
* - `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.
|
|
5357
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5358
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5359
|
+
*
|
|
4753
5360
|
* @param userId - Id of the user.
|
|
4754
5361
|
* @param params - `Auth.UserUpdateRoleParams`.
|
|
4755
5362
|
* @param options - Per-request options.
|
|
@@ -4762,7 +5369,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4762
5369
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-admin-users-user-id-role
|
|
4763
5370
|
* @example
|
|
4764
5371
|
* ```ts
|
|
4765
|
-
* const consumerAdminRoleAssignment = await auth.consumer("app").users.updateRole("
|
|
5372
|
+
* const consumerAdminRoleAssignment = await auth.consumer("my-app").users.updateRole("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { role_name: "member" });
|
|
4766
5373
|
* ```
|
|
4767
5374
|
*/
|
|
4768
5375
|
updateRole(userId, params, options) {
|
|
@@ -4773,6 +5380,11 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4773
5380
|
*
|
|
4774
5381
|
* Setting status to `suspended` or `deactivated` also revokes all active sessions for the user (same behaviour as the auth-admin equivalent).
|
|
4775
5382
|
*
|
|
5383
|
+
* Credential: one of `app_api_key`, `m2m_token`, `end_user_token`.
|
|
5384
|
+
* - `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.
|
|
5385
|
+
* - `m2m_token`: An access token from this app's client-credentials grant (`POST /{app_slug}/v1/oauth/token`).
|
|
5386
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5387
|
+
*
|
|
4776
5388
|
* @param userId - Id of the user.
|
|
4777
5389
|
* @param params - `Auth.UserUpdateStatusParams`.
|
|
4778
5390
|
* @param options - Per-request options.
|
|
@@ -4785,7 +5397,7 @@ var ConsumerUsersResource = class extends APIResource {
|
|
|
4785
5397
|
* @see https://productcraft.co/docs/auth/api-reference#patch-app-slug-v1-admin-users-user-id-status
|
|
4786
5398
|
* @example
|
|
4787
5399
|
* ```ts
|
|
4788
|
-
* const consumerAdminEndUser = await auth.consumer("app").users.updateStatus("
|
|
5400
|
+
* const consumerAdminEndUser = await auth.consumer("my-app").users.updateStatus("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { status: "active" });
|
|
4789
5401
|
* ```
|
|
4790
5402
|
*/
|
|
4791
5403
|
updateStatus(userId, params, options) {
|
|
@@ -4809,7 +5421,7 @@ var ConsumerVerifyResource = class extends APIResource {
|
|
|
4809
5421
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-authorize
|
|
4810
5422
|
* @example
|
|
4811
5423
|
* ```ts
|
|
4812
|
-
* const authorize = await auth.consumer("app").verify.authorize({ permission: "
|
|
5424
|
+
* const authorize = await auth.consumer("my-app").verify.authorize({ permission: "invoice.read" });
|
|
4813
5425
|
* ```
|
|
4814
5426
|
*/
|
|
4815
5427
|
authorize(params, options) {
|
|
@@ -4831,7 +5443,7 @@ var ConsumerVerifyResource = class extends APIResource {
|
|
|
4831
5443
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-authorize-batch
|
|
4832
5444
|
* @example
|
|
4833
5445
|
* ```ts
|
|
4834
|
-
* const authorizeBatch = await auth.consumer("app").verify.authorizeBatch({ checks: [{}] });
|
|
5446
|
+
* const authorizeBatch = await auth.consumer("my-app").verify.authorizeBatch({ checks: [{}] });
|
|
4835
5447
|
* ```
|
|
4836
5448
|
*/
|
|
4837
5449
|
authorizeBatch(params, options) {
|
|
@@ -4853,7 +5465,7 @@ var ConsumerVerifyResource = class extends APIResource {
|
|
|
4853
5465
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-verify
|
|
4854
5466
|
* @example
|
|
4855
5467
|
* ```ts
|
|
4856
|
-
* const verify = await auth.consumer("app").verify.token({ token: "
|
|
5468
|
+
* const verify = await auth.consumer("my-app").verify.token({ token: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJzdWIiOiJ1c3JfMSJ9.c2lnbmF0dXJl" });
|
|
4857
5469
|
* ```
|
|
4858
5470
|
*/
|
|
4859
5471
|
token(params, options) {
|
|
@@ -4881,7 +5493,7 @@ var ConsumerWellKnownResource = class extends APIResource {
|
|
|
4881
5493
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-well-known-jwks-json
|
|
4882
5494
|
* @example
|
|
4883
5495
|
* ```ts
|
|
4884
|
-
* const jwks = await auth.consumer("app").wellKnown.jwks();
|
|
5496
|
+
* const jwks = await auth.consumer("my-app").wellKnown.jwks();
|
|
4885
5497
|
* ```
|
|
4886
5498
|
*/
|
|
4887
5499
|
jwks(options) {
|
|
@@ -4899,7 +5511,7 @@ var ConsumerWellKnownResource = class extends APIResource {
|
|
|
4899
5511
|
* @see https://productcraft.co/docs/auth/api-reference#get-app-slug-well-known-openid-configuration
|
|
4900
5512
|
* @example
|
|
4901
5513
|
* ```ts
|
|
4902
|
-
* const openIdConfiguration = await auth.consumer("app").wellKnown.openidConfiguration();
|
|
5514
|
+
* const openIdConfiguration = await auth.consumer("my-app").wellKnown.openidConfiguration();
|
|
4903
5515
|
* ```
|
|
4904
5516
|
*/
|
|
4905
5517
|
openidConfiguration(options) {
|
|
@@ -4975,7 +5587,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
4975
5587
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-accept-invite
|
|
4976
5588
|
* @example
|
|
4977
5589
|
* ```ts
|
|
4978
|
-
* const result = await auth.consumer("app").acceptInvite({ code: "inv_x7H2k3jLqXr", password: "CorrectHorseBatteryStaple" });
|
|
5590
|
+
* const result = await auth.consumer("my-app").acceptInvite({ code: "inv_x7H2k3jLqXr", password: "CorrectHorseBatteryStaple" });
|
|
4979
5591
|
* ```
|
|
4980
5592
|
*/
|
|
4981
5593
|
acceptInvite(params, options) {
|
|
@@ -5000,7 +5612,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5000
5612
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-accept-tenant-invite
|
|
5001
5613
|
* @example
|
|
5002
5614
|
* ```ts
|
|
5003
|
-
* const consumerToken = await auth.consumer("app").acceptTenantInvite({ code: "tinv_9dK2mQ7pR4vXbN1sT6yZ0hLcJeW3fAgU", password: "CorrectHorseBatteryStaple" });
|
|
5615
|
+
* const consumerToken = await auth.consumer("my-app").acceptTenantInvite({ code: "tinv_9dK2mQ7pR4vXbN1sT6yZ0hLcJeW3fAgU", password: "CorrectHorseBatteryStaple" });
|
|
5004
5616
|
* ```
|
|
5005
5617
|
*/
|
|
5006
5618
|
acceptTenantInvite(params, options) {
|
|
@@ -5018,7 +5630,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5018
5630
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-oauth-exchange
|
|
5019
5631
|
* @example
|
|
5020
5632
|
* ```ts
|
|
5021
|
-
* const exchange = await auth.consumer("app").exchangeProviderCode({ code: "
|
|
5633
|
+
* const exchange = await auth.consumer("my-app").exchangeProviderCode({ code: "hc_8f14e45fceea167a5a36dedd4bea2543" });
|
|
5022
5634
|
* ```
|
|
5023
5635
|
*/
|
|
5024
5636
|
exchangeProviderCode(params, options) {
|
|
@@ -5041,7 +5653,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5041
5653
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-logout
|
|
5042
5654
|
* @example
|
|
5043
5655
|
* ```ts
|
|
5044
|
-
* await auth.consumer("app").logout({
|
|
5656
|
+
* await auth.consumer("my-app").logout({
|
|
5657
|
+
* refresh_token: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJ0eXAiOiJyZWZyZXNoIn0.c2lnbmF0dXJl",
|
|
5658
|
+
* });
|
|
5045
5659
|
* ```
|
|
5046
5660
|
*/
|
|
5047
5661
|
logout(params, options) {
|
|
@@ -5064,7 +5678,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5064
5678
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-refresh
|
|
5065
5679
|
* @example
|
|
5066
5680
|
* ```ts
|
|
5067
|
-
* const consumerToken = await auth.consumer("app").refresh({
|
|
5681
|
+
* const consumerToken = await auth.consumer("my-app").refresh({
|
|
5682
|
+
* refresh_token: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJ0eXAiOiJyZWZyZXNoIn0.c2lnbmF0dXJl",
|
|
5683
|
+
* });
|
|
5068
5684
|
* ```
|
|
5069
5685
|
*/
|
|
5070
5686
|
refresh(params, options) {
|
|
@@ -5079,6 +5695,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5079
5695
|
*
|
|
5080
5696
|
* Renamed from /auth/request-reset.
|
|
5081
5697
|
*
|
|
5698
|
+
* Credential: `workspace_key`.
|
|
5699
|
+
* - `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.
|
|
5700
|
+
*
|
|
5082
5701
|
* @param params - `Auth.RequestPasswordResetParams`.
|
|
5083
5702
|
* @param options - Per-request options.
|
|
5084
5703
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Provide exactly one of `email` or `phone`, or request validation failed in the global `ValidationPipe`.
|
|
@@ -5091,7 +5710,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5091
5710
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-request-password-reset
|
|
5092
5711
|
* @example
|
|
5093
5712
|
* ```ts
|
|
5094
|
-
* const consumerCodeIssue = await auth.consumer("app").requestPasswordReset({ email: "jane@example.com" });
|
|
5713
|
+
* const consumerCodeIssue = await auth.consumer("my-app").requestPasswordReset({ email: "jane@example.com" });
|
|
5095
5714
|
* ```
|
|
5096
5715
|
*/
|
|
5097
5716
|
requestPasswordReset(params, options) {
|
|
@@ -5106,6 +5725,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5106
5725
|
*
|
|
5107
5726
|
* 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.
|
|
5108
5727
|
*
|
|
5728
|
+
* Credential: `workspace_key`.
|
|
5729
|
+
* - `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.
|
|
5730
|
+
*
|
|
5109
5731
|
* @param params - `Auth.RequestVerificationParams`.
|
|
5110
5732
|
* @param options - Per-request options.
|
|
5111
5733
|
* @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Provide exactly one of `email` or `phone`, or request validation failed in the global `ValidationPipe`.
|
|
@@ -5118,7 +5740,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5118
5740
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-request-verification
|
|
5119
5741
|
* @example
|
|
5120
5742
|
* ```ts
|
|
5121
|
-
* const consumerCodeIssue = await auth.consumer("app").requestVerification({ email: "jane@example.com" });
|
|
5743
|
+
* const consumerCodeIssue = await auth.consumer("my-app").requestVerification({ email: "jane@example.com" });
|
|
5122
5744
|
* ```
|
|
5123
5745
|
*/
|
|
5124
5746
|
requestVerification(params, options) {
|
|
@@ -5142,7 +5764,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5142
5764
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-reset-password
|
|
5143
5765
|
* @example
|
|
5144
5766
|
* ```ts
|
|
5145
|
-
* await auth.consumer("app").resetPassword({ code: "123456", new_password: "
|
|
5767
|
+
* await auth.consumer("my-app").resetPassword({ code: "123456", new_password: "a new long passphrase 42" });
|
|
5146
5768
|
* ```
|
|
5147
5769
|
*/
|
|
5148
5770
|
resetPassword(params, options) {
|
|
@@ -5153,6 +5775,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5153
5775
|
*
|
|
5154
5776
|
* 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.
|
|
5155
5777
|
*
|
|
5778
|
+
* Credential: `workspace_key`.
|
|
5779
|
+
* - `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.
|
|
5780
|
+
*
|
|
5156
5781
|
* @param params - `Auth.SendPasswordResetEmailParams`.
|
|
5157
5782
|
* @param options - Per-request options.
|
|
5158
5783
|
* @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.
|
|
@@ -5167,7 +5792,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5167
5792
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-send-password-reset-email
|
|
5168
5793
|
* @example
|
|
5169
5794
|
* ```ts
|
|
5170
|
-
* const consumerCodeDispatch = await auth.consumer("app").sendPasswordResetEmail({ email: "jane@example.com" });
|
|
5795
|
+
* const consumerCodeDispatch = await auth.consumer("my-app").sendPasswordResetEmail({ email: "jane@example.com" });
|
|
5171
5796
|
* ```
|
|
5172
5797
|
*/
|
|
5173
5798
|
sendPasswordResetEmail(params, options) {
|
|
@@ -5191,6 +5816,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5191
5816
|
*
|
|
5192
5817
|
* 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.
|
|
5193
5818
|
*
|
|
5819
|
+
* Credential: `workspace_key`.
|
|
5820
|
+
* - `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.
|
|
5821
|
+
*
|
|
5194
5822
|
* @param params - `Auth.SendVerificationEmailParams`.
|
|
5195
5823
|
* @param options - Per-request options.
|
|
5196
5824
|
* @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.
|
|
@@ -5205,7 +5833,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5205
5833
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-send-verification-email
|
|
5206
5834
|
* @example
|
|
5207
5835
|
* ```ts
|
|
5208
|
-
* const consumerCodeDispatch = await auth.consumer("app").sendVerificationEmail({ email: "jane@example.com" });
|
|
5836
|
+
* const consumerCodeDispatch = await auth.consumer("my-app").sendVerificationEmail({ email: "jane@example.com" });
|
|
5209
5837
|
* ```
|
|
5210
5838
|
*/
|
|
5211
5839
|
sendVerificationEmail(params, options) {
|
|
@@ -5229,7 +5857,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5229
5857
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-signin
|
|
5230
5858
|
* @example
|
|
5231
5859
|
* ```ts
|
|
5232
|
-
* const result = await auth.consumer("app").signin({ identifier: "jane_doe", password: "
|
|
5860
|
+
* const result = await auth.consumer("my-app").signin({ identifier: "jane_doe", password: "correct horse battery staple" });
|
|
5233
5861
|
* ```
|
|
5234
5862
|
*/
|
|
5235
5863
|
signin(params, options) {
|
|
@@ -5250,7 +5878,10 @@ var AuthConsumer = class extends APIResource {
|
|
|
5250
5878
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-oauth-provider
|
|
5251
5879
|
* @example
|
|
5252
5880
|
* ```ts
|
|
5253
|
-
* const result = await auth.consumer("app").signinWithProvider("
|
|
5881
|
+
* const result = await auth.consumer("my-app").signinWithProvider("google", {
|
|
5882
|
+
* id_token: "eyJhbGciOiJSUzI1NiIsImtpZCI6ImsxIn0.eyJzdWIiOiJ1c3JfMSJ9.c2lnbmF0dXJl",
|
|
5883
|
+
* nonce: "n-0S6_WzA2Mj",
|
|
5884
|
+
* });
|
|
5254
5885
|
* ```
|
|
5255
5886
|
*/
|
|
5256
5887
|
signinWithProvider(provider, params, options) {
|
|
@@ -5265,11 +5896,14 @@ var AuthConsumer = class extends APIResource {
|
|
|
5265
5896
|
*
|
|
5266
5897
|
* 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.
|
|
5267
5898
|
*
|
|
5899
|
+
* Credential (optional): `workspace_key`.
|
|
5900
|
+
* - `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.
|
|
5901
|
+
*
|
|
5268
5902
|
* @param params - `Auth.SignupParams`.
|
|
5269
5903
|
* @param options - Per-request options.
|
|
5270
5904
|
* @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.
|
|
5271
5905
|
* @throws {AuthenticationError} 401 UNAUTHORIZED: The app sets `signup_requires_pak` and no Platform API Key was presented on `Authorization: Bearer`.
|
|
5272
|
-
* @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`).
|
|
5906
|
+
* @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`).
|
|
5273
5907
|
* @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.
|
|
5274
5908
|
* @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.
|
|
5275
5909
|
* @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.
|
|
@@ -5279,7 +5913,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5279
5913
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-signup
|
|
5280
5914
|
* @example
|
|
5281
5915
|
* ```ts
|
|
5282
|
-
* const result = await auth.consumer("app").signup({ email: "jane@example.com", password: "CorrectHorseBatteryStaple", username: "john_doe" });
|
|
5916
|
+
* const result = await auth.consumer("my-app").signup({ email: "jane@example.com", password: "CorrectHorseBatteryStaple", username: "john_doe" });
|
|
5283
5917
|
* ```
|
|
5284
5918
|
*/
|
|
5285
5919
|
signup(params, options) {
|
|
@@ -5290,6 +5924,9 @@ var AuthConsumer = class extends APIResource {
|
|
|
5290
5924
|
*
|
|
5291
5925
|
* 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.
|
|
5292
5926
|
*
|
|
5927
|
+
* Credential: `end_user_token`.
|
|
5928
|
+
* - `end_user_token`: An end user's access token for this app, from `signin`, `signup` or `refresh`. Acts as that user.
|
|
5929
|
+
*
|
|
5293
5930
|
* @param params - `Auth.SwitchTenantParams`.
|
|
5294
5931
|
* @param options - Per-request options.
|
|
5295
5932
|
* @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.
|
|
@@ -5302,7 +5939,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5302
5939
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-switch-tenant
|
|
5303
5940
|
* @example
|
|
5304
5941
|
* ```ts
|
|
5305
|
-
* const consumerToken = await auth.consumer("app").switchTenant({ tenant_id: "
|
|
5942
|
+
* const consumerToken = await auth.consumer("my-app").switchTenant({ tenant_id: "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f" });
|
|
5306
5943
|
* ```
|
|
5307
5944
|
*/
|
|
5308
5945
|
switchTenant(params, options) {
|
|
@@ -5327,7 +5964,7 @@ var AuthConsumer = class extends APIResource {
|
|
|
5327
5964
|
* @see https://productcraft.co/docs/auth/api-reference#post-app-slug-v1-auth-verify
|
|
5328
5965
|
* @example
|
|
5329
5966
|
* ```ts
|
|
5330
|
-
* const consumerVerify = await auth.consumer("app").verifyEmail({ code: "123456" });
|
|
5967
|
+
* const consumerVerify = await auth.consumer("my-app").verifyEmail({ code: "123456" });
|
|
5331
5968
|
* ```
|
|
5332
5969
|
*/
|
|
5333
5970
|
verifyEmail(params, options) {
|
|
@@ -5849,7 +6486,7 @@ var WebhookEventStatus = { values: ["pending", "delivered", "failed", "not_sent"
|
|
|
5849
6486
|
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"] };
|
|
5850
6487
|
|
|
5851
6488
|
// src/_generated/client.ts
|
|
5852
|
-
var VERSION = "1.0
|
|
6489
|
+
var VERSION = "1.1.0" ;
|
|
5853
6490
|
var Auth = class extends AuthBase {
|
|
5854
6491
|
#openapi;
|
|
5855
6492
|
constructor(options = {}) {
|