@3sixty/api-auth-rest-client 0.0.0-stage → 0.20.0-next.1

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.
@@ -0,0 +1,62 @@
1
+ # Auth Rest Client Examples
2
+
3
+ Use these snippets to record and query authentication audit entries from browser or server-side TypeScript applications.
4
+
5
+ ## EntityStorageAuthenticationAuditRestClient
6
+
7
+ ```typescript
8
+ import { EntityStorageAuthenticationAuditRestClient } from '@3sixty/api-auth-rest-client';
9
+
10
+ const auditClient = new EntityStorageAuthenticationAuditRestClient({
11
+ endpoint: 'https://api.example.org',
12
+ pathPrefix: 'v1'
13
+ });
14
+
15
+ console.log(auditClient.className()); // EntityStorageAuthenticationAuditRestClient
16
+
17
+ const auditEntryId = await auditClient.create({
18
+ event: 'login-success',
19
+ actorId: 'did:example:user:alice',
20
+ organizationId: 'did:example:org:core',
21
+ tenantId: 'did:example:tenant:alpha',
22
+ data: {
23
+ channel: 'web'
24
+ }
25
+ });
26
+
27
+ const auditResult = await auditClient.query(
28
+ {
29
+ actorId: 'did:example:user:alice',
30
+ event: 'login-success',
31
+ startDate: '2026-04-01T00:00:00.000Z',
32
+ endDate: '2026-04-30T23:59:59.999Z'
33
+ },
34
+ undefined,
35
+ 25
36
+ );
37
+
38
+ console.log(auditEntryId); // /authentication/audit/018f2f67bb9d4a0caad8386f56df85ce
39
+ console.log(auditResult.entries.length); // 1
40
+ console.log(auditResult.cursor); // eyJpZCI6IjAxOGYyZjY3YmI5ZDRhMGNhYWQ4Mzg2ZjU2ZGY4NWNlIn0=
41
+ ```
42
+
43
+ ```typescript
44
+ import { EntityStorageAuthenticationAuditRestClient } from '@3sixty/api-auth-rest-client';
45
+
46
+ const auditClient = new EntityStorageAuthenticationAuditRestClient({
47
+ endpoint: 'https://api.example.org',
48
+ pathPrefix: 'v1'
49
+ });
50
+
51
+ const entry = await auditClient.get('018f2f67bb9d4a0caad8386f56df85ce');
52
+
53
+ await auditClient.update(entry.id, {
54
+ data: {
55
+ channel: 'mobile'
56
+ }
57
+ });
58
+
59
+ await auditClient.remove(entry.id);
60
+
61
+ console.log(entry.event); // login-success
62
+ ```
@@ -0,0 +1,249 @@
1
+ # Class: EntityStorageAuthenticationAuditRestClient
2
+
3
+ The client to connect to the authentication audit service.
4
+
5
+ ## Extends
6
+
7
+ - `BaseRestClient`
8
+
9
+ ## Implements
10
+
11
+ - `IAuthenticationAuditComponent`
12
+
13
+ ## Constructors
14
+
15
+ ### Constructor
16
+
17
+ > **new EntityStorageAuthenticationAuditRestClient**(`config`): `EntityStorageAuthenticationAuditRestClient`
18
+
19
+ Create a new instance of EntityStorageAuthenticationAuditRestClient.
20
+
21
+ #### Parameters
22
+
23
+ ##### config
24
+
25
+ `IBaseRestClientConfig`
26
+
27
+ The configuration for the client.
28
+
29
+ #### Returns
30
+
31
+ `EntityStorageAuthenticationAuditRestClient`
32
+
33
+ #### Overrides
34
+
35
+ `BaseRestClient.constructor`
36
+
37
+ ## Properties
38
+
39
+ ### CLASS\_NAME {#class_name}
40
+
41
+ > `readonly` `static` **CLASS\_NAME**: `string`
42
+
43
+ Runtime name for the class.
44
+
45
+ ## Methods
46
+
47
+ ### className() {#classname}
48
+
49
+ > **className**(): `string`
50
+
51
+ Returns the class name of the component.
52
+
53
+ #### Returns
54
+
55
+ `string`
56
+
57
+ The class name of the component.
58
+
59
+ #### Implementation of
60
+
61
+ `IAuthenticationAuditComponent.className`
62
+
63
+ ***
64
+
65
+ ### create() {#create}
66
+
67
+ > **create**(`entry`): `Promise`\<`string`\>
68
+
69
+ Create a new audit entry.
70
+
71
+ #### Parameters
72
+
73
+ ##### entry
74
+
75
+ `Omit`\<`IAuthenticationAuditEntry`, `"id"` \| `"dateCreated"`\>
76
+
77
+ The audit entry to be logged.
78
+
79
+ #### Returns
80
+
81
+ `Promise`\<`string`\>
82
+
83
+ The unique identifier of the created audit entry.
84
+
85
+ #### Implementation of
86
+
87
+ `IAuthenticationAuditComponent.create`
88
+
89
+ ***
90
+
91
+ ### get() {#get}
92
+
93
+ > **get**(`id`): `Promise`\<`IAuthenticationAuditEntry`\>
94
+
95
+ Get an audit entry by id.
96
+
97
+ #### Parameters
98
+
99
+ ##### id
100
+
101
+ `string`
102
+
103
+ The unique identifier of the audit entry.
104
+
105
+ #### Returns
106
+
107
+ `Promise`\<`IAuthenticationAuditEntry`\>
108
+
109
+ The audit entry.
110
+
111
+ #### Implementation of
112
+
113
+ `IAuthenticationAuditComponent.get`
114
+
115
+ ***
116
+
117
+ ### update() {#update}
118
+
119
+ > **update**(`id`, `entry`): `Promise`\<`void`\>
120
+
121
+ Update an audit entry.
122
+
123
+ #### Parameters
124
+
125
+ ##### id
126
+
127
+ `string`
128
+
129
+ The unique identifier of the audit entry to update.
130
+
131
+ ##### entry
132
+
133
+ `Partial`\<`Omit`\<`IAuthenticationAuditEntry`, `"id"` \| `"dateCreated"`\>\>
134
+
135
+ The fields to update on the audit entry.
136
+
137
+ #### Returns
138
+
139
+ `Promise`\<`void`\>
140
+
141
+ A promise that resolves when the audit entry has been updated.
142
+
143
+ #### Implementation of
144
+
145
+ `IAuthenticationAuditComponent.update`
146
+
147
+ ***
148
+
149
+ ### remove() {#remove}
150
+
151
+ > **remove**(`id`): `Promise`\<`void`\>
152
+
153
+ Remove an audit entry.
154
+
155
+ #### Parameters
156
+
157
+ ##### id
158
+
159
+ `string`
160
+
161
+ The unique identifier of the audit entry to remove.
162
+
163
+ #### Returns
164
+
165
+ `Promise`\<`void`\>
166
+
167
+ A promise that resolves when the audit entry has been removed.
168
+
169
+ #### Implementation of
170
+
171
+ `IAuthenticationAuditComponent.remove`
172
+
173
+ ***
174
+
175
+ ### query() {#query}
176
+
177
+ > **query**(`options?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IAuthenticationAuditEntry`[]; `cursor?`: `string`; \}\>
178
+
179
+ Query the audit entries.
180
+
181
+ #### Parameters
182
+
183
+ ##### options?
184
+
185
+ The query options.
186
+
187
+ ###### actorId?
188
+
189
+ `string`
190
+
191
+ The actor identifier to filter the audit entries, optional.
192
+
193
+ ###### organizationId?
194
+
195
+ `string`
196
+
197
+ The organization identifier to filter the audit entries, optional.
198
+
199
+ ###### tenantId?
200
+
201
+ `string`
202
+
203
+ The tenant identifier to filter the audit entries, optional.
204
+
205
+ ###### nodeId?
206
+
207
+ `string`
208
+
209
+ The node identifier to filter the audit entries, optional.
210
+
211
+ ###### event?
212
+
213
+ `string`
214
+
215
+ The audit event to filter the audit entries, optional.
216
+
217
+ ###### startDate?
218
+
219
+ `string`
220
+
221
+ The start date to filter the audit entries, optional.
222
+
223
+ ###### endDate?
224
+
225
+ `string`
226
+
227
+ The end date to filter the audit entries, optional.
228
+
229
+ ##### cursor?
230
+
231
+ `string`
232
+
233
+ The cursor for pagination.
234
+
235
+ ##### limit?
236
+
237
+ `number`
238
+
239
+ The maximum number of entries to return.
240
+
241
+ #### Returns
242
+
243
+ `Promise`\<\{ `entries`: `IAuthenticationAuditEntry`[]; `cursor?`: `string`; \}\>
244
+
245
+ The audit entries.
246
+
247
+ #### Implementation of
248
+
249
+ `IAuthenticationAuditComponent.query`
@@ -0,0 +1,5 @@
1
+ # @3sixty/api-auth-rest-client
2
+
3
+ ## Classes
4
+
5
+ - [EntityStorageAuthenticationAuditRestClient](classes/EntityStorageAuthenticationAuditRestClient.md)
@@ -0,0 +1 @@
1
+ {}
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
- "name": "@3sixty/api-auth-rest-client",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@3sixty/api-auth-rest-client",
3
+ "version": "0.20.0-next.1",
4
+ "description": "REST client for the authentication audit endpoints.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/3sixtyglobal/api-auth.git",
8
+ "directory": "packages/api-auth-rest-client"
9
+ },
10
+ "author": "martyn.janes@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=24.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@3sixty/api-auth-models": "0.20.0-next.1",
18
+ "@3sixty/api-core": "next",
19
+ "@3sixty/api-models": "next",
20
+ "@3sixty/core": "next",
21
+ "@3sixty/nameof": "next",
22
+ "@3sixty/web": "next"
23
+ },
24
+ "main": "./dist/es/index.js",
25
+ "types": "./dist/types/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/types/index.d.ts",
29
+ "import": "./dist/es/index.js",
30
+ "default": "./dist/es/index.js"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist/es",
35
+ "dist/types",
36
+ "locales",
37
+ "docs"
38
+ ],
39
+ "keywords": [
40
+ "twin",
41
+ "trade",
42
+ "iota",
43
+ "framework",
44
+ "blockchain",
45
+ "api",
46
+ "entity",
47
+ "storage",
48
+ "persistence",
49
+ "database"
50
+ ],
51
+ "bugs": {
52
+ "url": "git+https://github.com/3sixtyglobal/api-auth/issues"
53
+ },
54
+ "homepage": "https://3sixty.global"
55
+ }