slotlock 0.5.2 → 0.5.3

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/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
- /** What a booking on it must satisfy (`SlotlockBookingRules`). Absent when it has none. */
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 { SlotlockChange, SlotlockEventFeed } from './event-feed.js';
2
+ import type { SlotlockChange, SlotlockChangeOrigin, 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,16 @@ 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
- /** A change as CloudEvents 1.0 (structured mode): `type` is `io.pylota.slotlock.<change type>`. */
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.
21
+ */
15
22
  export declare function slotlockCloudEvent(change: SlotlockChange): SlotlockCloudEvent;
16
23
  /**
17
24
  * The Standard Webhooks signature of one attempt: `v1,` and the base64 HMAC-SHA256, keyed by the
package/webhooks.js CHANGED
@@ -10,7 +10,10 @@ 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
12
  import { ignoreRejection } from './hooks.js';
13
- /** A change as CloudEvents 1.0 (structured mode): `type` is `io.pylota.slotlock.<change type>`. */
13
+ /**
14
+ * A change as CloudEvents 1.0 (structured mode): `type` is `io.pylota.slotlock.<change type>`, with
15
+ * the extension attributes `slotlockorigin` and `slotlockkeyid` when the change records them.
16
+ */
14
17
  export function slotlockCloudEvent(change) {
15
18
  return {
16
19
  specversion: '1.0',
@@ -20,6 +23,8 @@ export function slotlockCloudEvent(change) {
20
23
  subject: change.subject,
21
24
  time: change.occurredAt.toISOString(),
22
25
  datacontenttype: 'application/json',
26
+ ...(change.origin ? { slotlockorigin: change.origin } : {}),
27
+ ...(change.keyId ? { slotlockkeyid: change.keyId } : {}),
23
28
  data: change.data,
24
29
  };
25
30
  }