@haverstack/core 0.40.0 → 0.42.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 (287) hide show
  1. package/README.md +121 -59
  2. package/dist/access.d.ts +34 -36
  3. package/dist/access.d.ts.map +1 -1
  4. package/dist/access.js +65 -42
  5. package/dist/access.js.map +1 -1
  6. package/dist/{combine.d.ts → adapter/combine.d.ts} +8 -1
  7. package/dist/adapter/combine.d.ts.map +1 -0
  8. package/dist/{combine.js → adapter/combine.js} +7 -0
  9. package/dist/adapter/combine.js.map +1 -0
  10. package/dist/{adapter-entry.d.ts → adapter/index.d.ts} +6 -5
  11. package/dist/adapter/index.d.ts.map +1 -0
  12. package/dist/{adapter-entry.js → adapter/index.js} +5 -4
  13. package/dist/adapter/index.js.map +1 -0
  14. package/dist/{sort.d.ts → adapter/sort.d.ts} +20 -20
  15. package/dist/adapter/sort.d.ts.map +1 -0
  16. package/dist/{sort.js → adapter/sort.js} +37 -27
  17. package/dist/adapter/sort.js.map +1 -0
  18. package/dist/associations/identity.d.ts +93 -0
  19. package/dist/associations/identity.d.ts.map +1 -0
  20. package/dist/associations/identity.js +198 -0
  21. package/dist/associations/identity.js.map +1 -0
  22. package/dist/associations/validation.d.ts +90 -0
  23. package/dist/associations/validation.d.ts.map +1 -0
  24. package/dist/associations/validation.js +339 -0
  25. package/dist/associations/validation.js.map +1 -0
  26. package/dist/attachment-records.d.ts +48 -0
  27. package/dist/attachment-records.d.ts.map +1 -0
  28. package/dist/attachment-records.js +52 -0
  29. package/dist/attachment-records.js.map +1 -0
  30. package/dist/collection.d.ts +182 -0
  31. package/dist/collection.d.ts.map +1 -0
  32. package/dist/collection.js +407 -0
  33. package/dist/collection.js.map +1 -0
  34. package/dist/content-match.d.ts +25 -0
  35. package/dist/content-match.d.ts.map +1 -0
  36. package/dist/content-match.js +51 -0
  37. package/dist/content-match.js.map +1 -0
  38. package/dist/content-translation.d.ts +42 -0
  39. package/dist/content-translation.d.ts.map +1 -0
  40. package/dist/content-translation.js +108 -0
  41. package/dist/content-translation.js.map +1 -0
  42. package/dist/did/did.d.ts.map +1 -0
  43. package/dist/{did.js → did/did.js} +3 -4
  44. package/dist/did/did.js.map +1 -0
  45. package/dist/{did-entry.d.ts → did/index.d.ts} +1 -1
  46. package/dist/did/index.d.ts.map +1 -0
  47. package/dist/{did-entry.js → did/index.js} +3 -3
  48. package/dist/did/index.js.map +1 -0
  49. package/dist/errors.d.ts +36 -63
  50. package/dist/errors.d.ts.map +1 -1
  51. package/dist/errors.js +35 -58
  52. package/dist/errors.js.map +1 -1
  53. package/dist/grants.d.ts +20 -43
  54. package/dist/grants.d.ts.map +1 -1
  55. package/dist/grants.js +71 -134
  56. package/dist/grants.js.map +1 -1
  57. package/dist/id.d.ts +13 -31
  58. package/dist/id.d.ts.map +1 -1
  59. package/dist/id.js +13 -31
  60. package/dist/id.js.map +1 -1
  61. package/dist/index.d.ts +14 -8
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +9 -5
  64. package/dist/index.js.map +1 -1
  65. package/dist/install.d.ts +141 -0
  66. package/dist/install.d.ts.map +1 -0
  67. package/dist/install.js +219 -0
  68. package/dist/install.js.map +1 -0
  69. package/dist/merge.d.ts.map +1 -1
  70. package/dist/merge.js +5 -11
  71. package/dist/merge.js.map +1 -1
  72. package/dist/migration-steps.d.ts +102 -0
  73. package/dist/migration-steps.d.ts.map +1 -0
  74. package/dist/migration-steps.js +293 -0
  75. package/dist/migration-steps.js.map +1 -0
  76. package/dist/query-validation.d.ts +28 -94
  77. package/dist/query-validation.d.ts.map +1 -1
  78. package/dist/query-validation.js +156 -336
  79. package/dist/query-validation.js.map +1 -1
  80. package/dist/record-changes.d.ts +2 -117
  81. package/dist/record-changes.d.ts.map +1 -1
  82. package/dist/record-changes.js +10 -212
  83. package/dist/record-changes.js.map +1 -1
  84. package/dist/schema.d.ts +18 -7
  85. package/dist/schema.d.ts.map +1 -1
  86. package/dist/schema.js +59 -30
  87. package/dist/schema.js.map +1 -1
  88. package/dist/scoped-stack/authority.d.ts +156 -0
  89. package/dist/scoped-stack/authority.d.ts.map +1 -0
  90. package/dist/scoped-stack/authority.js +384 -0
  91. package/dist/scoped-stack/authority.js.map +1 -0
  92. package/dist/scoped-stack/scoped-stack.d.ts +338 -0
  93. package/dist/scoped-stack/scoped-stack.d.ts.map +1 -0
  94. package/dist/scoped-stack/scoped-stack.js +776 -0
  95. package/dist/scoped-stack/scoped-stack.js.map +1 -0
  96. package/dist/scoped-stack/subscription.d.ts +55 -0
  97. package/dist/scoped-stack/subscription.d.ts.map +1 -0
  98. package/dist/scoped-stack/subscription.js +110 -0
  99. package/dist/scoped-stack/subscription.js.map +1 -0
  100. package/dist/stack/attachments.d.ts +24 -0
  101. package/dist/stack/attachments.d.ts.map +1 -0
  102. package/dist/stack/attachments.js +113 -0
  103. package/dist/stack/attachments.js.map +1 -0
  104. package/dist/{changes.d.ts → stack/changes.d.ts} +29 -65
  105. package/dist/stack/changes.d.ts.map +1 -0
  106. package/dist/{changes.js → stack/changes.js} +32 -66
  107. package/dist/stack/changes.js.map +1 -0
  108. package/dist/stack/client.d.ts +271 -0
  109. package/dist/stack/client.d.ts.map +1 -0
  110. package/dist/stack/client.js +9 -0
  111. package/dist/stack/client.js.map +1 -0
  112. package/dist/stack/identity-bindings.d.ts.map +1 -0
  113. package/dist/{identity-bindings.js → stack/identity-bindings.js} +8 -14
  114. package/dist/stack/identity-bindings.js.map +1 -0
  115. package/dist/stack/install-app.d.ts +22 -0
  116. package/dist/stack/install-app.d.ts.map +1 -0
  117. package/dist/stack/install-app.js +260 -0
  118. package/dist/stack/install-app.js.map +1 -0
  119. package/dist/stack/integrity.d.ts +94 -0
  120. package/dist/stack/integrity.d.ts.map +1 -0
  121. package/dist/stack/integrity.js +268 -0
  122. package/dist/stack/integrity.js.map +1 -0
  123. package/dist/{limits.d.ts → stack/limits.d.ts} +2 -5
  124. package/dist/stack/limits.d.ts.map +1 -0
  125. package/dist/{limits.js → stack/limits.js} +3 -6
  126. package/dist/stack/limits.js.map +1 -0
  127. package/dist/stack/migrations.d.ts +59 -0
  128. package/dist/stack/migrations.d.ts.map +1 -0
  129. package/dist/stack/migrations.js +141 -0
  130. package/dist/stack/migrations.js.map +1 -0
  131. package/dist/{stack-reads.d.ts → stack/reads.d.ts} +33 -6
  132. package/dist/stack/reads.d.ts.map +1 -0
  133. package/dist/{stack-reads.js → stack/reads.js} +49 -7
  134. package/dist/stack/reads.js.map +1 -0
  135. package/dist/stack/record-id.d.ts +35 -0
  136. package/dist/stack/record-id.d.ts.map +1 -0
  137. package/dist/stack/record-id.js +82 -0
  138. package/dist/stack/record-id.js.map +1 -0
  139. package/dist/stack/stack.d.ts +438 -0
  140. package/dist/stack/stack.d.ts.map +1 -0
  141. package/dist/stack/stack.js +1366 -0
  142. package/dist/stack/stack.js.map +1 -0
  143. package/dist/stack/system-types.d.ts +16 -0
  144. package/dist/stack/system-types.d.ts.map +1 -0
  145. package/dist/stack/system-types.js +111 -0
  146. package/dist/stack/system-types.js.map +1 -0
  147. package/dist/stack/type-grants.d.ts +20 -0
  148. package/dist/stack/type-grants.d.ts.map +1 -0
  149. package/dist/stack/type-grants.js +69 -0
  150. package/dist/stack/type-grants.js.map +1 -0
  151. package/dist/stack/write-expectation.d.ts +78 -0
  152. package/dist/stack/write-expectation.d.ts.map +1 -0
  153. package/dist/stack/write-expectation.js +71 -0
  154. package/dist/stack/write-expectation.js.map +1 -0
  155. package/dist/testing.d.ts +21 -26
  156. package/dist/testing.d.ts.map +1 -1
  157. package/dist/testing.js +50 -70
  158. package/dist/testing.js.map +1 -1
  159. package/dist/type-handle.d.ts +67 -78
  160. package/dist/type-handle.d.ts.map +1 -1
  161. package/dist/type-handle.js +44 -111
  162. package/dist/type-handle.js.map +1 -1
  163. package/dist/types/adapter.d.ts +223 -0
  164. package/dist/types/adapter.d.ts.map +1 -0
  165. package/dist/types/adapter.js +5 -0
  166. package/dist/types/adapter.js.map +1 -0
  167. package/dist/types/associations.d.ts +156 -0
  168. package/dist/types/associations.d.ts.map +1 -0
  169. package/dist/types/associations.js +13 -0
  170. package/dist/types/associations.js.map +1 -0
  171. package/dist/types/capabilities.d.ts +89 -0
  172. package/dist/types/capabilities.d.ts.map +1 -0
  173. package/dist/types/capabilities.js +5 -0
  174. package/dist/types/capabilities.js.map +1 -0
  175. package/dist/types/events.d.ts +155 -0
  176. package/dist/types/events.d.ts.map +1 -0
  177. package/dist/types/events.js +5 -0
  178. package/dist/types/events.js.map +1 -0
  179. package/dist/types/ids.d.ts +43 -0
  180. package/dist/types/ids.d.ts.map +1 -0
  181. package/dist/types/ids.js +5 -0
  182. package/dist/types/ids.js.map +1 -0
  183. package/dist/types/index.d.ts +19 -0
  184. package/dist/types/index.d.ts.map +1 -0
  185. package/dist/types/index.js +19 -0
  186. package/dist/types/index.js.map +1 -0
  187. package/dist/types/journal.d.ts +47 -0
  188. package/dist/types/journal.d.ts.map +1 -0
  189. package/dist/types/journal.js +5 -0
  190. package/dist/types/journal.js.map +1 -0
  191. package/dist/types/query.d.ts +185 -0
  192. package/dist/types/query.d.ts.map +1 -0
  193. package/dist/types/query.js +10 -0
  194. package/dist/types/query.js.map +1 -0
  195. package/dist/types/records.d.ts +76 -0
  196. package/dist/types/records.d.ts.map +1 -0
  197. package/dist/types/records.js +5 -0
  198. package/dist/types/records.js.map +1 -0
  199. package/dist/types/schema.d.ts +74 -0
  200. package/dist/types/schema.d.ts.map +1 -0
  201. package/dist/types/schema.js +5 -0
  202. package/dist/types/schema.js.map +1 -0
  203. package/dist/types/system.d.ts +161 -0
  204. package/dist/types/system.d.ts.map +1 -0
  205. package/dist/types/system.js +32 -0
  206. package/dist/types/system.js.map +1 -0
  207. package/dist/types/tokens.d.ts +39 -0
  208. package/dist/types/tokens.d.ts.map +1 -0
  209. package/dist/types/tokens.js +5 -0
  210. package/dist/types/tokens.js.map +1 -0
  211. package/dist/validate.d.ts +29 -70
  212. package/dist/validate.d.ts.map +1 -1
  213. package/dist/validate.js +65 -97
  214. package/dist/validate.js.map +1 -1
  215. package/dist/{attachment-download.d.ts → wire/attachment-download.d.ts} +0 -57
  216. package/dist/wire/attachment-download.d.ts.map +1 -0
  217. package/dist/{attachment-download.js → wire/attachment-download.js} +0 -61
  218. package/dist/wire/attachment-download.js.map +1 -0
  219. package/dist/{auth.d.ts → wire/auth.d.ts} +5 -8
  220. package/dist/wire/auth.d.ts.map +1 -0
  221. package/dist/{auth.js → wire/auth.js} +5 -8
  222. package/dist/wire/auth.js.map +1 -0
  223. package/dist/{wire-body.d.ts → wire/body.d.ts} +13 -5
  224. package/dist/wire/body.d.ts.map +1 -0
  225. package/dist/{wire-body.js → wire/body.js} +65 -7
  226. package/dist/wire/body.js.map +1 -0
  227. package/dist/{wire-entry.d.ts → wire/index.d.ts} +12 -12
  228. package/dist/wire/index.d.ts.map +1 -0
  229. package/dist/{wire-entry.js → wire/index.js} +13 -17
  230. package/dist/wire/index.js.map +1 -0
  231. package/dist/{wire-record.d.ts → wire/record.d.ts} +10 -22
  232. package/dist/wire/record.d.ts.map +1 -0
  233. package/dist/{wire-record.js → wire/record.js} +12 -24
  234. package/dist/wire/record.js.map +1 -0
  235. package/dist/{wire-request.d.ts → wire/request.d.ts} +20 -37
  236. package/dist/wire/request.d.ts.map +1 -0
  237. package/dist/{wire-request.js → wire/request.js} +79 -54
  238. package/dist/wire/request.js.map +1 -0
  239. package/package.json +7 -7
  240. package/dist/adapter-entry.d.ts.map +0 -1
  241. package/dist/adapter-entry.js.map +0 -1
  242. package/dist/attachment-download.d.ts.map +0 -1
  243. package/dist/attachment-download.js.map +0 -1
  244. package/dist/auth.d.ts.map +0 -1
  245. package/dist/auth.js.map +0 -1
  246. package/dist/changes.d.ts.map +0 -1
  247. package/dist/changes.js.map +0 -1
  248. package/dist/combine.d.ts.map +0 -1
  249. package/dist/combine.js.map +0 -1
  250. package/dist/did-entry.d.ts.map +0 -1
  251. package/dist/did-entry.js.map +0 -1
  252. package/dist/did.d.ts.map +0 -1
  253. package/dist/did.js.map +0 -1
  254. package/dist/identity-bindings.d.ts.map +0 -1
  255. package/dist/identity-bindings.js.map +0 -1
  256. package/dist/limits.d.ts.map +0 -1
  257. package/dist/limits.js.map +0 -1
  258. package/dist/record-id.d.ts +0 -70
  259. package/dist/record-id.d.ts.map +0 -1
  260. package/dist/record-id.js +0 -127
  261. package/dist/record-id.js.map +0 -1
  262. package/dist/scoped-stack.d.ts +0 -532
  263. package/dist/scoped-stack.d.ts.map +0 -1
  264. package/dist/scoped-stack.js +0 -1219
  265. package/dist/scoped-stack.js.map +0 -1
  266. package/dist/sort.d.ts.map +0 -1
  267. package/dist/sort.js.map +0 -1
  268. package/dist/stack-reads.d.ts.map +0 -1
  269. package/dist/stack-reads.js.map +0 -1
  270. package/dist/stack.d.ts +0 -971
  271. package/dist/stack.d.ts.map +0 -1
  272. package/dist/stack.js +0 -2012
  273. package/dist/stack.js.map +0 -1
  274. package/dist/types.d.ts +0 -1250
  275. package/dist/types.d.ts.map +0 -1
  276. package/dist/types.js +0 -49
  277. package/dist/types.js.map +0 -1
  278. package/dist/wire-body.d.ts.map +0 -1
  279. package/dist/wire-body.js.map +0 -1
  280. package/dist/wire-entry.d.ts.map +0 -1
  281. package/dist/wire-entry.js.map +0 -1
  282. package/dist/wire-record.d.ts.map +0 -1
  283. package/dist/wire-record.js.map +0 -1
  284. package/dist/wire-request.d.ts.map +0 -1
  285. package/dist/wire-request.js.map +0 -1
  286. /package/dist/{did.d.ts → did/did.d.ts} +0 -0
  287. /package/dist/{identity-bindings.d.ts → stack/identity-bindings.d.ts} +0 -0
@@ -0,0 +1,438 @@
1
+ /**
2
+ * Stack — Core Stack Class
3
+ * -------------------------------------------------------
4
+ * The Stack class is the primary interface for apps. It sits
5
+ * on top of a StackAdapter and adds:
6
+ *
7
+ * - ID generation, and validation of every caller-supplied field
8
+ * - Type definition, schema hashing and drift detection
9
+ * - Content validation on write, and the integrity rules in integrity.ts
10
+ * - Migrations: the registry, commitMigration() and owner-driven migrateAll()
11
+ * - Version snapshots, the change journal, soft delete and purge
12
+ * - Association and permission edits, and the change feed
13
+ * - Attachments, type-level grants and app installs, whose bodies live
14
+ * beside this file
15
+ * - asEntity()/asActor(), the scoped views that enforce access control
16
+ *
17
+ * Apps should never talk to a StackAdapter directly.
18
+ */
19
+ import type { StackRecord, StackType, TypeSchema, TypeId, BaseId, StackAdapter, StackQuery, QueryResult, AssociationEdit, AuthorityAssociation, DataAssociation, RecordVersion, StackCapabilities, IfVersionOptions, GrantContent, TypeGrant, PutAttachmentOptions, AttachmentContent, FileId, EntityId, AppId, InstallContent, RecordId, Actor, ActorOptions, RecordChange, RecordChangeSet, SubscribeOptions, Unsubscribe, JournalQuery, VersionsQuery, RecordJournalEntry } from '../types/index.js';
20
+ import type { GrantQuery } from '../grants.js';
21
+ import type { AppManifest, InstallPlan } from '../install.js';
22
+ import { ScopedStack } from '../scoped-stack/scoped-stack.js';
23
+ import type { BackdatableCreateRecordOptions, CollectAttachmentGarbageOptions, CollectAttachmentGarbageResult, DefineTypeOptions, DeleteAndReturnResult, DeleteRecordOptions, DeleteResult, GetRecordOptions, MigrateAllOptions, StackClient, StackOptions } from './client.js';
24
+ import type { ExpectationOptions } from './write-expectation.js';
25
+ import type { ContentOf, ReadonlyTypeSchema, TypeHandle } from '../type-handle.js';
26
+ import type { Collection } from '../collection.js';
27
+ export declare class Stack implements StackClient {
28
+ private readonly adapter;
29
+ private readonly idTimestampSkewMsValue;
30
+ private readonly migrations;
31
+ /**
32
+ * Types this instance has fetched or defined, keyed by versioned id. A
33
+ * Type's schema is immutable once defined, so entries are never
34
+ * invalidated, only added; listTypes() refreshes wholesale. See
35
+ * docs/spec/data-model.md § Type cache.
36
+ */
37
+ private readonly typeCache;
38
+ /** Set by close(). See docs/spec/adapters.md § Lifecycle. */
39
+ private closed;
40
+ /**
41
+ * Every change made through this Stack. `ScopedStack` filters this same
42
+ * stream rather than opening its own, so no scoped view can observe a
43
+ * change the stack did not emit. See docs/spec/events.md.
44
+ */
45
+ private readonly changes;
46
+ private constructor();
47
+ /**
48
+ * Announce a mutation that has already been persisted. Called after the
49
+ * adapter write resolves and before the mutating method settles, so
50
+ * `await stack.mutate(...)` guarantees subscribers have been notified —
51
+ * and nothing about work they deferred. A handler cannot fail the write:
52
+ * there is nothing left to fail. See docs/spec/events.md § Handlers.
53
+ */
54
+ private announce;
55
+ /**
56
+ * The actor for a `create` journal entry, read off the record as just
57
+ * built. Create is the one journaled write that stamps the requester
58
+ * onto the row itself, so the record in hand is authoritative — and it
59
+ * carries `appId`, which ActorOptions has no field for.
60
+ */
61
+ private static createActor;
62
+ private getTypeCached;
63
+ /**
64
+ * Open a Stack over an adapter. Reads ownerEntityId and timezone from the adapter.
65
+ */
66
+ static open(adapter: StackAdapter, opts?: StackOptions): Promise<Stack>;
67
+ /**
68
+ * Idempotent bootstrap for StackOptions.ownerProfile. Its probe sees every
69
+ * card the binding rules do, deleted and migrated ones included, or it
70
+ * would mint one they then refuse and the stack would not reopen.
71
+ * See docs/spec/identity.md § Entity.
72
+ */
73
+ private ensureOwnerEntity;
74
+ get ownerEntityId(): EntityId;
75
+ getEntityByDid(did: EntityId): Promise<StackRecord | null>;
76
+ getOwnerEntity(): Promise<StackRecord | null>;
77
+ get timezone(): string | undefined;
78
+ get capabilities(): StackCapabilities;
79
+ /**
80
+ * Get a permission-scoped view of this Stack, as if requests came from
81
+ * the given entity acting as itself (null = anonymous). Plain Stack
82
+ * methods are unscoped; use asEntity() when one Stack serves multiple,
83
+ * possibly untrusted, entities. See
84
+ * docs/spec/access-control.md § Enforcement: Stack.asEntity().
85
+ */
86
+ asEntity(entityId: EntityId | null): ScopedStack;
87
+ /**
88
+ * Scope to an Actor — a delegated app acting for its user, or a
89
+ * TokenSession as StackTokenStore.lookupToken() returns it, which is what
90
+ * a server should pass at its request boundary.
91
+ * See docs/spec/access-control.md § Delegation: principal and subject.
92
+ */
93
+ asActor(actor: Actor): ScopedStack;
94
+ private scope;
95
+ collection<S extends ReadonlyTypeSchema>(handle: TypeHandle<S>): Collection<ContentOf<S>>;
96
+ /**
97
+ * Define and persist a Type; call at app startup before creating records
98
+ * of the type. Redefining an existing typeId is checked against the
99
+ * stored schema: identical is a no-op, a name-only change persists, and
100
+ * anything beyond additive evolution throws StackSchemaDriftError. See
101
+ * docs/spec/data-model.md § Schema drift detection.
102
+ */
103
+ defineType({ id, name, schema: declared, migratesFrom, }: DefineTypeOptions): Promise<StackType>;
104
+ getType(id: TypeId): Promise<StackType | null>;
105
+ /** Refreshes typeCache wholesale — the explicit way to see a rename made by another writer. */
106
+ listTypes(): Promise<StackType[]>;
107
+ /**
108
+ * Check whether a record's type is compatible with a required schema.
109
+ * Useful for duck-typed consumption across types.
110
+ */
111
+ typeIsCompatible(typeId: TypeId, requiredSchema: TypeSchema): Promise<boolean>;
112
+ /**
113
+ * Migrate every record of a family, deleted ones included, to the latest
114
+ * version, aborting on the first that fails validation. `sweep: 'listed'`
115
+ * is for a contained app that cannot see unlisted or deleted content.
116
+ * See docs/spec/data-model.md § Type migrations.
117
+ */
118
+ migrateAll(baseId: BaseId, opts?: MigrateAllOptions): Promise<{
119
+ migrated: number;
120
+ skipped: number;
121
+ }>;
122
+ /**
123
+ * Create a record, validated against its type's schema. The one site that
124
+ * stamps a `_group`'s author as its first `admin`, for scoped creates too.
125
+ * Backdating is accepted unconditionally here; ScopedStack decides who may.
126
+ * See docs/spec/data-model.md § Backdating on import.
127
+ */
128
+ create<T extends Record<string, unknown> = Record<string, unknown>>(typeId: TypeId, input: T, opts?: BackdatableCreateRecordOptions): Promise<StackRecord & {
129
+ content: T;
130
+ }>;
131
+ /**
132
+ * Get a record by ID, exactly as stored — no implicit migration. Pass
133
+ * { presentAt: 'latest' } to migrate in memory; only migrateAll()
134
+ * commits migrations to disk. A soft-deleted record answers `null` unless
135
+ * { includeDeleted: true } is passed.
136
+ */
137
+ get(id: RecordId, opts?: GetRecordOptions): Promise<StackRecord | null>;
138
+ /**
139
+ * Apply a change set as one atomic write — see StackClient.mutate(). A
140
+ * set the record already satisfies writes nothing, and content is checked
141
+ * against the record's current stored type.
142
+ * See docs/spec/data-model.md § Mutations.
143
+ */
144
+ mutate(id: RecordId, changes: RecordChangeSet, opts?: IfVersionOptions & ActorOptions & ExpectationOptions): Promise<StackRecord>;
145
+ /**
146
+ * mutate() with `contentPatch` alone. The common case by a wide margin,
147
+ * and named for what it does rather than for a symmetry with create()
148
+ * that a patch does not have.
149
+ */
150
+ patchContent(id: RecordId, patch: Record<string, unknown | null>, opts?: IfVersionOptions & ActorOptions & ExpectationOptions): Promise<StackRecord>;
151
+ /**
152
+ * Every check a change set owes, all before anything is written. Returns
153
+ * the merged content for a content patch, which the caller compares to
154
+ * decide whether content moved. A parent is checked only when it changes.
155
+ */
156
+ private validateChangeSet;
157
+ /**
158
+ * Add associations to a record, without a version bump. One matching an
159
+ * existing association's identity but a different `attachmentRecordId`
160
+ * re-points it in place. See docs/spec/attachments.md § Naming the upload
161
+ * a reference came from.
162
+ */
163
+ associate(id: RecordId, associations: DataAssociation[], opts?: ActorOptions & ExpectationOptions): Promise<StackRecord>;
164
+ /**
165
+ * Remove associations from a record — see associate(). Matched by kind,
166
+ * label and payload; an element not found is a no-op. The emitted event
167
+ * names each association by identity only, since an attachment's
168
+ * `attachmentRecordId` describes nothing current once it is gone; the
169
+ * journal is where it survives.
170
+ */
171
+ dissociate(id: RecordId, associations: DataAssociation[], opts?: ActorOptions & ExpectationOptions): Promise<StackRecord>;
172
+ /**
173
+ * The atomic form of associate() and dissociate(): one list of adds and
174
+ * removes, one adapter write, one journal entry. The journal records each
175
+ * element in full — a remove with its annotation, a re-point with what it
176
+ * overwrote — so the entry is as undoable as a single-element one.
177
+ * See docs/spec/data-model.md § Mutations.
178
+ */
179
+ amendAssociations(id: RecordId, changes: AssociationEdit[], opts?: ActorOptions & ExpectationOptions, surface?: string): Promise<StackRecord>;
180
+ /**
181
+ * Extend who reaches a record. The spelling that survives two admins
182
+ * sharing a record at once: a `permissions` key write replaces the whole
183
+ * set, so the later of two concurrent ones drops what the earlier
184
+ * granted. No-bump, like associate(); an element the record already
185
+ * carries is a no-op. `write` never implies `read` — name both.
186
+ */
187
+ grantAccess(id: RecordId, permissions: AuthorityAssociation[], opts?: ActorOptions & ExpectationOptions): Promise<StackRecord>;
188
+ /**
189
+ * Withdraw elements of who reaches a record — see grantAccess() for why
190
+ * this is a verb rather than a key write. An element the record does not
191
+ * carry is a no-op. Returns the record as it now stands.
192
+ */
193
+ revokeAccess(id: RecordId, permissions: AuthorityAssociation[], opts?: ActorOptions & ExpectationOptions): Promise<StackRecord>;
194
+ /**
195
+ * The atomic form of grantAccess() and revokeAccess(). The
196
+ * write-implies-read invariant is asked once, of the set the whole list
197
+ * produces. See docs/spec/access-control.md § Write implies read.
198
+ */
199
+ amendAccess(id: RecordId, changes: AssociationEdit[], opts?: ActorOptions & ExpectationOptions, surface?: string): Promise<StackRecord>;
200
+ /**
201
+ * Hold a permission set to the cross-element invariant — see
202
+ * validatePermissions() in access.ts for why it reads the post-state.
203
+ */
204
+ private assertPermissionSet;
205
+ /**
206
+ * A soft-deleted record has no current state to edit, so the verbs that
207
+ * edit one refuse it; undelete() and commitMigration() do not call this.
208
+ * Asked after the record is found and, under ScopedStack, after the
209
+ * authority decision. See docs/spec/versioning.md § Mutations are refused,
210
+ * not applied to a tombstone.
211
+ */
212
+ private refuseIfDeleted;
213
+ /**
214
+ * A by-id read straight from the adapter, for the integrity checks a write
215
+ * runs once it is under way: they read past the open-check, as the write
216
+ * they belong to was admitted before any close() began.
217
+ */
218
+ private readonly readRecord;
219
+ /** The record, or the not-found refusal every mutating verb owes. */
220
+ private requireRecord;
221
+ /**
222
+ * Soft-delete a record, or purge it with its history. A purge reports
223
+ * the files the record referenced, deleting none of them. Use
224
+ * deleteAndReturn() when the record is needed too. See
225
+ * docs/spec/versioning.md § Deletion and docs/spec/attachments.md § A
226
+ * purge strands the bytes it referenced.
227
+ */
228
+ delete(id: RecordId, opts?: DeleteRecordOptions & ActorOptions & ExpectationOptions): Promise<DeleteResult>;
229
+ /**
230
+ * delete(), plus the record it acted on — before destruction for a purge,
231
+ * the tombstone for a soft delete — captured inside the same write, so no
232
+ * concurrent write can land unseen between a read and the delete.
233
+ */
234
+ deleteAndReturn(id: RecordId, opts?: DeleteRecordOptions & ActorOptions & ExpectationOptions): Promise<DeleteAndReturnResult>;
235
+ /**
236
+ * The files a record references, by the same definition
237
+ * deleteAttachment() and the garbage sweep use: attachment associations
238
+ * and top-level `file-ref` content fields. An `_attachment` record's own
239
+ * `fileId` is a plain string by design and is not one, which is why
240
+ * purging a metadata record reports nothing — see systemTypeDefinitions().
241
+ */
242
+ private referencedFileIds;
243
+ /**
244
+ * Reverse a soft delete. Idempotent — undeleting a record that isn't
245
+ * deleted returns it unchanged. Purged records are gone, so this
246
+ * throws StackNotFoundError for them just like any other missing record.
247
+ * Snapshots and bumps version, same as delete().
248
+ */
249
+ undelete(id: RecordId, opts?: IfVersionOptions & ActorOptions & ExpectationOptions): Promise<StackRecord>;
250
+ /**
251
+ * Query records. filter.baseId matches every version of a type family,
252
+ * resolved against registered Types. Results come back exactly as
253
+ * stored; pass presentAt: 'latest' to migrate in memory. See
254
+ * docs/spec/data-model.md § Queries.
255
+ */
256
+ query(query?: StackQuery): Promise<QueryResult>;
257
+ /**
258
+ * Resolve filter.baseId into a concrete typeId set (intersected with
259
+ * filter.typeId when both are given), so adapters never need their own
260
+ * baseId concept. Returns EMPTY_FAMILY when the resolved set is empty so
261
+ * the caller can short-circuit without an adapter round trip.
262
+ */
263
+ private resolveBaseIdFilter;
264
+ /**
265
+ * Every registered version of the named families, as concrete typeIds —
266
+ * resolved here because an adapter has no baseId concept of its own.
267
+ */
268
+ private familyTypeIds;
269
+ getVersions(id: RecordId, query?: VersionsQuery): Promise<RecordVersion[]>;
270
+ /**
271
+ * A record's change journal, oldest first, ungated. A missing or purged
272
+ * record is StackNotFoundError, since a destroyed log and an empty one
273
+ * are not the same answer. See docs/spec/journal.md § Reading it.
274
+ */
275
+ getJournal(id: RecordId, query?: JournalQuery): Promise<RecordJournalEntry[]>;
276
+ getVersion(id: RecordId, version: number): Promise<RecordVersion | null>;
277
+ /**
278
+ * Restore a record to a previous version by creating a new version —
279
+ * never rewrites history. The snapshot is validated against its own
280
+ * stored typeId, and puts back `content` and `typeId` alone: a snapshot
281
+ * carries nothing else. See docs/spec/versioning.md § Restore semantics.
282
+ */
283
+ restoreVersion(id: RecordId, version: number, opts?: IfVersionOptions & ActorOptions & ExpectationOptions): Promise<StackRecord>;
284
+ /**
285
+ * Commit a per-record migration with caller-supplied content. Create-shaped
286
+ * at the destination and update-shaped over the record, so it owes both
287
+ * sets of integrity checks. See docs/spec/data-model.md § Type migrations.
288
+ */
289
+ commitMigration(id: RecordId, toTypeId: TypeId, content: Record<string, unknown>, opts?: IfVersionOptions & ActorOptions): Promise<StackRecord>;
290
+ /**
291
+ * The checked migration write behind commitMigration() and migrateAll(),
292
+ * taking the record in hand so a batch pass needs no re-read. A Migration
293
+ * function is held to the same checks as a request body: app code is no
294
+ * trust boundary here.
295
+ */
296
+ private commitMigrationChecked;
297
+ /**
298
+ * Store bytes and create their `_attachment@1` metadata record, returning
299
+ * it: `content.fileId` addresses the bytes, `id` the metadata. Uses the
300
+ * adapter's atomic putAttachmentWithMetadata() where there is one.
301
+ * See docs/spec/wire-format.md § Attachments.
302
+ */
303
+ putAttachment(data: Uint8Array, opts: PutAttachmentOptions): Promise<StackRecord & {
304
+ content: AttachmentContent;
305
+ }>;
306
+ getAttachment(fileId: FileId): Promise<Uint8Array>;
307
+ /**
308
+ * Every `_attachment` record describing `fileId`, earliest-recorded first.
309
+ * Not on StackClient: it presents an access decision already made, which
310
+ * a scoped version would only check a second, different way. See
311
+ * docs/spec/attachments.md § Finding a `fileId`'s metadata records.
312
+ */
313
+ getAttachmentRecords(fileId: FileId): Promise<(StackRecord & {
314
+ content: AttachmentContent;
315
+ })[]>;
316
+ /**
317
+ * Delete an attachment's bytes and every _attachment metadata record for
318
+ * it, family-wide. Throws StackConflictError if any record in the stack
319
+ * still references the file, StackNotFoundError if neither metadata
320
+ * records nor bytes exist.
321
+ */
322
+ deleteAttachment(fileId: FileId, opts?: ActorOptions): Promise<void>;
323
+ /**
324
+ * Sweep for attachment bytes unreachable from any record — live or
325
+ * soft-deleted — and delete bytes + metadata. Deletion goes through
326
+ * deleteAttachment(), so a file re-referenced by sweep time is skipped,
327
+ * not a failure. See docs/spec/attachments.md § Garbage collection.
328
+ */
329
+ collectAttachmentGarbage(opts?: CollectAttachmentGarbageOptions & ActorOptions): Promise<CollectAttachmentGarbageResult>;
330
+ /**
331
+ * Observe every change made through this Stack, unfiltered. Async so a
332
+ * remote stack resolves once its feed is live, making subscribe-then-query
333
+ * gap-free. See docs/spec/events.md § Subscribing.
334
+ */
335
+ subscribe(handler: (change: RecordChange) => void, opts?: SubscribeOptions): Promise<Unsubscribe>;
336
+ /**
337
+ * Ask the adapter to relay changes made elsewhere, if it can. One relay
338
+ * per subscription, carrying its filter to the far end, which holds the
339
+ * records that filter needs. See docs/spec/events.md § Where events come
340
+ * from.
341
+ */
342
+ private openRelay;
343
+ /** Whether changes reach this stack from elsewhere. */
344
+ private get relaysChanges();
345
+ /**
346
+ * Flush pending writes to the underlying storage. A no-op for adapters
347
+ * that commit on every call (SQLite, the API adapter); meaningful for
348
+ * ones that buffer, and for checkpointing a stack that stays open —
349
+ * close() covers the teardown case on its own.
350
+ */
351
+ flush(): Promise<void>;
352
+ /**
353
+ * Flush, then release any resources the adapter holds (connections, file
354
+ * handles, lock files). A failed flush still releases them before it
355
+ * propagates: an unwritable stack must not also leak a lock file.
356
+ * See docs/spec/adapters.md § Lifecycle.
357
+ */
358
+ close(): Promise<void>;
359
+ /** Throws once close() has run. */
360
+ private assertOpen;
361
+ /**
362
+ * Create a `_grant` authorizing `grantee` to take `actions` on `baseId`'s
363
+ * family. An app's `-own` is read as the bare verb when it acts for
364
+ * someone, so grant it the types it needs, not the narrowest-looking
365
+ * suffix. See docs/spec/access-control.md § Type-level grants.
366
+ */
367
+ grantType(baseId: BaseId, grant: TypeGrant): Promise<StackRecord & {
368
+ content: GrantContent;
369
+ }>;
370
+ /**
371
+ * List `_grant` records: all of them, or those `grantType()` would have
372
+ * written for the same grantee. The `entity` arm instead lists what
373
+ * currently applies to that entity, so it is not a preview of what
374
+ * `revokeType()` would withdraw. See docs/spec/access-control.md § Listing
375
+ * and revoking.
376
+ */
377
+ listTypeGrants(query?: GrantQuery): Promise<(StackRecord & {
378
+ content: GrantContent;
379
+ })[]>;
380
+ /**
381
+ * The inverse of grantType(): soft-deletes the matching `_grant` records,
382
+ * grantee and actions matched exactly, and returns them. Matching nothing
383
+ * is not an error, so re-running a revocation stays safe.
384
+ * See docs/spec/access-control.md § Listing and revoking.
385
+ */
386
+ revokeType(baseId: BaseId, grant: TypeGrant): Promise<(StackRecord & {
387
+ content: GrantContent;
388
+ })[]>;
389
+ /**
390
+ * What applying `manifest` for the key `did` would change, for the owner
391
+ * to review before installApp(). Writes nothing. Refuses outright what no
392
+ * approval could make valid: a type outside the app's own namespace and
393
+ * the commons, a request the grant rules refuse, or a `did` already
394
+ * registered to a different app. See docs/spec/apps.md § Plan, then apply.
395
+ */
396
+ planInstall(submitted: AppManifest, opts: {
397
+ did: EntityId;
398
+ }): Promise<InstallPlan>;
399
+ /**
400
+ * Apply an approved plan: types, the key's `_app` card, the `_install`
401
+ * Record and every linked key's grants. A plan the stack has moved on
402
+ * from is a StackConflictError, so what lands is what was approved.
403
+ * See docs/spec/apps.md § Plan, then apply.
404
+ */
405
+ installApp(plan: InstallPlan): Promise<StackRecord & {
406
+ content: InstallContent;
407
+ }>;
408
+ /**
409
+ * Withdraw every grant an install produced and soft-delete it. The app's
410
+ * records and `_app` cards stay: the data is the owner's, and the cards
411
+ * are what its records' attribution resolves through. Returns the
412
+ * install's tombstone. See docs/spec/apps.md § Uninstalling.
413
+ */
414
+ uninstallApp(appId: AppId): Promise<StackRecord & {
415
+ content: InstallContent;
416
+ }>;
417
+ /**
418
+ * Fast-fail for the ifVersion precondition using the already-fetched
419
+ * record. The adapter re-checks atomically at write time (the source of
420
+ * truth for concurrent writers) — this just skips validation and
421
+ * snapshotting work when the mismatch is already visible.
422
+ */
423
+ private checkIfVersion;
424
+ /**
425
+ * The options every version-bumping adapter write carries — precondition,
426
+ * prior-state snapshot and actor — taken together so a new verb cannot
427
+ * omit one. See docs/spec/versioning.md § Version history.
428
+ */
429
+ private writeOptions;
430
+ /**
431
+ * A record's prior state for the version it is about to leave: `content`
432
+ * and the `typeId` it is read under, which only a snapshot keeps. The
433
+ * journal keeps everything else. See docs/spec/versioning.md § Version
434
+ * history.
435
+ */
436
+ private buildVersionSnapshot;
437
+ }
438
+ //# sourceMappingURL=stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../src/stack/stack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA4BH,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,MAAM,EACN,MAAM,EACN,YAAY,EACZ,UAAU,EAEV,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,oBAAoB,EACpB,iBAAiB,EACjB,MAAM,EAEN,QAAQ,EAER,KAAK,EACL,cAAc,EACd,QAAQ,EACR,KAAK,EACL,YAAY,EAEZ,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAqC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAgB9D,OAAO,EAAE,WAAW,EAAc,MAAM,iCAAiC,CA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