@withmarfa/core 0.0.2 → 0.0.4

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/index.d.ts CHANGED
@@ -21,26 +21,62 @@ export declare class MarfaCore {
21
21
  /**
22
22
  * Holds the event stream open on a thread of its own and applies each
23
23
  * event as it arrives: `onChange` for each change, then `onEnd` once,
24
- * with the error that ended it or null where it was stopped. Neither
25
- * callback keeps the process alive. An `onChange` that throws ends the
26
- * follow, and `onEnd` is told what it threw, as `listener_threw: …`.
24
+ * with the error that ended it, the same error as any call throws, or
25
+ * null where it was stopped. Neither callback keeps the process alive. An
26
+ * `onChange` that throws ends the follow, and `onEnd` is given an error
27
+ * whose `code` is `listener_threw` and whose message says what it threw.
27
28
  */
28
- follow(onChange: (arg: Change) => void, onEnd: (arg: string | undefined | null) => void): Subscription
29
+ follow(onChange: (change: Change) => void, onEnd: (error: (Error & { code: string }) | null) => void): Subscription
29
30
  /**
30
31
  * Opens the file at `path`, creating it when absent. `url` and `key` go
31
32
  * together; without them only local reads work.
32
33
  */
33
34
  static open(path: string, url?: string | undefined | null, key?: string | undefined | null): MarfaCore
34
35
  /** Replaces the local copy with the declared types at `tier`. */
35
- hydrate(types: Array<string>, tier: Tier): Promise<HydrateReport>
36
+ hydrate(types: Array<string>, tier: Tier, stop?: Stop | undefined | null): Promise<HydrateReport>
37
+ /**
38
+ * A hydration that also holds every edge of `edgeTypes` the key reads,
39
+ * whichever ends the copy holds.
40
+ */
41
+ hydrateWith(types: Array<string>, tier: Tier, edgeTypes: Array<string>, stop?: Stop | undefined | null): Promise<HydrateReport>
42
+ /** Holds one row by id whatever the slice says of it, read now. */
43
+ pin(id: string): Promise<PinReport>
44
+ /**
45
+ * Stops holding a row by id; one the slice does not take goes, unless
46
+ * writes to it still wait.
47
+ */
48
+ unpin(id: string): PinReport
36
49
  /** Applies every event since the stored cursor. */
37
- catchUp(): Promise<CatchUpReport>
50
+ catchUp(stop?: Stop | undefined | null): Promise<CatchUpReport>
38
51
  list(filters?: ListFilters | undefined | null, sort?: Sort | undefined | null): Array<Item>
39
52
  get(id: string): Item | null
40
53
  edgesFrom(id: string): Array<Edge>
41
54
  edgesTo(id: string): Array<Edge>
55
+ edgesOfType(edgeType: string): Array<Edge>
42
56
  search(query: string, filters?: SearchFilters | undefined | null, limit?: number | undefined | null): Array<SearchHit>
43
57
  status(): Status
58
+ /**
59
+ * Declares the types this app saves, each an object with its `id`, its
60
+ * `fields` and whatever else a type carries. A copy that has never
61
+ * reached a server checks what it queues against them and the types
62
+ * Marfa ships, and a hydration registers the ones the instance
63
+ * lacks, where the key may. The call is the app's whole set and replaces every earlier declaration.
64
+ */
65
+ declareTypes(types: Record<string, unknown>[]): void
66
+ /**
67
+ * The declarations this copy holds, by id, with the empty `fields` and
68
+ * the `version` a registration needs filled in where the app left them
69
+ * out.
70
+ */
71
+ declaredTypes(): Record<string, unknown>[]
72
+ /** Every item type the copy holds, by id, read from the copy alone. */
73
+ itemTypes(): Array<ItemType>
74
+ /** `not_found` where the catalog holds no such type. */
75
+ itemType(id: string): ItemType
76
+ /** Every edge type the copy holds, by id, read from the copy alone. */
77
+ edgeTypes(): Array<EdgeType>
78
+ /** `not_found` where the catalog holds no such edge type. */
79
+ edgeType(id: string): EdgeType
44
80
  /**
45
81
  * Which handle this process holds: the one that may write, or a second
46
82
  * opener that reads and refuses every write.
@@ -79,7 +115,7 @@ export declare class MarfaCore {
79
115
  /** Every queued write and what became of it. */
80
116
  queue(): Array<QueuedWrite>
81
117
  /** Sends what the queue holds and records what came back. One pass. */
82
- drain(): Promise<DrainReport>
118
+ drain(stop?: Stop | undefined | null): Promise<DrainReport>
83
119
  /**
84
120
  * Holds a file's bytes beside the working copy and queues their upload.
85
121
  * Off the JavaScript thread, because the whole file is copied and
@@ -114,8 +150,36 @@ export declare class MarfaCore {
114
150
  release(id: string): boolean
115
151
  /** Releases every write blocked for one reason, and says how many. */
116
152
  releaseReason(reason: BlockedReason): number
117
- /** Clears the writes the server has answered, and says how many went. */
153
+ /**
154
+ * Takes a write blocked `ancestor_unavailable` or `conflict_unresolved`
155
+ * out of the queue, and puts the copy back to what the server holds;
156
+ * each write held for it is refused unsent. Answers whether the row was
157
+ * one a withdraw takes.
158
+ */
159
+ withdraw(id: string): boolean
160
+ /**
161
+ * Clears the writes the server has answered, and says how many went. A
162
+ * refused write that carried content stays until it is discarded.
163
+ */
118
164
  forgetAnswered(): number
165
+ /**
166
+ * Takes a refused write out of the queue, with the content it carried.
167
+ * Answers whether the row was one a discard takes: refused, and with no
168
+ * write still waiting on it.
169
+ */
170
+ discard(id: string): boolean
171
+ }
172
+
173
+ /**
174
+ * Raised to end a `hydrate`, `catchUp` or `drain` it was given to, soon
175
+ * after, with an error coded `canceled`. What the call had taken is
176
+ * consistent: a hydration left unfinished refuses reads, a catch-up keeps
177
+ * the cursor it reached, and a drain leaves what it had not sent queued. A
178
+ * raised `Stop` stays raised, so a call given one afterwards ends at once.
179
+ */
180
+ export declare class Stop {
181
+ constructor()
182
+ raise(): void
119
183
  }
120
184
 
121
185
  /**
@@ -161,14 +225,20 @@ export interface CatchUpReport {
161
225
  }
162
226
 
163
227
  /**
164
- * One event a held stream applied: what it was, what it was about, and the
165
- * cursor it left.
228
+ * What a held stream changed in the copy: an event it applied, named by the
229
+ * event's type with the item or edge it was about, or `catalog.changed`,
230
+ * naming neither, where a stream it opened read a catalog that differs from
231
+ * the one held. Or what became of the server: `server.unreachable`, with
232
+ * `reason`, once when a stream cannot be had, and `server.reachable` once
233
+ * when one is had again, which is when to drain what waited. `cursor` is
234
+ * the cursor held after it.
166
235
  */
167
236
  export interface Change {
168
237
  event: string
169
238
  itemId?: string
170
239
  edgeId?: string
171
240
  cursor: string
241
+ reason?: string
172
242
  }
173
243
 
174
244
  /** A create, before it is queued. */
@@ -191,10 +261,36 @@ export interface Draft {
191
261
 
192
262
  /** What a drain did. */
193
263
  export interface DrainReport {
194
- sent: number
264
+ /** Writes the server answered this drain, whatever it answered. */
265
+ answered: number
195
266
  held: number
267
+ /**
268
+ * Writes it could not deliver, each still waiting, uncounted, for the
269
+ * next drain.
270
+ */
271
+ undelivered: number
272
+ /**
273
+ * Writes it gave a verdict without sending them: refused for a write
274
+ * they waited on or for bytes no longer held, or settled by another
275
+ * write's answer.
276
+ */
277
+ unsent: number
278
+ /**
279
+ * Writes whose request could not be made: each is counted against its
280
+ * write and waits for the next drain, or is dead at the ceiling. The
281
+ * writes a refused credential parks are counted in `stopped`.
282
+ */
283
+ unmade: number
284
+ /**
285
+ * Why the drain ended before the queue was through: the server could
286
+ * not be reached, failed, or asked to be left alone for a while.
287
+ */
288
+ unavailable?: string
196
289
  verdicts: Array<DrainVerdict>
197
- /** Why the drain stopped before the queue was empty, where it did. */
290
+ /**
291
+ * Why the drain stopped: the server refused the credential, and every
292
+ * write waits until it is replaced.
293
+ */
198
294
  stopped?: string
199
295
  /**
200
296
  * The sources the server said this credential's key does not claim,
@@ -205,11 +301,13 @@ export interface DrainReport {
205
301
  retryAfterSeconds?: number
206
302
  }
207
303
 
208
- /** What became of one write a drain sent. */
304
+ /** What became of one write a drain answered, sent or not. */
209
305
  export interface DrainVerdict {
210
306
  id: string
211
307
  kind: WriteKind
308
+ /** An edge write's source; otherwise the row written to. */
212
309
  itemId?: string
310
+ edgeId?: string
213
311
  verdict?: Verdict
214
312
  refusals: number
215
313
  /**
@@ -245,6 +343,28 @@ export interface EdgeEdit {
245
343
  baseVersion?: number
246
344
  }
247
345
 
346
+ /** The end of an edge whose file writes it. */
347
+ export declare const enum EdgeEnd {
348
+ Source = 'source',
349
+ Target = 'target',
350
+ }
351
+
352
+ /** An edge type as the copy holds it. */
353
+ export interface EdgeType {
354
+ id: string
355
+ label?: string
356
+ description?: string
357
+ cardinality: string
358
+ /** The name the edge goes by read from its target. */
359
+ reverseName?: string
360
+ writtenAt: EdgeEnd
361
+ sourceTypeConstraints: Array<string>
362
+ targetTypeConstraints: Array<string>
363
+ cascadeOnDelete: string
364
+ properties: Array<TypeField>
365
+ shipped: boolean
366
+ }
367
+
248
368
  /** A change to an item, and the version it was read at. */
249
369
  export interface Edit {
250
370
  /** Whole field values; a device never merges inside a field. */
@@ -255,6 +375,23 @@ export interface Edit {
255
375
  sourceId?: string
256
376
  }
257
377
 
378
+ export interface FieldRefusal {
379
+ field: string
380
+ message: string
381
+ }
382
+
383
+ /** What a missing grant is on. */
384
+ export declare const enum GrantKind {
385
+ Type = 'type',
386
+ EdgeType = 'edge_type',
387
+ Extension = 'extension',
388
+ }
389
+
390
+ export declare const enum GrantLevel {
391
+ Read = 'read',
392
+ Write = 'write',
393
+ }
394
+
258
395
  /** Which handle this process holds on the store. */
259
396
  export declare const enum Handle {
260
397
  Writer = 'writer',
@@ -264,10 +401,15 @@ export declare const enum Handle {
264
401
  export interface HydrateReport {
265
402
  types: Array<string>
266
403
  tier: Tier
404
+ edgeTypes: Array<string>
267
405
  items: number
268
406
  edges: number
269
407
  pages: number
270
408
  cursor: string
409
+ /** Types the app declared that the instance did not hold and now does. */
410
+ registeredTypes: Array<string>
411
+ /** Declared types the instance did not hold and would not take. */
412
+ unregisteredTypes: Array<UnregisteredType>
271
413
  }
272
414
 
273
415
  export declare const enum Hydration {
@@ -300,6 +442,21 @@ export declare const enum ItemState {
300
442
  Revoked = 'revoked',
301
443
  }
302
444
 
445
+ /** An item type as the copy holds it, with the fields it inherits. */
446
+ export interface ItemType {
447
+ id: string
448
+ label?: string
449
+ description?: string
450
+ parent?: string
451
+ version: number
452
+ fields: Array<TypeField>
453
+ titleField?: string
454
+ bodyField?: string
455
+ linkField?: string
456
+ roles: Array<string>
457
+ compatibleWith: Array<string>
458
+ }
459
+
303
460
  /**
304
461
  * Narrowing for a list. Leaving `state` unset answers the active state, as
305
462
  * the server does; `allStates` lifts that, and a named state wins.
@@ -312,10 +469,36 @@ export interface ListFilters {
312
469
  tags?: Array<string>
313
470
  occurredAfter?: string
314
471
  occurredBefore?: string
472
+ /**
473
+ * An expression in the server's listing grammar, answered as the server
474
+ * answers `filter` and refused `validation_error` where it refuses it.
475
+ * A `backref` condition is refused `invalid`.
476
+ */
477
+ filter?: string
478
+ /**
479
+ * An item id: that item and every item it reaches along `parent-of`
480
+ * edges, as far as the copy holds them.
481
+ */
482
+ beneath?: string
315
483
  limit?: number
316
484
  offset?: number
317
485
  }
318
486
 
487
+ export interface MissingGrant {
488
+ kind: GrantKind
489
+ /** The type or edge type id, or the extension namespace. */
490
+ name: string
491
+ level: GrantLevel
492
+ }
493
+
494
+ /** What a pin or an unpin answers. */
495
+ export interface PinReport {
496
+ /** Whether the row is pinned now. */
497
+ pinned: boolean
498
+ /** Whether it was pinned before the call. */
499
+ wasPinned: boolean
500
+ }
501
+
319
502
  /** One queued write and what became of it. */
320
503
  export interface QueuedWrite {
321
504
  id: string
@@ -336,7 +519,18 @@ export interface QueuedWrite {
336
519
  * out after and is not refused with.
337
520
  */
338
521
  follows?: string
522
+ /** Absent while the server has not answered it. */
339
523
  verdict?: Verdict
524
+ /**
525
+ * Held behind a write that has no answer yet: `depends_on` and
526
+ * `follows` say which.
527
+ */
528
+ waiting: boolean
529
+ /**
530
+ * The body the write sends, or sent: a refused write's content stays
531
+ * readable here until it is discarded.
532
+ */
533
+ body: Record<string, unknown>
340
534
  /** The server's answer, whole, as it arrived. */
341
535
  answer?: string
342
536
  refusals: number
@@ -344,21 +538,52 @@ export interface QueuedWrite {
344
538
  answeredAt?: string
345
539
  }
346
540
 
541
+ /** Why the server, or the drain for a write it never sent, refused a write. */
542
+ export interface Refusal {
543
+ /**
544
+ * The server's code verbatim, or the sentence naming the write this one
545
+ * waited on where that write was refused.
546
+ */
547
+ reason: string
548
+ /** The code in the server's envelope, where the server refused it. */
549
+ code?: string
550
+ message?: string
551
+ /** Each property the server would not take, and why. */
552
+ fields: Array<FieldRefusal>
553
+ /** The row the write named is in the bin, and can be restored. */
554
+ trashed: boolean
555
+ /** The permission the credential's key lacks, where the refusal names one. */
556
+ grant?: MissingGrant
557
+ }
558
+
347
559
  /**
348
560
  * Narrowing for a search: the state rule a list takes, a type with its
349
- * subtree, and tags, each read as the list reads it.
561
+ * subtree, tags, a listing-grammar expression and `beneath`, each read as
562
+ * the list reads it.
350
563
  */
351
564
  export interface SearchFilters {
352
565
  state?: ItemState
353
566
  allStates?: boolean
354
567
  type?: string
355
568
  tags?: Array<string>
569
+ /**
570
+ * An expression in the server's listing grammar, answered as the server
571
+ * answers `filter` and refused `validation_error` where it refuses it.
572
+ * A `backref` condition is refused `invalid`.
573
+ */
574
+ filter?: string
575
+ /**
576
+ * An item id: that item and every item it reaches along `parent-of`
577
+ * edges, as far as the copy holds them.
578
+ */
579
+ beneath?: string
356
580
  }
357
581
 
358
582
  export interface SearchHit {
359
583
  item: Item
360
584
  /** Higher is a better match. */
361
585
  score: number
586
+ /** An excerpt as HTML: the text escaped and each match in `<mark>` tags. */
362
587
  snippet: string
363
588
  }
364
589
 
@@ -380,12 +605,21 @@ export declare const enum SortField {
380
605
 
381
606
  export interface Status {
382
607
  serverOrigin?: string
608
+ /** The instance the copy was hydrated from. */
609
+ instanceId?: string
383
610
  sliceTypes: Array<string>
384
611
  sliceTier?: Tier
612
+ sliceEdgeTypes: Array<string>
613
+ pinned: Array<string>
385
614
  eventCursor?: string
386
615
  hydration: Hydration
387
616
  items: number
388
617
  edges: number
618
+ /**
619
+ * Moves each time a refresh changes the catalog; absent where the copy
620
+ * has never held one.
621
+ */
622
+ catalogVersion?: number
389
623
  }
390
624
 
391
625
  /** An item's thumbnail: the image's type and its bytes. */
@@ -399,6 +633,30 @@ export declare const enum Tier {
399
633
  Feed = 'feed',
400
634
  }
401
635
 
636
+ /** A field of an item type, or a property of an edge type. */
637
+ export interface TypeField {
638
+ name: string
639
+ /** The field's own type, such as `string` or `thumbnail`. */
640
+ type: string
641
+ required: boolean
642
+ description?: string
643
+ /**
644
+ * The type that declares it: the type itself, or the nearest one it
645
+ * inherits the field from.
646
+ */
647
+ declaredBy: string
648
+ /** The definition whole, as the server answers it. */
649
+ definition: Record<string, unknown>
650
+ }
651
+
652
+ /** A declared type the instance refused to register, and why. */
653
+ export interface UnregisteredType {
654
+ id: string
655
+ /** The server's code for the refusal. */
656
+ code: string
657
+ message: string
658
+ }
659
+
402
660
  /**
403
661
  * What the server made of a write: one of six, and absent while the write
404
662
  * is unanswered.
@@ -407,8 +665,8 @@ export type Verdict =
407
665
  | { verdict: 'accepted' }
408
666
  | { verdict: 'merged'; fields: Array<string> }
409
667
  | { verdict: 'conflicted'; siblingId: string; fields: Array<string> }
410
- | { verdict: 'refused'; reason: string }
411
- | { verdict: 'blocked'; reason: BlockedReason }
668
+ | { verdict: 'refused'; refusal: Refusal }
669
+ | { verdict: 'blocked'; reason: BlockedReason; refusal?: Refusal }
412
670
  | { verdict: 'dead' }
413
671
 
414
672
  /** The kinds of write a queue holds. */
package/index.js CHANGED
@@ -89,8 +89,8 @@ function requireNative() {
89
89
  try {
90
90
  const binding = require('@withmarfa/core-android-arm64')
91
91
  const bindingPackageVersion = require('@withmarfa/core-android-arm64/package.json').version
92
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
93
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
92
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
93
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
94
94
  }
95
95
  return binding
96
96
  } catch (e) {
@@ -105,8 +105,8 @@ function requireNative() {
105
105
  try {
106
106
  const binding = require('@withmarfa/core-android-arm-eabi')
107
107
  const bindingPackageVersion = require('@withmarfa/core-android-arm-eabi/package.json').version
108
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
109
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
108
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
109
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
110
110
  }
111
111
  return binding
112
112
  } catch (e) {
@@ -126,8 +126,8 @@ function requireNative() {
126
126
  try {
127
127
  const binding = require('@withmarfa/core-win32-x64-gnu')
128
128
  const bindingPackageVersion = require('@withmarfa/core-win32-x64-gnu/package.json').version
129
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
130
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
129
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
130
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
131
131
  }
132
132
  return binding
133
133
  } catch (e) {
@@ -142,8 +142,8 @@ function requireNative() {
142
142
  try {
143
143
  const binding = require('@withmarfa/core-win32-x64-msvc')
144
144
  const bindingPackageVersion = require('@withmarfa/core-win32-x64-msvc/package.json').version
145
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
146
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
145
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
146
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
147
147
  }
148
148
  return binding
149
149
  } catch (e) {
@@ -159,8 +159,8 @@ function requireNative() {
159
159
  try {
160
160
  const binding = require('@withmarfa/core-win32-ia32-msvc')
161
161
  const bindingPackageVersion = require('@withmarfa/core-win32-ia32-msvc/package.json').version
162
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
162
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
164
164
  }
165
165
  return binding
166
166
  } catch (e) {
@@ -175,8 +175,8 @@ function requireNative() {
175
175
  try {
176
176
  const binding = require('@withmarfa/core-win32-arm64-msvc')
177
177
  const bindingPackageVersion = require('@withmarfa/core-win32-arm64-msvc/package.json').version
178
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
179
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
178
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
179
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
180
180
  }
181
181
  return binding
182
182
  } catch (e) {
@@ -194,8 +194,8 @@ function requireNative() {
194
194
  try {
195
195
  const binding = require('@withmarfa/core-darwin-universal')
196
196
  const bindingPackageVersion = require('@withmarfa/core-darwin-universal/package.json').version
197
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
198
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
197
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
198
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
199
199
  }
200
200
  return binding
201
201
  } catch (e) {
@@ -210,8 +210,8 @@ function requireNative() {
210
210
  try {
211
211
  const binding = require('@withmarfa/core-darwin-x64')
212
212
  const bindingPackageVersion = require('@withmarfa/core-darwin-x64/package.json').version
213
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
214
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
213
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
214
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
215
215
  }
216
216
  return binding
217
217
  } catch (e) {
@@ -226,8 +226,8 @@ function requireNative() {
226
226
  try {
227
227
  const binding = require('@withmarfa/core-darwin-arm64')
228
228
  const bindingPackageVersion = require('@withmarfa/core-darwin-arm64/package.json').version
229
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
230
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
229
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
230
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
231
231
  }
232
232
  return binding
233
233
  } catch (e) {
@@ -246,8 +246,8 @@ function requireNative() {
246
246
  try {
247
247
  const binding = require('@withmarfa/core-freebsd-x64')
248
248
  const bindingPackageVersion = require('@withmarfa/core-freebsd-x64/package.json').version
249
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
250
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
249
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
250
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
251
251
  }
252
252
  return binding
253
253
  } catch (e) {
@@ -262,8 +262,8 @@ function requireNative() {
262
262
  try {
263
263
  const binding = require('@withmarfa/core-freebsd-arm64')
264
264
  const bindingPackageVersion = require('@withmarfa/core-freebsd-arm64/package.json').version
265
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
265
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
267
267
  }
268
268
  return binding
269
269
  } catch (e) {
@@ -283,8 +283,8 @@ function requireNative() {
283
283
  try {
284
284
  const binding = require('@withmarfa/core-linux-x64-musl')
285
285
  const bindingPackageVersion = require('@withmarfa/core-linux-x64-musl/package.json').version
286
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
286
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
288
288
  }
289
289
  return binding
290
290
  } catch (e) {
@@ -299,8 +299,8 @@ function requireNative() {
299
299
  try {
300
300
  const binding = require('@withmarfa/core-linux-x64-gnu')
301
301
  const bindingPackageVersion = require('@withmarfa/core-linux-x64-gnu/package.json').version
302
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
303
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
302
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
303
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
304
304
  }
305
305
  return binding
306
306
  } catch (e) {
@@ -317,8 +317,8 @@ function requireNative() {
317
317
  try {
318
318
  const binding = require('@withmarfa/core-linux-arm64-musl')
319
319
  const bindingPackageVersion = require('@withmarfa/core-linux-arm64-musl/package.json').version
320
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
321
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
320
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
321
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
322
322
  }
323
323
  return binding
324
324
  } catch (e) {
@@ -333,8 +333,8 @@ function requireNative() {
333
333
  try {
334
334
  const binding = require('@withmarfa/core-linux-arm64-gnu')
335
335
  const bindingPackageVersion = require('@withmarfa/core-linux-arm64-gnu/package.json').version
336
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
337
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
336
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
337
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
338
338
  }
339
339
  return binding
340
340
  } catch (e) {
@@ -351,8 +351,8 @@ function requireNative() {
351
351
  try {
352
352
  const binding = require('@withmarfa/core-linux-arm-musleabihf')
353
353
  const bindingPackageVersion = require('@withmarfa/core-linux-arm-musleabihf/package.json').version
354
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
355
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
354
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
355
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
356
356
  }
357
357
  return binding
358
358
  } catch (e) {
@@ -367,8 +367,8 @@ function requireNative() {
367
367
  try {
368
368
  const binding = require('@withmarfa/core-linux-arm-gnueabihf')
369
369
  const bindingPackageVersion = require('@withmarfa/core-linux-arm-gnueabihf/package.json').version
370
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
371
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
370
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
371
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
372
372
  }
373
373
  return binding
374
374
  } catch (e) {
@@ -385,8 +385,8 @@ function requireNative() {
385
385
  try {
386
386
  const binding = require('@withmarfa/core-linux-loong64-musl')
387
387
  const bindingPackageVersion = require('@withmarfa/core-linux-loong64-musl/package.json').version
388
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
389
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
388
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
389
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
390
390
  }
391
391
  return binding
392
392
  } catch (e) {
@@ -401,8 +401,8 @@ function requireNative() {
401
401
  try {
402
402
  const binding = require('@withmarfa/core-linux-loong64-gnu')
403
403
  const bindingPackageVersion = require('@withmarfa/core-linux-loong64-gnu/package.json').version
404
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
405
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
404
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
405
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
406
406
  }
407
407
  return binding
408
408
  } catch (e) {
@@ -419,8 +419,8 @@ function requireNative() {
419
419
  try {
420
420
  const binding = require('@withmarfa/core-linux-riscv64-musl')
421
421
  const bindingPackageVersion = require('@withmarfa/core-linux-riscv64-musl/package.json').version
422
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
423
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
422
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
423
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
424
424
  }
425
425
  return binding
426
426
  } catch (e) {
@@ -435,8 +435,8 @@ function requireNative() {
435
435
  try {
436
436
  const binding = require('@withmarfa/core-linux-riscv64-gnu')
437
437
  const bindingPackageVersion = require('@withmarfa/core-linux-riscv64-gnu/package.json').version
438
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
439
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
438
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
439
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
440
440
  }
441
441
  return binding
442
442
  } catch (e) {
@@ -452,8 +452,8 @@ function requireNative() {
452
452
  try {
453
453
  const binding = require('@withmarfa/core-linux-ppc64-gnu')
454
454
  const bindingPackageVersion = require('@withmarfa/core-linux-ppc64-gnu/package.json').version
455
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
456
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
455
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
456
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
457
457
  }
458
458
  return binding
459
459
  } catch (e) {
@@ -468,8 +468,8 @@ function requireNative() {
468
468
  try {
469
469
  const binding = require('@withmarfa/core-linux-s390x-gnu')
470
470
  const bindingPackageVersion = require('@withmarfa/core-linux-s390x-gnu/package.json').version
471
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
472
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
471
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
472
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
473
473
  }
474
474
  return binding
475
475
  } catch (e) {
@@ -488,8 +488,8 @@ function requireNative() {
488
488
  try {
489
489
  const binding = require('@withmarfa/core-openharmony-arm64')
490
490
  const bindingPackageVersion = require('@withmarfa/core-openharmony-arm64/package.json').version
491
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
492
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
491
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
492
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
493
493
  }
494
494
  return binding
495
495
  } catch (e) {
@@ -504,8 +504,8 @@ function requireNative() {
504
504
  try {
505
505
  const binding = require('@withmarfa/core-openharmony-x64')
506
506
  const bindingPackageVersion = require('@withmarfa/core-openharmony-x64/package.json').version
507
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
508
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
507
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
508
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
509
509
  }
510
510
  return binding
511
511
  } catch (e) {
@@ -520,8 +520,8 @@ function requireNative() {
520
520
  try {
521
521
  const binding = require('@withmarfa/core-openharmony-arm')
522
522
  const bindingPackageVersion = require('@withmarfa/core-openharmony-arm/package.json').version
523
- if (bindingPackageVersion !== '0.0.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
524
- throw new Error(`Native binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
523
+ if (bindingPackageVersion !== '0.0.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
524
+ throw new Error(`Native binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
525
525
  }
526
526
  return binding
527
527
  } catch (e) {
@@ -661,8 +661,8 @@ if (!nativeBinding || forceWasi) {
661
661
  if (!candidateFailed) {
662
662
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
663
663
  const bindingPackageVersion = require('@withmarfa/core-wasm32-wasi/package.json').version
664
- if (bindingPackageVersion !== '0.0.2') {
665
- throw new Error(`WASI binding package version mismatch, expected 0.0.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
664
+ if (bindingPackageVersion !== '0.0.4') {
665
+ throw new Error(`WASI binding package version mismatch, expected 0.0.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
666
666
  }
667
667
  }
668
668
  wasiBinding = require('@withmarfa/core-wasm32-wasi')
@@ -779,8 +779,12 @@ function __napiStampBindingTarget(exportsObject, target) {
779
779
  module.exports.__napiBindingTarget = __napiStampBindingTarget(nativeBinding, __napiLoadedBindingTarget)
780
780
  module.exports = nativeBinding
781
781
  module.exports.MarfaCore = nativeBinding.MarfaCore
782
+ module.exports.Stop = nativeBinding.Stop
782
783
  module.exports.Subscription = nativeBinding.Subscription
783
784
  module.exports.BlockedReason = nativeBinding.BlockedReason
785
+ module.exports.EdgeEnd = nativeBinding.EdgeEnd
786
+ module.exports.GrantKind = nativeBinding.GrantKind
787
+ module.exports.GrantLevel = nativeBinding.GrantLevel
784
788
  module.exports.Handle = nativeBinding.Handle
785
789
  module.exports.Hydration = nativeBinding.Hydration
786
790
  module.exports.ItemState = nativeBinding.ItemState
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withmarfa/core",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "marfa-core as a Node module.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "devDependencies": {
20
20
  "@napi-rs/cli": "^3",
21
- "@types/node": "^22.20.4",
22
- "typescript": "^5.9.3"
21
+ "@types/node": "^26.6.4",
22
+ "typescript": "^7.0.2"
23
23
  },
24
24
  "files": [
25
25
  "index.js",
@@ -32,7 +32,6 @@
32
32
  "scripts": {
33
33
  "build": "napi build --platform --release",
34
34
  "build:debug": "napi build --platform",
35
- "proof": "node scripts/proof.mjs",
36
35
  "check": "tsc -p tsconfig.json",
37
36
  "test": "node --expose-gc --test test/*.test.mjs"
38
37
  }