slotlock 0.6.3 → 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.
Files changed (76) hide show
  1. package/CHANGELOG.md +511 -0
  2. package/CONTRIBUTING.md +12 -5
  3. package/README.md +50 -1551
  4. package/SECURITY.md +5 -2
  5. package/SPEC.md +1 -1
  6. package/agent-server.d.ts +160 -8
  7. package/agent-server.js +559 -44
  8. package/agent-store-backend.d.ts +34 -1
  9. package/agent-store-backend.js +1399 -38
  10. package/api-keys.d.ts +69 -3
  11. package/api-keys.js +217 -28
  12. package/application-api.d.ts +56 -3
  13. package/application-api.js +826 -15
  14. package/approvals.d.ts +88 -0
  15. package/approvals.js +293 -0
  16. package/assistant.d.ts +70 -1
  17. package/assistant.js +478 -50
  18. package/billing.d.ts +114 -0
  19. package/billing.js +258 -0
  20. package/config.d.ts +25 -4
  21. package/config.js +72 -3
  22. package/dashboard-assistant-ui.d.ts +21 -0
  23. package/dashboard-assistant-ui.js +438 -0
  24. package/dashboard-icon.d.ts +1 -0
  25. package/dashboard-icon.js +5 -0
  26. package/dashboard-markdown.d.ts +2 -0
  27. package/dashboard-markdown.js +157 -0
  28. package/dashboard-settings-ui.d.ts +1 -0
  29. package/dashboard-settings-ui.js +78 -0
  30. package/dashboard.d.ts +227 -7
  31. package/dashboard.js +2313 -247
  32. package/ddl.d.ts +51 -12
  33. package/ddl.js +2566 -54
  34. package/event-feed.d.ts +30 -4
  35. package/event-feed.js +171 -19
  36. package/index.d.ts +15 -4
  37. package/index.js +8 -2
  38. package/maintenance.d.ts +10 -0
  39. package/maintenance.js +16 -2
  40. package/metrics.d.ts +41 -0
  41. package/metrics.js +22 -0
  42. package/openapi.json +14675 -5957
  43. package/otel.d.ts +86 -0
  44. package/otel.js +273 -0
  45. package/overage.d.ts +33 -0
  46. package/overage.js +115 -0
  47. package/package.json +1 -1
  48. package/partner-billing.d.ts +81 -0
  49. package/partner-billing.js +333 -0
  50. package/partner-names.d.ts +8 -0
  51. package/partner-names.js +10 -0
  52. package/partners.d.ts +147 -0
  53. package/partners.js +375 -0
  54. package/plans.d.ts +92 -0
  55. package/plans.js +115 -0
  56. package/quotas.d.ts +108 -0
  57. package/quotas.js +258 -0
  58. package/rate-limit.d.ts +21 -1
  59. package/rate-limit.js +82 -15
  60. package/resource-profile.d.ts +135 -0
  61. package/resource-profile.js +263 -0
  62. package/rest-api.d.ts +2 -0
  63. package/rest-api.js +68 -3
  64. package/sandbox.d.ts +70 -0
  65. package/sandbox.js +295 -0
  66. package/self-host.d.ts +33 -5
  67. package/self-host.js +950 -22
  68. package/slotlock.manifest.json +1 -1
  69. package/store.d.ts +373 -4
  70. package/store.js +1212 -118
  71. package/teams.d.ts +25 -0
  72. package/teams.js +63 -0
  73. package/timezone.js +13 -1
  74. package/types.d.ts +95 -1
  75. package/usage.d.ts +106 -0
  76. package/usage.js +238 -0
@@ -1,9 +1,11 @@
1
1
  import type { Sql } from 'postgres';
2
2
  import type { SlotlockAgentChangeSource } from './change-watch.js';
3
+ import { type SlotlockChangeOrigin } from './event-feed.js';
3
4
  import { type SlotlockAgentCalendarBackend, type SlotlockAgentInvocationContext } from './agent-server.js';
4
5
  import type { SlotlockApplicationBackend } from './application-api.js';
5
6
  import { type SlotlockStore } from './store.js';
6
- import type { SlotlockCalendarEvent, SlotlockResource, WeeklyAvailabilityRule } from './types.js';
7
+ import type { SlotlockApproval, SlotlockCalendarEvent, SlotlockResource, WeeklyAvailabilityRule } from './types.js';
8
+ import { type SlotlockPartnerStore } from './partners.js';
7
9
  export interface SlotlockStoreAgentBackendOptions {
8
10
  /**
9
11
  * The default bookable hours, for resources without hours of their own
@@ -13,6 +15,12 @@ export interface SlotlockStoreAgentBackendOptions {
13
15
  /** Provider sources that must prove complete coverage before availability is called certain. */
14
16
  requiredCoverageSources?(context: SlotlockAgentInvocationContext, resource: SlotlockResource): Promise<readonly string[]>;
15
17
  coverageMaxAgeMs?: number;
18
+ /**
19
+ * The longest an approval policy may hold a write for a person (RFC 0004 A4), in minutes: each
20
+ * policy sets its own wait, bounded by the booking's start less its lead time and by this. 1 to
21
+ * 43,200 (30 days, the default).
22
+ */
23
+ maxApprovalMinutes?: number;
16
24
  }
17
25
  /**
18
26
  * A stored calendar event in the shape the event tools return. Exported for an application that
@@ -47,7 +55,32 @@ export interface SlotlockStoreApplicationBackendOptions {
47
55
  * undone, and an operator may owe a tenant's data a retention or review first.
48
56
  */
49
57
  tenantErasure?: boolean;
58
+ /**
59
+ * The partner API (RFC 0003 P3): the partner store (partners.ts) its operations run through, for
60
+ * the partner a partner key names. Unset: they answer 404 partner_api_not_served.
61
+ */
62
+ partners?: SlotlockPartnerStore;
63
+ /**
64
+ * The agent backend (`createSlotlockStoreAgentBackend`) a granted approval's booking is made
65
+ * through (RFC 0004 A4), as the agent that asked. Unset: a grant answers 409
66
+ * approvals_unavailable; declining still works.
67
+ */
68
+ agentBackend?: SlotlockAgentCalendarBackend;
50
69
  }
70
+ /**
71
+ * Run a granted approval's write as the agent that asked for it, in one transaction with the grant:
72
+ * its holds give way, the write is made, and the approval is marked granted.
73
+ */
74
+ export declare function runSlotlockApprovalGrant(agentBackend: SlotlockAgentCalendarBackend, approval: SlotlockApproval & {
75
+ requester: Record<string, unknown>;
76
+ }, grant: {
77
+ tenantRef: string;
78
+ decidedBy: string;
79
+ signal: AbortSignal;
80
+ origin?: SlotlockChangeOrigin;
81
+ /** Make the booking and the grant, then roll both back (RFC 0004 A3). */
82
+ dryRun?: boolean;
83
+ }): Promise<Record<string, unknown>>;
51
84
  /**
52
85
  * Serve the application API (application-api.ts) from the store in the principal's tenant. Every
53
86
  * resource named must be the tenant's, or it is not found; holds are under the tenant's RLS, so