@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 CHANGED
@@ -126,9 +126,11 @@ const make = (options = {}) => Effect.gen(function* () {
126
126
  })
127
127
  };
128
128
  });
129
- const unimplemented = (member) => {
130
- throw new Error(`ManagedSection.makeTest: ${member}() was called but not stubbed — pass a \`${member}\` override.`);
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 called**, rather
185
- * than returning a plausible-looking answer that makes a wrong test pass.
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: () => Effect.sync(() => unimplemented("read")),
189
- readAll: () => Effect.sync(() => unimplemented("readAll")),
190
- isManaged: () => Effect.sync(() => unimplemented("isManaged")),
191
- sync: () => Effect.sync(() => unimplemented("sync")),
192
- syncAll: () => Effect.sync(() => unimplemented("syncAll")),
193
- check: () => Effect.sync(() => unimplemented("check")),
194
- checkAll: () => Effect.sync(() => unimplemented("checkAll")),
195
- remove: () => Effect.sync(() => unimplemented("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 $is: <Tag extends "Created" | "Unchanged" | "Updated">(tag: Tag) => (u: unknown) => u is Extract<{
342
- readonly _tag: "Created";
343
- readonly section: Section;
344
- }, {
345
- readonly _tag: Tag;
346
- }> | Extract<{
347
- readonly _tag: "Unchanged";
348
- readonly section: Section;
349
- }, {
350
- readonly _tag: Tag;
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 $is: <Tag extends "Absent" | "Drifted" | "UpToDate">(tag: Tag) => (u: unknown) => u is Extract<{
456
- readonly _tag: "Absent";
457
- readonly id: SectionId;
458
- }, {
459
- readonly _tag: Tag;
460
- }> | Extract<{
461
- readonly _tag: "Drifted";
462
- readonly onDisk: Section;
463
- readonly expected: Section;
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 called**, rather
806
- * than returning a plausible-looking answer that makes a wrong test pass.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effected/templates",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "private": false,
5
5
  "description": "Managed-section blocks in user-editable files: parse, reconcile, sync and check delimited regions.",
6
6
  "keywords": [
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.59.1"
8
+ "packageVersion": "7.59.4"
9
9
  }
10
10
  ]
11
11
  }