@atlasauth/solid 0.7.0 → 0.8.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/CHANGELOG.md +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/organization.d.ts +29 -0
- package/dist/organization.js +67 -0
- package/dist/organization.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlasauth/solid changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0 — 2026-10-23
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `<OrganizationAuditLog/>` and `useOrganizationAuditLog()`: the active organization's audit trail for its admins, paged, with labels as props. Renders nothing for a member who may not read it.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Built on `@atlasauth/js` 0.16.0.
|
|
12
|
+
|
|
3
13
|
## 0.7.0
|
|
4
14
|
|
|
5
15
|
### Changed
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export * from './provider';
|
|
|
4
4
|
export * from './accessors';
|
|
5
5
|
export * from './control-components';
|
|
6
6
|
export * from './widgets';
|
|
7
|
+
export * from './organization';
|
|
8
|
+
export type { OrganizationAuditLogEntry, OrganizationAuditLogState } from '@atlasauth/js';
|
|
7
9
|
export { SIGN_OUT_EVENT, onAtlasSignOut } from '@atlasauth/js';
|
|
8
10
|
export type { SignOutEvent, SignOutReason } from '@atlasauth/js';
|
|
9
11
|
export { ATLAS_SOLID_SDK, ATLAS_SOLID_VERSION } from './version';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from './provider';
|
|
|
4
4
|
export * from './accessors';
|
|
5
5
|
export * from './control-components';
|
|
6
6
|
export * from './widgets';
|
|
7
|
+
export * from './organization';
|
|
7
8
|
// `onSignOut({ reason })` event types + the `atlas:signout` window event; this SDK's version.
|
|
8
9
|
export { SIGN_OUT_EVENT, onAtlasSignOut } from '@atlasauth/js';
|
|
9
10
|
export { ATLAS_SOLID_SDK, ATLAS_SOLID_VERSION } from './version';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAG/B,8FAA8F;AAC9F,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
2
|
+
import { type OrganizationAuditLogOptions, type OrganizationAuditLogState } from '@atlasauth/js';
|
|
3
|
+
/**
|
|
4
|
+
* The active organization's audit trail, for its admins: one page at a time,
|
|
5
|
+
* newest first, with `loadMore()`. `action` narrows it (exact, or a prefix
|
|
6
|
+
* ending in `.`). `state().forbidden` is true when the signed-in member may not
|
|
7
|
+
* read it, so the caller can hide the surface. Follows the active organization.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useOrganizationAuditLog(options?: OrganizationAuditLogOptions): {
|
|
10
|
+
state: () => OrganizationAuditLogState;
|
|
11
|
+
loadMore: () => Promise<void>;
|
|
12
|
+
reload: () => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export interface OrganizationAuditLogProps extends OrganizationAuditLogOptions {
|
|
15
|
+
labels?: {
|
|
16
|
+
title?: string;
|
|
17
|
+
empty?: string;
|
|
18
|
+
loadMore?: string;
|
|
19
|
+
actor?: string;
|
|
20
|
+
};
|
|
21
|
+
formatDate?: (ms: number) => string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* `<OrganizationAuditLog/>` — the active organization's audit trail for its
|
|
25
|
+
* admins. Renders nothing for a member who may not read it (the server is the
|
|
26
|
+
* authority; the component just follows it). Labels are props so an app can
|
|
27
|
+
* localise them.
|
|
28
|
+
*/
|
|
29
|
+
export declare function OrganizationAuditLog(props?: OrganizationAuditLogProps): JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createEffect, createSignal, on, onCleanup } from 'solid-js';
|
|
2
|
+
import { FapiClient, createOrganizationAuditLog, describeAuditAction, } from '@atlasauth/js';
|
|
3
|
+
import { h } from './h';
|
|
4
|
+
import { useAtlas } from './context';
|
|
5
|
+
import { ATLAS_SOLID_SDK } from './version';
|
|
6
|
+
/** The active organization's id: the session's `org_id`, when the user is a member of it. */
|
|
7
|
+
function activeOrganizationId(client) {
|
|
8
|
+
const orgId = client.state.claims?.org_id;
|
|
9
|
+
if (!orgId)
|
|
10
|
+
return null;
|
|
11
|
+
return client.state.memberships.some((m) => m.organization.id === orgId) ? orgId : null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The active organization's audit trail, for its admins: one page at a time,
|
|
15
|
+
* newest first, with `loadMore()`. `action` narrows it (exact, or a prefix
|
|
16
|
+
* ending in `.`). `state().forbidden` is true when the signed-in member may not
|
|
17
|
+
* read it, so the caller can hide the surface. Follows the active organization.
|
|
18
|
+
*/
|
|
19
|
+
export function useOrganizationAuditLog(options = {}) {
|
|
20
|
+
const client = useAtlas();
|
|
21
|
+
const log = createOrganizationAuditLog(new FapiClient({
|
|
22
|
+
publishableKey: client.publishableKey,
|
|
23
|
+
baseUrl: client.frontendApi,
|
|
24
|
+
locale: client.locale,
|
|
25
|
+
sdk: ATLAS_SOLID_SDK,
|
|
26
|
+
}), options);
|
|
27
|
+
const [state, setState] = createSignal(log.getState());
|
|
28
|
+
onCleanup(log.subscribe((next) => setState(next)));
|
|
29
|
+
createEffect(on(() => activeOrganizationId(client), (id) => void log.load(id)));
|
|
30
|
+
return { state, loadMore: log.loadMore, reload: log.reload };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `<OrganizationAuditLog/>` — the active organization's audit trail for its
|
|
34
|
+
* admins. Renders nothing for a member who may not read it (the server is the
|
|
35
|
+
* authority; the component just follows it). Labels are props so an app can
|
|
36
|
+
* localise them.
|
|
37
|
+
*/
|
|
38
|
+
export function OrganizationAuditLog(props = {}) {
|
|
39
|
+
const client = useAtlas();
|
|
40
|
+
const log = useOrganizationAuditLog({ pageSize: props.pageSize, action: props.action });
|
|
41
|
+
const formatDate = (ms) => (props.formatDate ?? ((v) => new Date(v).toLocaleString()))(ms);
|
|
42
|
+
return (() => {
|
|
43
|
+
const state = log.state();
|
|
44
|
+
if (!activeOrganizationId(client) || state.forbidden)
|
|
45
|
+
return null;
|
|
46
|
+
const labels = props.labels ?? {};
|
|
47
|
+
return h('div', { class: 'atlas-card', 'data-atlas': 'organization-audit-log' }, [
|
|
48
|
+
h('h2', { class: 'atlas-title' }, labels.title ?? 'Audit log'),
|
|
49
|
+
state.entries.length === 0 && !state.loading
|
|
50
|
+
? h('p', { class: 'atlas-subtitle' }, labels.empty ?? 'No activity recorded yet.')
|
|
51
|
+
: h('ul', { class: 'atlas-audit-list' }, state.entries.map((entry) => h('li', { class: 'atlas-audit-item', 'data-action': entry.action }, [
|
|
52
|
+
h('strong', describeAuditAction(entry.action)),
|
|
53
|
+
h('span', { class: 'atlas-audit-meta' }, ` · ${formatDate(entry.created_at)}` +
|
|
54
|
+
(entry.actor.id ? ` · ${labels.actor ?? 'by'} ${entry.actor.type} ${entry.actor.id}` : '')),
|
|
55
|
+
]))),
|
|
56
|
+
state.hasMore
|
|
57
|
+
? h('button', {
|
|
58
|
+
type: 'button',
|
|
59
|
+
class: 'atlas-button-secondary',
|
|
60
|
+
disabled: state.loading,
|
|
61
|
+
onClick: () => void log.loadMore(),
|
|
62
|
+
}, labels.loadMore ?? 'Load more')
|
|
63
|
+
: null,
|
|
64
|
+
]);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=organization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../src/organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,EAAE,SAAS,EAAY,MAAM,UAAU,CAAC;AAC/E,OAAO,EACL,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,GAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,6FAA6F;AAC7F,SAAS,oBAAoB,CAAC,MAAmB;IAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC;IAC1C,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1F,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,UAAuC,EAAE;IAK/E,MAAM,MA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CAAC,CAAC,EAAE,CAAC,CAC7F;iBACF,CAAC,CACH,CACF;YACL,KAAK,CAAC,OAAO;gBACX,CAAC,CAAC,CAAC,CACC,QAAQ,EACR;oBACE,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,wBAAwB;oBAC/B,QAAQ,EAAE,KAAK,CAAC,OAAO;oBACvB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,QAAQ,EAAE;iBACnC,EACD,MAAM,CAAC,QAAQ,IAAI,WAAW,CAC/B;gBACH,CAAC,CAAC,IAAI;SACT,CAAC,CAAC;IACL,CAAC,CAA2B,CAAC;AAC/B,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AtlasSdkInfo } from '@atlasauth/js';
|
|
2
2
|
/** This package's version, sent as `X-Atlas-SDK` (kept in step with package.json by a test). */
|
|
3
|
-
export declare const ATLAS_SOLID_VERSION = "0.
|
|
3
|
+
export declare const ATLAS_SOLID_VERSION = "0.8.0";
|
|
4
4
|
export declare const ATLAS_SOLID_SDK: AtlasSdkInfo;
|
package/dist/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** This package's version, sent as `X-Atlas-SDK` (kept in step with package.json by a test). */
|
|
2
|
-
export const ATLAS_SOLID_VERSION = '0.
|
|
2
|
+
export const ATLAS_SOLID_VERSION = '0.8.0';
|
|
3
3
|
export const ATLAS_SOLID_SDK = { name: '@atlasauth/solid', version: ATLAS_SOLID_VERSION };
|
|
4
4
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@atlasauth/js": "0.
|
|
14
|
+
"@atlasauth/js": "0.16.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"solid-js": ">=1.8"
|