@effected/templates 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ManagedSection.js +16 -13
- package/index.d.ts +25 -170
- package/package.json +1 -1
- package/tsdoc-metadata.json +1 -1
package/ManagedSection.js
CHANGED
|
@@ -126,9 +126,11 @@ const make = (options = {}) => Effect.gen(function* () {
|
|
|
126
126
|
})
|
|
127
127
|
};
|
|
128
128
|
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
/**
|
|
130
|
+
* An unstubbed `makeTest` member: dies when its effect runs, never when it is
|
|
131
|
+
* called, so building the effect outside a generator cannot throw.
|
|
132
|
+
*/
|
|
133
|
+
const unstubbed = (member) => () => Effect.die(/* @__PURE__ */ new Error(`ManagedSection.makeTest: ${member}() was called but not stubbed — pass a \`${member}\` override.`));
|
|
132
134
|
/**
|
|
133
135
|
* Managed sections in files: read, compare, sync and remove delimited blocks
|
|
134
136
|
* whose surrounding content belongs to the user.
|
|
@@ -181,18 +183,19 @@ var ManagedSection = class ManagedSection extends Context.Service()("@effected/t
|
|
|
181
183
|
*/
|
|
182
184
|
static layerWith = (options) => Layer.effect(ManagedSection, make(options));
|
|
183
185
|
/**
|
|
184
|
-
* A test double. Members a suite does not stub **die when
|
|
185
|
-
* than returning a plausible-looking
|
|
186
|
+
* A test double. Members a suite does not stub **die when run** (calling
|
|
187
|
+
* one only builds the effect), rather than returning a plausible-looking
|
|
188
|
+
* answer that makes a wrong test pass.
|
|
186
189
|
*/
|
|
187
190
|
static makeTest = (overrides = {}) => ({
|
|
188
|
-
read: (
|
|
189
|
-
readAll: (
|
|
190
|
-
isManaged: (
|
|
191
|
-
sync: (
|
|
192
|
-
syncAll: (
|
|
193
|
-
check: (
|
|
194
|
-
checkAll: (
|
|
195
|
-
remove: (
|
|
191
|
+
read: unstubbed("read"),
|
|
192
|
+
readAll: unstubbed("readAll"),
|
|
193
|
+
isManaged: unstubbed("isManaged"),
|
|
194
|
+
sync: unstubbed("sync"),
|
|
195
|
+
syncAll: unstubbed("syncAll"),
|
|
196
|
+
check: unstubbed("check"),
|
|
197
|
+
checkAll: unstubbed("checkAll"),
|
|
198
|
+
remove: unstubbed("remove"),
|
|
196
199
|
...overrides
|
|
197
200
|
});
|
|
198
201
|
/**
|
package/index.d.ts
CHANGED
|
@@ -337,90 +337,17 @@ export type SyncOutcome = Data.TaggedEnum<{
|
|
|
337
337
|
*
|
|
338
338
|
* @public
|
|
339
339
|
*/
|
|
340
|
-
export declare const SyncOutcome: {
|
|
341
|
-
readonly
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}> | Extract<{
|
|
352
|
-
readonly _tag: "Updated";
|
|
353
|
-
readonly before: Section;
|
|
354
|
-
readonly after: Section;
|
|
355
|
-
}, {
|
|
356
|
-
readonly _tag: Tag;
|
|
357
|
-
}>;
|
|
358
|
-
readonly $match: {
|
|
359
|
-
<Cases extends {
|
|
360
|
-
readonly Created: (args: {
|
|
361
|
-
readonly _tag: "Created";
|
|
362
|
-
readonly section: Section;
|
|
363
|
-
}) => any;
|
|
364
|
-
readonly Unchanged: (args: {
|
|
365
|
-
readonly _tag: "Unchanged";
|
|
366
|
-
readonly section: Section;
|
|
367
|
-
}) => any;
|
|
368
|
-
readonly Updated: (args: {
|
|
369
|
-
readonly _tag: "Updated";
|
|
370
|
-
readonly before: Section;
|
|
371
|
-
readonly after: Section;
|
|
372
|
-
}) => any;
|
|
373
|
-
}>(cases: Cases): (value: {
|
|
374
|
-
readonly _tag: "Created";
|
|
375
|
-
readonly section: Section;
|
|
376
|
-
} | {
|
|
377
|
-
readonly _tag: "Unchanged";
|
|
378
|
-
readonly section: Section;
|
|
379
|
-
} | {
|
|
380
|
-
readonly _tag: "Updated";
|
|
381
|
-
readonly before: Section;
|
|
382
|
-
readonly after: Section;
|
|
383
|
-
}) => import("effect/Unify").Unify<ReturnType<Cases["Created" | "Unchanged" | "Updated"]>>;
|
|
384
|
-
<Cases extends {
|
|
385
|
-
readonly Created: (args: {
|
|
386
|
-
readonly _tag: "Created";
|
|
387
|
-
readonly section: Section;
|
|
388
|
-
}) => any;
|
|
389
|
-
readonly Unchanged: (args: {
|
|
390
|
-
readonly _tag: "Unchanged";
|
|
391
|
-
readonly section: Section;
|
|
392
|
-
}) => any;
|
|
393
|
-
readonly Updated: (args: {
|
|
394
|
-
readonly _tag: "Updated";
|
|
395
|
-
readonly before: Section;
|
|
396
|
-
readonly after: Section;
|
|
397
|
-
}) => any;
|
|
398
|
-
}>(value: {
|
|
399
|
-
readonly _tag: "Created";
|
|
400
|
-
readonly section: Section;
|
|
401
|
-
} | {
|
|
402
|
-
readonly _tag: "Unchanged";
|
|
403
|
-
readonly section: Section;
|
|
404
|
-
} | {
|
|
405
|
-
readonly _tag: "Updated";
|
|
406
|
-
readonly before: Section;
|
|
407
|
-
readonly after: Section;
|
|
408
|
-
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Created" | "Unchanged" | "Updated"]>>;
|
|
409
|
-
};
|
|
410
|
-
readonly Created: Data.TaggedEnum.ConstructorFrom<{
|
|
411
|
-
readonly _tag: "Created";
|
|
412
|
-
readonly section: Section;
|
|
413
|
-
}, "_tag">;
|
|
414
|
-
readonly Unchanged: Data.TaggedEnum.ConstructorFrom<{
|
|
415
|
-
readonly _tag: "Unchanged";
|
|
416
|
-
readonly section: Section;
|
|
417
|
-
}, "_tag">;
|
|
418
|
-
readonly Updated: Data.TaggedEnum.ConstructorFrom<{
|
|
419
|
-
readonly _tag: "Updated";
|
|
420
|
-
readonly before: Section;
|
|
421
|
-
readonly after: Section;
|
|
422
|
-
}, "_tag">;
|
|
423
|
-
};
|
|
340
|
+
export declare const SyncOutcome: Data.TaggedEnum.Constructor<{
|
|
341
|
+
readonly _tag: "Created";
|
|
342
|
+
readonly section: Section;
|
|
343
|
+
} | {
|
|
344
|
+
readonly _tag: "Unchanged";
|
|
345
|
+
readonly section: Section;
|
|
346
|
+
} | {
|
|
347
|
+
readonly _tag: "Updated";
|
|
348
|
+
readonly before: Section;
|
|
349
|
+
readonly after: Section;
|
|
350
|
+
}>;
|
|
424
351
|
/**
|
|
425
352
|
* What a check found, without touching the document.
|
|
426
353
|
*
|
|
@@ -451,90 +378,17 @@ export type CheckOutcome = Data.TaggedEnum<{
|
|
|
451
378
|
*
|
|
452
379
|
* @public
|
|
453
380
|
*/
|
|
454
|
-
export declare const CheckOutcome: {
|
|
455
|
-
readonly
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
readonly _tag: Tag;
|
|
466
|
-
}> | Extract<{
|
|
467
|
-
readonly _tag: "UpToDate";
|
|
468
|
-
readonly section: Section;
|
|
469
|
-
}, {
|
|
470
|
-
readonly _tag: Tag;
|
|
471
|
-
}>;
|
|
472
|
-
readonly $match: {
|
|
473
|
-
<Cases extends {
|
|
474
|
-
readonly Absent: (args: {
|
|
475
|
-
readonly _tag: "Absent";
|
|
476
|
-
readonly id: SectionId;
|
|
477
|
-
}) => any;
|
|
478
|
-
readonly Drifted: (args: {
|
|
479
|
-
readonly _tag: "Drifted";
|
|
480
|
-
readonly onDisk: Section;
|
|
481
|
-
readonly expected: Section;
|
|
482
|
-
}) => any;
|
|
483
|
-
readonly UpToDate: (args: {
|
|
484
|
-
readonly _tag: "UpToDate";
|
|
485
|
-
readonly section: Section;
|
|
486
|
-
}) => any;
|
|
487
|
-
}>(cases: Cases): (value: {
|
|
488
|
-
readonly _tag: "Absent";
|
|
489
|
-
readonly id: SectionId;
|
|
490
|
-
} | {
|
|
491
|
-
readonly _tag: "Drifted";
|
|
492
|
-
readonly onDisk: Section;
|
|
493
|
-
readonly expected: Section;
|
|
494
|
-
} | {
|
|
495
|
-
readonly _tag: "UpToDate";
|
|
496
|
-
readonly section: Section;
|
|
497
|
-
}) => import("effect/Unify").Unify<ReturnType<Cases["Absent" | "Drifted" | "UpToDate"]>>;
|
|
498
|
-
<Cases extends {
|
|
499
|
-
readonly Absent: (args: {
|
|
500
|
-
readonly _tag: "Absent";
|
|
501
|
-
readonly id: SectionId;
|
|
502
|
-
}) => any;
|
|
503
|
-
readonly Drifted: (args: {
|
|
504
|
-
readonly _tag: "Drifted";
|
|
505
|
-
readonly onDisk: Section;
|
|
506
|
-
readonly expected: Section;
|
|
507
|
-
}) => any;
|
|
508
|
-
readonly UpToDate: (args: {
|
|
509
|
-
readonly _tag: "UpToDate";
|
|
510
|
-
readonly section: Section;
|
|
511
|
-
}) => any;
|
|
512
|
-
}>(value: {
|
|
513
|
-
readonly _tag: "Absent";
|
|
514
|
-
readonly id: SectionId;
|
|
515
|
-
} | {
|
|
516
|
-
readonly _tag: "Drifted";
|
|
517
|
-
readonly onDisk: Section;
|
|
518
|
-
readonly expected: Section;
|
|
519
|
-
} | {
|
|
520
|
-
readonly _tag: "UpToDate";
|
|
521
|
-
readonly section: Section;
|
|
522
|
-
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Absent" | "Drifted" | "UpToDate"]>>;
|
|
523
|
-
};
|
|
524
|
-
readonly Absent: Data.TaggedEnum.ConstructorFrom<{
|
|
525
|
-
readonly _tag: "Absent";
|
|
526
|
-
readonly id: SectionId;
|
|
527
|
-
}, "_tag">;
|
|
528
|
-
readonly Drifted: Data.TaggedEnum.ConstructorFrom<{
|
|
529
|
-
readonly _tag: "Drifted";
|
|
530
|
-
readonly onDisk: Section;
|
|
531
|
-
readonly expected: Section;
|
|
532
|
-
}, "_tag">;
|
|
533
|
-
readonly UpToDate: Data.TaggedEnum.ConstructorFrom<{
|
|
534
|
-
readonly _tag: "UpToDate";
|
|
535
|
-
readonly section: Section;
|
|
536
|
-
}, "_tag">;
|
|
537
|
-
};
|
|
381
|
+
export declare const CheckOutcome: Data.TaggedEnum.Constructor<{
|
|
382
|
+
readonly _tag: "Absent";
|
|
383
|
+
readonly id: SectionId;
|
|
384
|
+
} | {
|
|
385
|
+
readonly _tag: "Drifted";
|
|
386
|
+
readonly onDisk: Section;
|
|
387
|
+
readonly expected: Section;
|
|
388
|
+
} | {
|
|
389
|
+
readonly _tag: "UpToDate";
|
|
390
|
+
readonly section: Section;
|
|
391
|
+
}>;
|
|
538
392
|
declare const SectionParseError_base: Schema.Class<SectionParseError, Schema.TaggedStruct<"SectionParseError", {
|
|
539
393
|
/** Which ambiguity was found. */
|
|
540
394
|
readonly reason: Schema.Literals<readonly ["unterminatedSection", "orphanedEnd", "overlappingSections", "duplicateSection"]>;
|
|
@@ -802,8 +656,9 @@ export declare class ManagedSection extends ManagedSection_base {
|
|
|
802
656
|
*/
|
|
803
657
|
static readonly layerWith: (options: ManagedSectionOptions) => Layer.Layer<ManagedSection, never, FileSystem.FileSystem>;
|
|
804
658
|
/**
|
|
805
|
-
* A test double. Members a suite does not stub **die when
|
|
806
|
-
* than returning a plausible-looking
|
|
659
|
+
* A test double. Members a suite does not stub **die when run** (calling
|
|
660
|
+
* one only builds the effect), rather than returning a plausible-looking
|
|
661
|
+
* answer that makes a wrong test pass.
|
|
807
662
|
*/
|
|
808
663
|
static readonly makeTest: (overrides?: Partial<ManagedSectionShape>) => ManagedSectionShape;
|
|
809
664
|
/**
|
package/package.json
CHANGED