@twin.org/api-auth-entity-storage-service 0.9.1-next.3 → 0.9.1-next.4

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.
@@ -1,5 +1,5 @@
1
- import type { IAuditCreateRequest, IAuditQueryRequest, IAuditQueryResponse } from "@twin.org/api-auth-entity-storage-models";
2
- import { type ICreatedResponse, type IHttpRequestContext, type IRestRoute, type ITag } from "@twin.org/api-models";
1
+ import type { IAuditCreateRequest, IAuditGetRequest, IAuditGetResponse, IAuditQueryRequest, IAuditQueryResponse, IAuditRemoveRequest, IAuditUpdateRequest } from "@twin.org/api-auth-entity-storage-models";
2
+ import { type ICreatedResponse, type IHttpRequestContext, type INoContentResponse, type IRestRoute, type ITag } from "@twin.org/api-models";
3
3
  /**
4
4
  * The tag to associate with the routes.
5
5
  */
@@ -16,9 +16,34 @@ export declare function generateRestRoutesAuthenticationAudit(baseRouteName: str
16
16
  * @param httpRequestContext The request context for the API.
17
17
  * @param componentName The name of the component to use in the routes.
18
18
  * @param request The request.
19
+ * @param baseRouteName The base route name to use for the location header.
19
20
  * @returns The response object with additional http response properties.
20
21
  */
21
- export declare function authenticationAuditCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditCreateRequest): Promise<ICreatedResponse>;
22
+ export declare function authenticationAuditCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditCreateRequest, baseRouteName: string): Promise<ICreatedResponse>;
23
+ /**
24
+ * Get an authentication audit entry.
25
+ * @param httpRequestContext The request context for the API.
26
+ * @param componentName The name of the component to use in the routes.
27
+ * @param request The request.
28
+ * @returns The response object with additional http response properties.
29
+ */
30
+ export declare function authenticationAuditGet(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditGetRequest): Promise<IAuditGetResponse>;
31
+ /**
32
+ * Update an authentication audit entry.
33
+ * @param httpRequestContext The request context for the API.
34
+ * @param componentName The name of the component to use in the routes.
35
+ * @param request The request.
36
+ * @returns The response object with additional http response properties.
37
+ */
38
+ export declare function authenticationAuditUpdate(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditUpdateRequest): Promise<INoContentResponse>;
39
+ /**
40
+ * Remove an authentication audit entry.
41
+ * @param httpRequestContext The request context for the API.
42
+ * @param componentName The name of the component to use in the routes.
43
+ * @param request The request.
44
+ * @returns The response object with additional http response properties.
45
+ */
46
+ export declare function authenticationAuditRemove(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditRemoveRequest): Promise<INoContentResponse>;
22
47
  /**
23
48
  * Query authentication audit entries.
24
49
  * @param httpRequestContext The request context for the API.
@@ -24,6 +24,25 @@ export declare class EntityStorageAuthenticationAuditService implements IAuthent
24
24
  * @returns The unique identifier of the created audit entry.
25
25
  */
26
26
  create(entry: Omit<IAuthenticationAuditEntry, "id" | "dateCreated">): Promise<string>;
27
+ /**
28
+ * Get an audit entry by id.
29
+ * @param id The unique identifier of the audit entry.
30
+ * @returns The audit entry.
31
+ */
32
+ get(id: string): Promise<IAuthenticationAuditEntry>;
33
+ /**
34
+ * Update an audit entry.
35
+ * @param id The unique identifier of the audit entry to update.
36
+ * @param entry The fields to update on the audit entry.
37
+ * @returns A promise that resolves when the audit entry has been updated.
38
+ */
39
+ update(id: string, entry: Partial<Omit<IAuthenticationAuditEntry, "id" | "dateCreated">>): Promise<void>;
40
+ /**
41
+ * Remove an audit entry.
42
+ * @param id The unique identifier of the audit entry to remove.
43
+ * @returns A promise that resolves when the audit entry has been removed.
44
+ */
45
+ remove(id: string): Promise<void>;
27
46
  /**
28
47
  * Query the audit entries.
29
48
  * @param options The query options.
package/docs/changelog.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.1-next.4](https://github.com/iotaledger/twin-api/compare/api-auth-entity-storage-service-v0.9.1-next.3...api-auth-entity-storage-service-v0.9.1-next.4) (2026-06-30)
4
+
5
+
6
+ ### Features
7
+
8
+ * improved rest handling ([#211](https://github.com/iotaledger/twin-api/issues/211)) ([12c50ea](https://github.com/iotaledger/twin-api/commit/12c50ea7655276eed7a73d311ac5286476c98201))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/api-auth-entity-storage-models bumped from 0.9.1-next.3 to 0.9.1-next.4
16
+ * @twin.org/api-core bumped from 0.9.1-next.3 to 0.9.1-next.4
17
+ * @twin.org/api-models bumped from 0.9.1-next.3 to 0.9.1-next.4
18
+
3
19
  ## [0.9.1-next.3](https://github.com/iotaledger/twin-api/compare/api-auth-entity-storage-service-v0.9.1-next.2...api-auth-entity-storage-service-v0.9.1-next.3) (2026-06-29)
4
20
 
5
21
 
@@ -1365,6 +1365,311 @@
1365
1365
  }
1366
1366
  }
1367
1367
  }
1368
+ },
1369
+ "/authentication/audit/{id}": {
1370
+ "get": {
1371
+ "operationId": "authenticationAuditGet",
1372
+ "summary": "Get an authentication audit entry",
1373
+ "tags": [
1374
+ "Authentication Audit"
1375
+ ],
1376
+ "parameters": [
1377
+ {
1378
+ "name": "id",
1379
+ "description": "The audit entry id.",
1380
+ "in": "path",
1381
+ "required": true,
1382
+ "schema": {
1383
+ "type": "string"
1384
+ },
1385
+ "style": "simple",
1386
+ "example": "018f0b53d5d5704fa3a06d6ed2478575"
1387
+ }
1388
+ ],
1389
+ "security": [
1390
+ {
1391
+ "jwtBearerAuthScheme": []
1392
+ }
1393
+ ],
1394
+ "responses": {
1395
+ "200": {
1396
+ "description": "Response from getting an authentication audit entry.",
1397
+ "content": {
1398
+ "application/json": {
1399
+ "schema": {
1400
+ "$ref": "#/components/schemas/AuthenticationAuditEntry"
1401
+ },
1402
+ "examples": {
1403
+ "authenticationAuditGetResponseExample": {
1404
+ "summary": "The response for getting an authentication audit entry.",
1405
+ "value": {
1406
+ "id": "018f0b53d5d5704fa3a06d6ed2478575",
1407
+ "actorId": "user@example.com",
1408
+ "dateCreated": "2026-01-12T09:05:23.123Z",
1409
+ "event": "login-success",
1410
+ "data": {
1411
+ "organizationIdentity": "did:example:org1"
1412
+ }
1413
+ }
1414
+ }
1415
+ }
1416
+ }
1417
+ }
1418
+ },
1419
+ "400": {
1420
+ "description": "The server cannot process the request, see the content for more details.",
1421
+ "content": {
1422
+ "application/json": {
1423
+ "schema": {
1424
+ "$ref": "#/components/schemas/Error"
1425
+ },
1426
+ "examples": {
1427
+ "exampleResponse": {
1428
+ "value": {
1429
+ "name": "GeneralError",
1430
+ "message": "errorMessage",
1431
+ "properties": {
1432
+ "foo": "bar"
1433
+ }
1434
+ }
1435
+ }
1436
+ }
1437
+ }
1438
+ }
1439
+ },
1440
+ "401": {
1441
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
1442
+ "content": {
1443
+ "application/json": {
1444
+ "schema": {
1445
+ "$ref": "#/components/schemas/Error"
1446
+ },
1447
+ "examples": {
1448
+ "exampleResponse": {
1449
+ "value": {
1450
+ "name": "UnauthorizedError",
1451
+ "message": "errorMessage"
1452
+ }
1453
+ }
1454
+ }
1455
+ }
1456
+ }
1457
+ },
1458
+ "500": {
1459
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
1460
+ "content": {
1461
+ "application/json": {
1462
+ "schema": {
1463
+ "$ref": "#/components/schemas/Error"
1464
+ },
1465
+ "examples": {
1466
+ "exampleResponse": {
1467
+ "value": {
1468
+ "name": "InternalServerError",
1469
+ "message": "errorMessage"
1470
+ }
1471
+ }
1472
+ }
1473
+ }
1474
+ }
1475
+ }
1476
+ }
1477
+ },
1478
+ "put": {
1479
+ "operationId": "authenticationAuditUpdate",
1480
+ "summary": "Update an authentication audit entry",
1481
+ "tags": [
1482
+ "Authentication Audit"
1483
+ ],
1484
+ "parameters": [
1485
+ {
1486
+ "name": "id",
1487
+ "description": "The audit entry id.",
1488
+ "in": "path",
1489
+ "required": true,
1490
+ "schema": {
1491
+ "type": "string"
1492
+ },
1493
+ "style": "simple",
1494
+ "example": "018f0b53d5d5704fa3a06d6ed2478575"
1495
+ }
1496
+ ],
1497
+ "security": [
1498
+ {
1499
+ "jwtBearerAuthScheme": []
1500
+ }
1501
+ ],
1502
+ "requestBody": {
1503
+ "description": "Update an authentication audit entry.",
1504
+ "required": true,
1505
+ "content": {
1506
+ "application/json": {
1507
+ "schema": {
1508
+ "$ref": "#/components/schemas/AuditUpdateRequest"
1509
+ },
1510
+ "examples": {
1511
+ "authenticationAuditUpdateRequestExample": {
1512
+ "summary": "The request to update an authentication audit entry.",
1513
+ "value": {
1514
+ "data": {
1515
+ "organizationIdentity": "did:example:org1"
1516
+ }
1517
+ }
1518
+ }
1519
+ }
1520
+ }
1521
+ }
1522
+ },
1523
+ "responses": {
1524
+ "204": {
1525
+ "description": "The rest request ended in success with no data."
1526
+ },
1527
+ "400": {
1528
+ "description": "The server cannot process the request, see the content for more details.",
1529
+ "content": {
1530
+ "application/json": {
1531
+ "schema": {
1532
+ "$ref": "#/components/schemas/Error"
1533
+ },
1534
+ "examples": {
1535
+ "exampleResponse": {
1536
+ "value": {
1537
+ "name": "GeneralError",
1538
+ "message": "errorMessage",
1539
+ "properties": {
1540
+ "foo": "bar"
1541
+ }
1542
+ }
1543
+ }
1544
+ }
1545
+ }
1546
+ }
1547
+ },
1548
+ "401": {
1549
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
1550
+ "content": {
1551
+ "application/json": {
1552
+ "schema": {
1553
+ "$ref": "#/components/schemas/Error"
1554
+ },
1555
+ "examples": {
1556
+ "exampleResponse": {
1557
+ "value": {
1558
+ "name": "UnauthorizedError",
1559
+ "message": "errorMessage"
1560
+ }
1561
+ }
1562
+ }
1563
+ }
1564
+ }
1565
+ },
1566
+ "500": {
1567
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
1568
+ "content": {
1569
+ "application/json": {
1570
+ "schema": {
1571
+ "$ref": "#/components/schemas/Error"
1572
+ },
1573
+ "examples": {
1574
+ "exampleResponse": {
1575
+ "value": {
1576
+ "name": "InternalServerError",
1577
+ "message": "errorMessage"
1578
+ }
1579
+ }
1580
+ }
1581
+ }
1582
+ }
1583
+ }
1584
+ }
1585
+ },
1586
+ "delete": {
1587
+ "operationId": "authenticationAuditRemove",
1588
+ "summary": "Remove an authentication audit entry",
1589
+ "tags": [
1590
+ "Authentication Audit"
1591
+ ],
1592
+ "parameters": [
1593
+ {
1594
+ "name": "id",
1595
+ "description": "The audit entry id.",
1596
+ "in": "path",
1597
+ "required": true,
1598
+ "schema": {
1599
+ "type": "string"
1600
+ },
1601
+ "style": "simple",
1602
+ "example": "018f0b53d5d5704fa3a06d6ed2478575"
1603
+ }
1604
+ ],
1605
+ "security": [
1606
+ {
1607
+ "jwtBearerAuthScheme": []
1608
+ }
1609
+ ],
1610
+ "responses": {
1611
+ "204": {
1612
+ "description": "The rest request ended in success with no data."
1613
+ },
1614
+ "400": {
1615
+ "description": "The server cannot process the request, see the content for more details.",
1616
+ "content": {
1617
+ "application/json": {
1618
+ "schema": {
1619
+ "$ref": "#/components/schemas/Error"
1620
+ },
1621
+ "examples": {
1622
+ "exampleResponse": {
1623
+ "value": {
1624
+ "name": "GeneralError",
1625
+ "message": "errorMessage",
1626
+ "properties": {
1627
+ "foo": "bar"
1628
+ }
1629
+ }
1630
+ }
1631
+ }
1632
+ }
1633
+ }
1634
+ },
1635
+ "401": {
1636
+ "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
1637
+ "content": {
1638
+ "application/json": {
1639
+ "schema": {
1640
+ "$ref": "#/components/schemas/Error"
1641
+ },
1642
+ "examples": {
1643
+ "exampleResponse": {
1644
+ "value": {
1645
+ "name": "UnauthorizedError",
1646
+ "message": "errorMessage"
1647
+ }
1648
+ }
1649
+ }
1650
+ }
1651
+ }
1652
+ },
1653
+ "500": {
1654
+ "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
1655
+ "content": {
1656
+ "application/json": {
1657
+ "schema": {
1658
+ "$ref": "#/components/schemas/Error"
1659
+ },
1660
+ "examples": {
1661
+ "exampleResponse": {
1662
+ "value": {
1663
+ "name": "InternalServerError",
1664
+ "message": "errorMessage"
1665
+ }
1666
+ }
1667
+ }
1668
+ }
1669
+ }
1670
+ }
1671
+ }
1672
+ }
1368
1673
  }
1369
1674
  },
1370
1675
  "components": {
@@ -1498,6 +1803,57 @@
1498
1803
  ],
1499
1804
  "description": "The response body."
1500
1805
  },
1806
+ "AuditUpdateRequest": {
1807
+ "description": "The body of the request.",
1808
+ "type": "object",
1809
+ "properties": {
1810
+ "event": {
1811
+ "anyOf": [
1812
+ {
1813
+ "$ref": "#/components/schemas/AuthAuditEvent"
1814
+ },
1815
+ {
1816
+ "type": "string"
1817
+ }
1818
+ ],
1819
+ "description": "The audit event that occurred."
1820
+ },
1821
+ "actorId": {
1822
+ "type": "string",
1823
+ "description": "The actor identifier, could be e-mail, username, or other unique identifier."
1824
+ },
1825
+ "nodeId": {
1826
+ "type": "string",
1827
+ "description": "The node identifier associated with the audit entry, if applicable."
1828
+ },
1829
+ "organizationId": {
1830
+ "type": "string",
1831
+ "description": "The organization identifier associated with the audit entry, if applicable."
1832
+ },
1833
+ "tenantId": {
1834
+ "type": "string",
1835
+ "description": "The tenant identifier associated with the audit entry, if applicable."
1836
+ },
1837
+ "ipAddressHashes": {
1838
+ "type": "array",
1839
+ "items": {
1840
+ "type": "string"
1841
+ },
1842
+ "description": "The hashed IP addresses of the client."
1843
+ },
1844
+ "userAgent": {
1845
+ "type": "string",
1846
+ "description": "The user agent string of the client."
1847
+ },
1848
+ "correlationId": {
1849
+ "type": "string",
1850
+ "description": "The correlation ID for request tracing."
1851
+ },
1852
+ "data": {
1853
+ "description": "Additional data related to the audit entry, such as IP address, user agent, etc."
1854
+ }
1855
+ }
1856
+ },
1501
1857
  "AuthAuditEvent": {
1502
1858
  "description": "Supported authentication audit event values.",
1503
1859
  "anyOf": [
@@ -80,6 +80,90 @@ The unique identifier of the created audit entry.
80
80
 
81
81
  ***
82
82
 
83
+ ### get() {#get}
84
+
85
+ > **get**(`id`): `Promise`\<`IAuthenticationAuditEntry`\>
86
+
87
+ Get an audit entry by id.
88
+
89
+ #### Parameters
90
+
91
+ ##### id
92
+
93
+ `string`
94
+
95
+ The unique identifier of the audit entry.
96
+
97
+ #### Returns
98
+
99
+ `Promise`\<`IAuthenticationAuditEntry`\>
100
+
101
+ The audit entry.
102
+
103
+ #### Implementation of
104
+
105
+ `IAuthenticationAuditComponent.get`
106
+
107
+ ***
108
+
109
+ ### update() {#update}
110
+
111
+ > **update**(`id`, `entry`): `Promise`\<`void`\>
112
+
113
+ Update an audit entry.
114
+
115
+ #### Parameters
116
+
117
+ ##### id
118
+
119
+ `string`
120
+
121
+ The unique identifier of the audit entry to update.
122
+
123
+ ##### entry
124
+
125
+ `Partial`\<`Omit`\<`IAuthenticationAuditEntry`, `"id"` \| `"dateCreated"`\>\>
126
+
127
+ The fields to update on the audit entry.
128
+
129
+ #### Returns
130
+
131
+ `Promise`\<`void`\>
132
+
133
+ A promise that resolves when the audit entry has been updated.
134
+
135
+ #### Implementation of
136
+
137
+ `IAuthenticationAuditComponent.update`
138
+
139
+ ***
140
+
141
+ ### remove() {#remove}
142
+
143
+ > **remove**(`id`): `Promise`\<`void`\>
144
+
145
+ Remove an audit entry.
146
+
147
+ #### Parameters
148
+
149
+ ##### id
150
+
151
+ `string`
152
+
153
+ The unique identifier of the audit entry to remove.
154
+
155
+ #### Returns
156
+
157
+ `Promise`\<`void`\>
158
+
159
+ A promise that resolves when the audit entry has been removed.
160
+
161
+ #### Implementation of
162
+
163
+ `IAuthenticationAuditComponent.remove`
164
+
165
+ ***
166
+
83
167
  ### query() {#query}
84
168
 
85
169
  > **query**(`options?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IAuthenticationAuditEntry`[]; `cursor?`: `string`; \}\>
@@ -1,6 +1,6 @@
1
1
  # Function: authenticationAdminCreateUser()
2
2
 
3
- > **authenticationAdminCreateUser**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`ICreatedResponse`\>
3
+ > **authenticationAdminCreateUser**(`httpRequestContext`, `componentName`, `request`, `baseRouteName`): `Promise`\<`ICreatedResponse`\>
4
4
 
5
5
  Create a new user.
6
6
 
@@ -24,6 +24,12 @@ The name of the component to use in the routes.
24
24
 
25
25
  The request.
26
26
 
27
+ ### baseRouteName
28
+
29
+ `string`
30
+
31
+ The base route name to use for the location header.
32
+
27
33
  ## Returns
28
34
 
29
35
  `Promise`\<`ICreatedResponse`\>
@@ -1,6 +1,6 @@
1
1
  # Function: authenticationAuditCreate()
2
2
 
3
- > **authenticationAuditCreate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`ICreatedResponse`\>
3
+ > **authenticationAuditCreate**(`httpRequestContext`, `componentName`, `request`, `baseRouteName`): `Promise`\<`ICreatedResponse`\>
4
4
 
5
5
  Create an authentication audit entry.
6
6
 
@@ -24,6 +24,12 @@ The name of the component to use in the routes.
24
24
 
25
25
  The request.
26
26
 
27
+ ### baseRouteName
28
+
29
+ `string`
30
+
31
+ The base route name to use for the location header.
32
+
27
33
  ## Returns
28
34
 
29
35
  `Promise`\<`ICreatedResponse`\>
@@ -0,0 +1,31 @@
1
+ # Function: authenticationAuditGet()
2
+
3
+ > **authenticationAuditGet**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IAuditGetResponse`\>
4
+
5
+ Get an authentication audit entry.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditGetRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IAuditGetResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: authenticationAuditRemove()
2
+
3
+ > **authenticationAuditRemove**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Remove an authentication audit entry.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditRemoveRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: authenticationAuditUpdate()
2
+
3
+ > **authenticationAuditUpdate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Update an authentication audit entry.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `IAuditUpdateRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.