slotlock 0.5.2 → 0.6.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 +194 -0
- package/README.md +159 -66
- package/SECURITY.md +26 -13
- package/SPEC.md +10 -7
- package/agent-server.d.ts +47 -4
- package/agent-server.js +492 -147
- package/agent-store-backend.d.ts +9 -0
- package/agent-store-backend.js +83 -15
- package/api-keys.d.ts +12 -2
- package/api-keys.js +36 -7
- package/application-api.d.ts +7 -1
- package/application-api.js +70 -7
- package/assistant.js +2 -1
- package/booking-rules.d.ts +61 -9
- package/booking-rules.js +106 -16
- package/change-watch.d.ts +56 -0
- package/change-watch.js +213 -0
- package/dashboard.d.ts +3 -1
- package/dashboard.js +98 -15
- package/ddl.d.ts +21 -4
- package/ddl.js +555 -7
- package/event-feed.d.ts +54 -4
- package/event-feed.js +107 -8
- package/index.d.ts +8 -7
- package/index.js +5 -4
- package/maintenance.js +12 -10
- package/openapi.json +1309 -82
- package/package.json +1 -1
- package/rest-api.js +12 -0
- package/self-host.js +58 -6
- package/slotlock.manifest.json +1 -1
- package/store.d.ts +35 -3
- package/store.js +447 -135
- package/types.d.ts +14 -1
- package/webhooks.d.ts +10 -2
- package/webhooks.js +11 -3
package/types.d.ts
CHANGED
|
@@ -30,8 +30,14 @@ export interface SlotlockResource {
|
|
|
30
30
|
visibility?: 'shared' | 'private';
|
|
31
31
|
/** When the tenant archived it: no longer listed or booked, its history kept. Absent in use. */
|
|
32
32
|
archivedAt?: Date;
|
|
33
|
-
/**
|
|
33
|
+
/** Its own booking rules (`SlotlockBookingRules`). Absent when it has none. */
|
|
34
34
|
bookingRules?: SlotlockBookingRules;
|
|
35
|
+
/**
|
|
36
|
+
* What a booking on it must satisfy: the tenant's default rules, overlaid by its pool's, overlaid
|
|
37
|
+
* by its own (`setBookingRuleDefaults`), a field set at a narrower level winning. Absent when no
|
|
38
|
+
* rule applies.
|
|
39
|
+
*/
|
|
40
|
+
effectiveBookingRules?: SlotlockBookingRules;
|
|
35
41
|
/**
|
|
36
42
|
* The pool it belongs to: interchangeable resources sharing a name, such as a vehicle class or a
|
|
37
43
|
* room type, booked by the class (`slotlock_book_pool`). Absent when it is in none.
|
|
@@ -630,6 +636,13 @@ export interface CalendarEventRetentionResult {
|
|
|
630
636
|
hasMore: boolean;
|
|
631
637
|
}
|
|
632
638
|
/** What erasing a tenant deleted. */
|
|
639
|
+
/** A tenant's default booking rules (`SlotlockStore.getBookingRuleDefaults`). */
|
|
640
|
+
export interface SlotlockBookingRuleDefaults {
|
|
641
|
+
/** The tenant's own defaults, under every pool's; null when it has none. */
|
|
642
|
+
tenant: SlotlockBookingRules | null;
|
|
643
|
+
/** Each pool's defaults, by pool name, for the pools that have them. */
|
|
644
|
+
pools: Record<string, SlotlockBookingRules>;
|
|
645
|
+
}
|
|
633
646
|
export interface SlotlockTenantErasure {
|
|
634
647
|
/** Rows deleted, by table (every table the tenant owns rows in is named, with 0 for none). */
|
|
635
648
|
rows: Record<string, number>;
|
package/webhooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { lookup as dnsLookup } from 'node:dns';
|
|
2
|
-
import type
|
|
2
|
+
import { type SlotlockChange, type SlotlockChangeOrigin, type SlotlockEventFeed } from './event-feed.js';
|
|
3
3
|
/** The CloudEvents envelope a change is delivered and listed as. */
|
|
4
4
|
export interface SlotlockCloudEvent {
|
|
5
5
|
specversion: '1.0';
|
|
@@ -9,9 +9,17 @@ export interface SlotlockCloudEvent {
|
|
|
9
9
|
subject: string;
|
|
10
10
|
time: string;
|
|
11
11
|
datacontenttype: 'application/json';
|
|
12
|
+
/** Extension attribute: where the change came from (`mcp`, `rest`, `dashboard`, ...), when recorded. */
|
|
13
|
+
slotlockorigin?: SlotlockChangeOrigin;
|
|
14
|
+
/** Extension attribute: the id of the API key that made the change, when one did. */
|
|
15
|
+
slotlockkeyid?: string;
|
|
12
16
|
data: Record<string, unknown>;
|
|
13
17
|
}
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* A change as CloudEvents 1.0 (structured mode): `type` is `io.pylota.slotlock.<change type>`, with
|
|
20
|
+
* the extension attributes `slotlockorigin` and `slotlockkeyid` when the change records them. A
|
|
21
|
+
* `coverage.*` change is redacted as the feed serves it (slotlockServedChange), whoever built it.
|
|
22
|
+
*/
|
|
15
23
|
export declare function slotlockCloudEvent(change: SlotlockChange): SlotlockCloudEvent;
|
|
16
24
|
/**
|
|
17
25
|
* The Standard Webhooks signature of one attempt: `v1,` and the base64 HMAC-SHA256, keyed by the
|
package/webhooks.js
CHANGED
|
@@ -9,18 +9,26 @@ import { Agent as HttpAgent, request as httpRequest } from 'node:http';
|
|
|
9
9
|
import { Agent as HttpsAgent, request as httpsRequest } from 'node:https';
|
|
10
10
|
import { BlockList, isIP } from 'node:net';
|
|
11
11
|
import { Readable } from 'node:stream';
|
|
12
|
+
import { slotlockServedChange, } from './event-feed.js';
|
|
12
13
|
import { ignoreRejection } from './hooks.js';
|
|
13
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* A change as CloudEvents 1.0 (structured mode): `type` is `io.pylota.slotlock.<change type>`, with
|
|
16
|
+
* the extension attributes `slotlockorigin` and `slotlockkeyid` when the change records them. A
|
|
17
|
+
* `coverage.*` change is redacted as the feed serves it (slotlockServedChange), whoever built it.
|
|
18
|
+
*/
|
|
14
19
|
export function slotlockCloudEvent(change) {
|
|
20
|
+
const served = slotlockServedChange(change.type, change.subject, change.data);
|
|
15
21
|
return {
|
|
16
22
|
specversion: '1.0',
|
|
17
23
|
id: change.id,
|
|
18
24
|
source: change.resourceId ? `/slotlock/resources/${change.resourceId}` : '/slotlock',
|
|
19
25
|
type: `io.pylota.slotlock.${change.type}`,
|
|
20
|
-
subject:
|
|
26
|
+
subject: served.subject,
|
|
21
27
|
time: change.occurredAt.toISOString(),
|
|
22
28
|
datacontenttype: 'application/json',
|
|
23
|
-
|
|
29
|
+
...(change.origin ? { slotlockorigin: change.origin } : {}),
|
|
30
|
+
...(change.keyId ? { slotlockkeyid: change.keyId } : {}),
|
|
31
|
+
data: served.data,
|
|
24
32
|
};
|
|
25
33
|
}
|
|
26
34
|
/**
|