@fougere/testing 0.6.0-alpha.0 → 0.7.0-alpha.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 (71) hide show
  1. package/README.md +1 -1
  2. package/dist/all.d.ts +2 -17
  3. package/dist/all.d.ts.map +1 -1
  4. package/dist/all.js +2 -17
  5. package/dist/all.js.map +1 -1
  6. package/dist/app.d.ts +4 -35
  7. package/dist/app.d.ts.map +1 -1
  8. package/dist/app.js +2 -17
  9. package/dist/app.js.map +1 -1
  10. package/dist/comparison.d.ts +3 -20
  11. package/dist/comparison.d.ts.map +1 -1
  12. package/dist/comparison.js +29 -58
  13. package/dist/comparison.js.map +1 -1
  14. package/dist/derive.d.ts +3 -9
  15. package/dist/derive.d.ts.map +1 -1
  16. package/dist/derive.js +1 -7
  17. package/dist/derive.js.map +1 -1
  18. package/dist/doors.d.ts +4 -22
  19. package/dist/doors.d.ts.map +1 -1
  20. package/dist/doors.js +6 -24
  21. package/dist/doors.js.map +1 -1
  22. package/dist/gql.d.ts +5 -24
  23. package/dist/gql.d.ts.map +1 -1
  24. package/dist/gql.js +11 -37
  25. package/dist/gql.js.map +1 -1
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js.map +1 -1
  29. package/dist/load.d.ts +3 -20
  30. package/dist/load.d.ts.map +1 -1
  31. package/dist/load.js +6 -23
  32. package/dist/load.js.map +1 -1
  33. package/dist/remotes.d.ts +1 -6
  34. package/dist/remotes.d.ts.map +1 -1
  35. package/dist/remotes.js +1 -6
  36. package/dist/remotes.js.map +1 -1
  37. package/dist/sample.d.ts +2 -14
  38. package/dist/sample.d.ts.map +1 -1
  39. package/dist/sample.js +8 -16
  40. package/dist/sample.js.map +1 -1
  41. package/dist/scope.d.ts +5 -38
  42. package/dist/scope.d.ts.map +1 -1
  43. package/dist/scope.js +4 -26
  44. package/dist/scope.js.map +1 -1
  45. package/dist/stub.d.ts +3 -32
  46. package/dist/stub.d.ts.map +1 -1
  47. package/dist/stub.js +3 -32
  48. package/dist/stub.js.map +1 -1
  49. package/dist/sync.d.ts +2 -19
  50. package/dist/sync.d.ts.map +1 -1
  51. package/dist/sync.js +5 -22
  52. package/dist/sync.js.map +1 -1
  53. package/dist/vitest.d.ts +1 -20
  54. package/dist/vitest.d.ts.map +1 -1
  55. package/dist/vitest.js +1 -20
  56. package/dist/vitest.js.map +1 -1
  57. package/package.json +9 -9
  58. package/src/all.ts +2 -17
  59. package/src/app.ts +5 -41
  60. package/src/comparison.ts +34 -63
  61. package/src/derive.ts +3 -9
  62. package/src/doors.ts +7 -25
  63. package/src/gql.ts +9 -35
  64. package/src/index.ts +1 -1
  65. package/src/load.ts +7 -24
  66. package/src/remotes.ts +1 -6
  67. package/src/sample.ts +10 -30
  68. package/src/scope.ts +5 -38
  69. package/src/stub.ts +3 -32
  70. package/src/sync.ts +5 -22
  71. package/src/vitest.ts +1 -20
package/dist/doors.js CHANGED
@@ -5,13 +5,7 @@ import { lowerFirst, Visibility } from '@fougere/schema';
5
5
  import { Cases } from '@fougere/schema';
6
6
  import { derivedCases } from './derive.js';
7
7
  import { sampleInput, replaySeed } from './sample.js';
8
- /**
9
- * What a door answers, in the shape a verdict is compared in.
10
- *
11
- * A refusal reaches a caller as a thrown `FougereError` carrying `details`, not as a
12
- * returned value — so the translation happens once, here, and every reader below compares
13
- * the same thing.
14
- */
8
+ /** What a door answers, in the shape a verdict is compared in. */
15
9
  export async function verdictOf(call) {
16
10
  try {
17
11
  await call();
@@ -28,13 +22,7 @@ function opsFor(entity) {
28
22
  const name = lowerFirst(entity.name ?? '');
29
23
  return { name, create: 'create', update: 'update' };
30
24
  }
31
- /**
32
- * The declared contract, posed to the façade that will receive it.
33
- *
34
- * Declares one `it` per case rather than looping inside a single one: a failure names the
35
- * case, and a suite that lists what it checked is the point — the list comes from the
36
- * entity, not from what the author remembered.
37
- */
25
+ /** The declared contract, posed to the façade that will receive it. */
38
26
  export function checkContract(app, entity, options = {}) {
39
27
  const { name, create, update } = opsFor(entity);
40
28
  const run = createLocalRunner(app);
@@ -42,19 +30,13 @@ export function checkContract(app, entity, options = {}) {
42
30
  describe(`${entity.name} — the contract it declares`, () => {
43
31
  for (const one of table) {
44
32
  it(one.why, async () => {
45
- const verdict = await verdictOf(() => run({ entity: name, op: one.patch ? update : create }, { ...EMPTY_INVOCATION, params: one.patch ? { id: '__absent__' } : {}, body: one.body }));
33
+ const verdict = await verdictOf(() => run({ entity: name, op: one.patch ? update : create }, { ...EMPTY_INVOCATION, params: one.patch ? { id: '__absent__' } : {}, input: one.input }));
46
34
  expect(Cases.holds(one.expect, verdict), `${JSON.stringify(verdict)} — replay: ${replaySeed()}`).toBe(true);
47
35
  });
48
36
  }
49
37
  });
50
38
  }
51
- /**
52
- * What may leave, checked against what the entity says may leave.
53
- *
54
- * Costs nothing to state: `Visibility.output` already answers it, and a field the boundary
55
- * closes has no business in any response. A `password: text({ boundary: 'writeOnly' })`
56
- * that reaches a caller is the one leak no reviewer catches by reading a handler.
57
- */
39
+ /** What may leave, checked against what the entity says may leave. */
58
40
  export function checkOutput(app, entity, options = {}) {
59
41
  const { name, create } = opsFor(entity);
60
42
  const run = createLocalRunner(app);
@@ -62,11 +44,11 @@ export function checkOutput(app, entity, options = {}) {
62
44
  const closed = Object.keys(entity.getFields()).filter((field) => !allowed.has(field));
63
45
  describe(`${entity.name} — what leaves it`, () => {
64
46
  it(closed.length > 0 ? `keeps ${closed.join(', ')} in` : 'closes no field, and says so', async () => {
65
- const row = await run({ entity: name, op: create }, { ...EMPTY_INVOCATION, body: sampleInput(entity, options.given ?? {}, options) });
47
+ const row = await run({ entity: name, op: create }, { ...EMPTY_INVOCATION, input: sampleInput(entity, options.given ?? {}, options) });
66
48
  expect(Object.keys(row).filter((field) => closed.includes(field))).toEqual([]);
67
49
  });
68
50
  it('answers with fields the entity declares, and no others', async () => {
69
- const row = await run({ entity: name, op: create }, { ...EMPTY_INVOCATION, body: sampleInput(entity, options.given ?? {}, options) });
51
+ const row = await run({ entity: name, op: create }, { ...EMPTY_INVOCATION, input: sampleInput(entity, options.given ?? {}, options) });
70
52
  // A computed field from a presenter is declared by the presenter, not the entity,
71
53
  // so this reads the entity's own names as a floor rather than a ceiling.
72
54
  expect(Object.keys(row).every((field) => field in entity.getFields())).toBe(true);
package/dist/doors.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"doors.js","sourceRoot":"","sources":["../src/doors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAY,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAyC,MAAM,iBAAiB,CAAC;AAChG,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAC;AAQ1E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAA4B;IAC1D,IAAI,CAAC;QACH,MAAM,IAAI,EAAE,CAAC;QACb,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ;YAAE,MAAM,KAAK,CAAC;QAC3B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,MAAkB;IAChC,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,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M,GAAG,GAAG,MAAM,GAAG,CACnB,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAC5B,EAAE,GAAG,gBAAgB,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,OAAO,CAAC,EAAE,CACvD,CAAC;YAE7B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACjF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;YACtE,MAAM,GAAG,GAAG,MAAM,GAAG,CACnB,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAC5B,EAAE,GAAG,gBAAgB,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,OAAO,CAAC,EAAE,CACvD,CAAC;YAE7B,kFAAkF;YAClF,yEAAyE;YACzE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/gql.d.ts CHANGED
@@ -18,21 +18,9 @@ interface Introspectable {
18
18
  getFields(): Record<string, RootField>;
19
19
  } | null | undefined;
20
20
  }
21
- /**
22
- * The scalar fields of an entity, as a GraphQL selection.
23
- *
24
- * Relations are left out: they resolve to an object, so naming one without a sub-selection
25
- * is a syntax error, and following it would compare a neighbour's rows rather than these.
26
- */
21
+ /** The scalar fields of an entity, as a GraphQL selection. */
27
22
  export declare function selectionOf(entity: SchemaView): string;
28
- /**
29
- * The Query field that answers an operation, asked of the schema rather than recomputed.
30
- *
31
- * `pluralize` is written privately in `adapter/rest/src/routes.ts` AND in
32
- * `adapter/graphql/src/pothos.ts`; a third copy here would be the one that drifts. The
33
- * schema already states the answer, so it is read: a list is the field whose type is the
34
- * entity's list type, and a find is the field of the entity's own type that takes an id.
35
- */
23
+ /** The Query field that answers an operation, asked of the schema rather than recomputed. */
36
24
  export declare function queryFieldFor(schema: Introspectable, entity: SchemaView, op: 'list' | 'findById'): string | undefined;
37
25
  /** A `list` query, and the path at which its rows sit in the answer. */
38
26
  export declare function listQuery(schema: Introspectable, entity: SchemaView): {
@@ -46,19 +34,12 @@ export declare function findQuery(schema: Introspectable, entity: SchemaView, id
46
34
  } | undefined;
47
35
  /** Follow a path into a GraphQL answer, tolerating an absence rather than throwing. */
48
36
  export declare function at(data: unknown, path: string[]): unknown;
49
- /**
50
- * The Mutation field that answers an operation.
51
- *
52
- * By NAME here, unlike the Query side: `createProduct` and `quote` both take a single
53
- * `input` argument and both return `Product!`, so their shapes do not separate them. Two
54
- * candidates are tried against the real fields — `<op><Entity>` for a CRUD write, and the
55
- * bare op for a custom one — which needs no pluralization and invents nothing.
56
- */
37
+ /** The Mutation field that answers an operation. */
57
38
  export declare function mutationFieldFor(schema: Introspectable, entity: SchemaView, op: string): string | undefined;
58
39
  /** A mutation, with the arguments its operation takes and where its answer sits. */
59
- export declare function mutationFor(schema: Introspectable, entity: SchemaView, op: string, input: {
40
+ export declare function mutationFor(schema: Introspectable, entity: SchemaView, op: string, sent: {
60
41
  id?: string;
61
- body?: Record<string, unknown>;
42
+ input?: Record<string, unknown>;
62
43
  }): {
63
44
  query: string;
64
45
  at: string[];
package/dist/gql.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"gql.d.ts","sourceRoot":"","sources":["../src/gql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC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U,EAClB,EAAE,EAAE,MAAM,GAAG,UAAU,GACtB,MAAM,GAAG,SAAS,CAapB;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,CAMjH;AAED,sCAAsC;AACtC,wBAAgB,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,CAI7H;AAED,uFAAuF;AACvF,wBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAEzD;AAED,oDAAoD;AACpD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI3G;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CACzB,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,UAAU,EAClB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACrD;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,CAa7C"}
package/dist/gql.js CHANGED
@@ -1,24 +1,12 @@
1
- import { Anatomy, Role, Visibility } from '@fougere/schema';
2
- /**
3
- * The scalar fields of an entity, as a GraphQL selection.
4
- *
5
- * Relations are left out: they resolve to an object, so naming one without a sub-selection
6
- * is a syntax error, and following it would compare a neighbour's rows rather than these.
7
- */
1
+ import { Shapes, Role, Visibility } from '@fougere/schema';
2
+ /** The scalar fields of an entity, as a GraphQL selection. */
8
3
  export function selectionOf(entity) {
9
4
  return Object.entries(Visibility.of(entity.getFields()).output)
10
5
  .filter(([, field]) => !Role.of(field).relation)
11
6
  .map(([name]) => name)
12
7
  .join(' ');
13
8
  }
14
- /**
15
- * The Query field that answers an operation, asked of the schema rather than recomputed.
16
- *
17
- * `pluralize` is written privately in `adapter/rest/src/routes.ts` AND in
18
- * `adapter/graphql/src/pothos.ts`; a third copy here would be the one that drifts. The
19
- * schema already states the answer, so it is read: a list is the field whose type is the
20
- * entity's list type, and a find is the field of the entity's own type that takes an id.
21
- */
9
+ /** The Query field that answers an operation, asked of the schema rather than recomputed. */
22
10
  export function queryFieldFor(schema, entity, op) {
23
11
  const fields = schema.getQueryType()?.getFields() ?? {};
24
12
  const wanted = op === 'list' ? `${entity.name}List` : entity.name;
@@ -54,29 +42,22 @@ export function findQuery(schema, entity, id) {
54
42
  export function at(data, path) {
55
43
  return path.reduce((value, key) => value?.[key], data);
56
44
  }
57
- /**
58
- * The Mutation field that answers an operation.
59
- *
60
- * By NAME here, unlike the Query side: `createProduct` and `quote` both take a single
61
- * `input` argument and both return `Product!`, so their shapes do not separate them. Two
62
- * candidates are tried against the real fields — `<op><Entity>` for a CRUD write, and the
63
- * bare op for a custom one — which needs no pluralization and invents nothing.
64
- */
45
+ /** The Mutation field that answers an operation. */
65
46
  export function mutationFieldFor(schema, entity, op) {
66
47
  const fields = schema.getMutationType?.()?.getFields() ?? {};
67
48
  const candidates = [`${op}${entity.name}`, op];
68
49
  return candidates.find((name) => name in fields);
69
50
  }
70
51
  /** A mutation, with the arguments its operation takes and where its answer sits. */
71
- export function mutationFor(schema, entity, op, input) {
52
+ export function mutationFor(schema, entity, op, sent) {
72
53
  const field = mutationFieldFor(schema, entity, op);
73
54
  if (!field)
74
55
  return undefined;
75
56
  const args = [];
76
- if (input.id !== undefined)
77
- args.push(`id: ${JSON.stringify(input.id)}`);
78
- if (input.body !== undefined)
79
- args.push(`input: ${literalOf(input.body, enumsOf(entity))}`);
57
+ if (sent.id !== undefined)
58
+ args.push(`id: ${JSON.stringify(sent.id)}`);
59
+ if (sent.input !== undefined)
60
+ args.push(`input: ${literalOf(sent.input, enumsOf(entity))}`);
80
61
  const call = args.length ? `${field}(${args.join(', ')})` : field;
81
62
  // `delete` answers a Boolean, which takes no sub-selection — asking for one is a syntax
82
63
  // error, and the schema is what says which case this is.
@@ -86,17 +67,10 @@ export function mutationFor(schema, entity, op, input) {
86
67
  /** The fields the entity declares as a bounded set — GraphQL turns each into an enum. */
87
68
  function enumsOf(entity) {
88
69
  return new Set(Object.entries(entity.getFields())
89
- .filter(([, field]) => { const base = Anatomy.of(field.shape).base; return base?.type === 'string' && Array.isArray(base.enum); })
70
+ .filter(([, field]) => { const base = Shapes.of(field.shape).base; return base?.type === 'string' && Array.isArray(base.enum); })
90
71
  .map(([name]) => name));
91
72
  }
92
- /**
93
- * A JS value as a GraphQL literal.
94
- *
95
- * `JSON.stringify` is not it, twice over: an input object's keys are NAMES, so
96
- * `{"sku": "x"}` is a syntax error where `{sku: "x"}` is the value — and an ENUM value is
97
- * a name too, so `status: "draft"` is refused where `status: draft` is taken. Which
98
- * fields are enums is read from the entity (`shape.enum`), not guessed from the string.
99
- */
73
+ /** A JS value as a GraphQL literal. */
100
74
  function literalOf(value, enums = new Set(), key) {
101
75
  if (value === null)
102
76
  return 'null';
package/dist/gql.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"gql.js","sourceRoot":"","sources":["../src/gql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAA+B,MAAM,iBAAiB,CAAC;AAezF;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,MAAkB;IAC5C,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC;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OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC;aACxD,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IACnF,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { sampleInput, replaySeed, type SampleOptions } from './sample.js';
2
2
  export { derivedCases } from './derive.js';
3
- export { Cases, type Case } from '@fougere/schema';
3
+ export { Cases, type ValidationCase } from '@fougere/schema';
4
4
  export { testApp, type TestAppOptions, type TestApp } from './app.js';
5
5
  export { checkContract, checkOutput, verdictOf, type Verdict, type CheckOptions } from './doors.js';
6
6
  export { stubOf, methodsOf, installStubs, type Port, type Stub } from './stub.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI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;AACzB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC/G,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAkB,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAwB,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAqC,MAAM,WAAW,CAAC"}
package/dist/load.d.ts CHANGED
@@ -7,28 +7,11 @@ export interface LoadOptions {
7
7
  }
8
8
  interface Reachable {
9
9
  method: string;
10
- body: unknown;
10
+ input: unknown;
11
11
  }
12
- /**
13
- * Every operation the app answers, with a body for those that take one.
14
- *
15
- * Enumerated rather than chosen, and that is the whole point: a scenario written by hand
16
- * holds the operations its author thought of — `demos/observability/load.js` exercises
17
- * three — while this one holds all of them, and an operation given `weight: 0` becomes a
18
- * decision visible in the file instead of an omission nobody can see.
19
- */
12
+ /** Every operation the app answers, with a body for those that take one. */
20
13
  export declare function reachableOps(app: App, given?: LoadOptions['given']): Reachable[];
21
- /**
22
- * A k6 scenario, written from what the app answers.
23
- *
24
- * k6 runs on its own runtime and cannot import from here, so the file is GENERATED rather
25
- * than made to import `frameCall` — but the envelope in it comes from `frameCall` itself,
26
- * called once at generation time. `demos/observability/load.js` spells that envelope by
27
- * hand, so it will go on claiming to be JSON-RPC the day the format moves.
28
- *
29
- * What stays the author's: the weights, the stages and the thresholds. The scan knows
30
- * which operations exist; it knows nothing about the traffic they receive.
31
- */
14
+ /** A k6 scenario, written from what the app answers. */
32
15
  export declare function loadScript(app: App, options?: LoadOptions): string;
33
16
  export {};
34
17
  //# sourceMappingURL=load.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIzC,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACjD;AAED,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,GAAE,WAAW,CAAC,OAAO,CAAM,GAAG,SAAS,EAAE,CAiBpF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAmDtE"}
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIzC,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACjD;AAED,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,GAAE,WAAW,CAAC,OAAO,CAAM,GAAG,SAAS,EAAE,CAiBpF;AAED,wDAAwD;AACxD,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAmDtE"}
package/dist/load.js CHANGED
@@ -1,13 +1,6 @@
1
1
  import { frameCall } from '@fougere/transport-http';
2
2
  import { sampleInput } from './sample.js';
3
- /**
4
- * Every operation the app answers, with a body for those that take one.
5
- *
6
- * Enumerated rather than chosen, and that is the whole point: a scenario written by hand
7
- * holds the operations its author thought of — `demos/observability/load.js` exercises
8
- * three — while this one holds all of them, and an operation given `weight: 0` becomes a
9
- * decision visible in the file instead of an omission nobody can see.
10
- */
3
+ /** Every operation the app answers, with a body for those that take one. */
11
4
  export function reachableOps(app, given = {}) {
12
5
  const found = [];
13
6
  for (const frond of app.fronds) {
@@ -20,29 +13,19 @@ export function reachableOps(app, given = {}) {
20
13
  const schema = contract.input;
21
14
  found.push({
22
15
  method: `${handler.address}.${op}`,
23
- body: schema ? sampleInput(schema, given[handler.address] ?? {}) : undefined,
16
+ input: schema ? sampleInput(schema, given[handler.address] ?? {}) : undefined,
24
17
  });
25
18
  }
26
19
  }
27
20
  }
28
21
  return found;
29
22
  }
30
- /**
31
- * A k6 scenario, written from what the app answers.
32
- *
33
- * k6 runs on its own runtime and cannot import from here, so the file is GENERATED rather
34
- * than made to import `frameCall` — but the envelope in it comes from `frameCall` itself,
35
- * called once at generation time. `demos/observability/load.js` spells that envelope by
36
- * hand, so it will go on claiming to be JSON-RPC the day the format moves.
37
- *
38
- * What stays the author's: the weights, the stages and the thresholds. The scan knows
39
- * which operations exist; it knows nothing about the traffic they receive.
40
- */
23
+ /** A k6 scenario, written from what the app answers. */
41
24
  export function loadScript(app, options = {}) {
42
25
  const door = options.door ?? 'http://127.0.0.1:3000/_fougere/call';
43
26
  const ops = reachableOps(app, options.given);
44
27
  // The shape, from the one function that states it. `body` is replaced per iteration.
45
- const envelope = frameCall({ entity: 'ENTITY', op: 'OP' }, { params: {}, query: {}, body: undefined, state: {} }, 0);
28
+ const envelope = frameCall({ entity: 'ENTITY', op: 'OP' }, { params: {}, query: {}, input: undefined, state: {} }, 0);
46
29
  // What the envelope carries that an iteration does not fill in itself. Keeping
47
30
  // `params` here too put it in the object AND in the spread that overwrites it.
48
31
  const perCall = new Set(['method', 'id', 'params']);
@@ -82,10 +65,10 @@ export default function () {
82
65
  const payload = ${JSON.stringify(Object.fromEntries(keys.map((key) => [key, envelope[key]])))};
83
66
  const response = http.post(
84
67
  DOOR,
85
- JSON.stringify({ ...payload, id: ++id, method: op.method, params: { params: {}, query: {}, body: op.body, state: {} } }),
68
+ JSON.stringify({ ...payload, id: ++id, method: op.method, params: { params: {}, query: {}, input: op.input, state: {} } }),
86
69
  { headers: { 'content-type': 'application/json' }, tags: { op: op.method } },
87
70
  );
88
- check(response, { 'answered': (r) => r.status === 200 });
71
+ validate(response, { 'answered': (r) => r.status === 200 });
89
72
  }
90
73
  `;
91
74
  }
package/dist/load.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAc1C;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,GAAQ,EAAE,KAAK,GAAyB,EAAE;IACrE,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAC/B,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACrC,+EAA+E;YAC/E,mEAAmE;YACnE,IAAI,OAAO,CAAC,OAAO;gBAAE,SAAS;YAC9B,KAAK,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;gBACtD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAA+B,CAAC;gBACxD,KAAK,CAAC,IAAI,CAAC;oBACT,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE;oBAClC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CA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a test states its subject by where it sits, and `agrees(driftOf(…))`
5
- * is a testing gesture — the function is core's, the assertion is this package's.
6
- */
1
+ /** Contract drift moved to `@fougere/core`, beside the card it compares. */
7
2
  export { driftOf, agrees, explain, type CardDrift } from '@fougere/core';
8
3
  //# sourceMappingURL=remotes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remotes.d.ts","sourceRoot":"","sources":["../src/remotes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"remotes.d.ts","sourceRoot":"","sources":["../src/remotes.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC"}
package/dist/remotes.js CHANGED
@@ -1,8 +1,3 @@
1
- /**
2
- * Contract drift moved to `@fougere/core`, beside the card it compares.
3
- *
4
- * Republished here because a test states its subject by where it sits, and `agrees(driftOf(…))`
5
- * is a testing gesture — the function is core's, the assertion is this package's.
6
- */
1
+ /** Contract drift moved to `@fougere/core`, beside the card it compares. */
7
2
  export { driftOf, agrees, explain } from '@fougere/core';
8
3
  //# sourceMappingURL=remotes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remotes.js","sourceRoot":"","sources":["../src/remotes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAkB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"remotes.js","sourceRoot":"","sources":["../src/remotes.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAkB,MAAM,eAAe,CAAC"}
package/dist/sample.d.ts CHANGED
@@ -1,19 +1,7 @@
1
1
  import { type SchemaView } from '@fougere/schema';
2
- /**
3
- * A body a client could legitimately send, built from what the entity declares.
4
- *
5
- * The shape IS JSON Schema, so the value itself is not ours to invent — `json-schema-faker`
6
- * honours `minLength`, `enum`, `format`, `pattern`, `items` and `required`. What is ours is
7
- * WHICH fields belong in a body, and that is `Visibility.input`: the one reader of the boundary
8
- * and lifecycle axes the façade and the form already stand on. Re-deriving "not primary,
9
- * not stamped, not read-only" here would make this a second opinion on the axes.
10
- */
2
+ /** A body a client could legitimately send, built from what the entity declares. */
11
3
  export interface SampleOptions {
12
- /**
13
- * Fixes what is generated. Defaults to a value derived from the entity name, so two
14
- * runs agree and a failure is replayable — a body drawn afresh every time produces the
15
- * test that fails once in twenty and cannot be reproduced.
16
- */
4
+ /** Fixes what is generated. */
17
5
  seed?: number;
18
6
  }
19
7
  /** How to reproduce the last generated body, in the words that reproduce it. */
@@ -1 +1 @@
1
- {"version":3,"file":"sample.d.ts","sourceRoot":"","sources":["../src/sample.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA8BD,gFAAgF;AAChF,wBAAgB,UAAU,IAAI,MAAM,CAInC;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,UAAU,EAClB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACnC,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyBzB"}
1
+ {"version":3,"file":"sample.d.ts","sourceRoot":"","sources":["../src/sample.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7F,oFAAoF;AACpF,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAsBD,gFAAgF;AAChF,wBAAgB,UAAU,IAAI,MAAM,CAInC;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,UAAU,EAClB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACnC,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyBzB"}
package/dist/sample.js CHANGED
@@ -8,23 +8,15 @@ function seedOf(name) {
8
8
  return Math.abs(hash) || 1;
9
9
  }
10
10
  /**
11
- * A relation has no value of its own to invent — `ref(Author)` names a row that must
12
- * exist, and a made-up id points at nothing. So it is REFUSED by name rather than
13
- * omitted: a body silently missing a required reference is a body the judge rejects for
14
- * a reason that has nothing to do with the test.
11
+ * A relation has no value of its own to invent — `ref(Author)` names a row that must exist, and a
12
+ * made-up id points at nothing.
15
13
  */
16
14
  function referencesIn(fields) {
17
15
  return Object.entries(fields)
18
16
  .filter(([, field]) => Role.of(field).isReference)
19
17
  .map(([name]) => name);
20
18
  }
21
- /**
22
- * The seed the last sample used, so a failure can say how to replay it.
23
- *
24
- * A stable seed nobody can read is a stable seed for nothing: the value has to reach the
25
- * person looking at the red line. Held here rather than returned, so the signature stays
26
- * the body a caller wanted.
27
- */
19
+ /** The seed the last sample used, so a failure can say how to replay it. */
28
20
  let lastSeed;
29
21
  /** How to reproduce the last generated body, in the words that reproduce it. */
30
22
  export function replaySeed() {
@@ -42,20 +34,20 @@ export function sampleInput(entity, given = {}, options = {}) {
42
34
  }
43
35
  const seed = options.seed ?? seedOf(entity.name ?? 'anonymous');
44
36
  lastSeed = { entity: entity.name ?? 'Entity', seed };
45
- const body = {};
37
+ const input = {};
46
38
  let nth = 0;
47
39
  for (const [name, field] of Object.entries(fields)) {
48
40
  if (name in given) {
49
- body[name] = given[name];
41
+ input[name] = given[name];
50
42
  continue;
51
43
  }
52
44
  // One seed per field, derived from one seed per entity: two fields of the same shape
53
45
  // would otherwise carry the same value, and a test asserting on `title` would pass
54
- // while reading `body`.
46
+ // while reading `title`.
55
47
  // A `Shape` IS a JSON Schema; the two packages declare the same concept and only
56
48
  // disagree on `readonly`, which no value crosses.
57
- body[name] = generateSync(field.shape, { seed: seed + nth++ });
49
+ input[name] = generateSync(field.shape, { seed: seed + nth++ });
58
50
  }
59
- return body;
51
+ return input;
60
52
  }
61
53
  //# sourceMappingURL=sample.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sample.js","sourceRoot":"","sources":["../src/sample.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAA4C,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAmB,MAAM,mBAAmB,CAAC;AAoBlE,iFAAiF;AACjF,SAAS,MAAM,CAAC,IAAY;IAC1B,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAClF,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;GAKG;AACH,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;SAC1B,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,KAAc,CAAC,CAAC,WAAW,CAAC;SAC1D,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;;GAMG;AACH,IAAI,QAAsD,CAAC;AAE3D,gFAAgF;AAChF,MAAM,UAAU,UAAU;IACxB,OAAO,QAAQ;QACb,CAAC,CAAC,eAAe,QAAQ,CAAC,MAAM,iBAAiB,QAAQ,CA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,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;YAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QAC3D,qFAAqF;QACrF,mFAAmF;QACnF,yBAAyB;QACzB,iFAAiF;QACjF,kDAAkD;QAClD,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY,CAAE,KAAe,CAAC,KAAmB,EAAE,EAAE,IAAI,EAAE,IAAI,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/dist/scope.d.ts CHANGED
@@ -1,49 +1,16 @@
1
- /**
2
- * What a test file's position states about its subject.
3
- *
4
- * The same reading the scan already performs on `entities/` and `handlers/`: a directory
5
- * is a declaration. A file under `fronds/blog/tests/` says its subject is `blog`, so that
6
- * frond is real and its neighbours are not — which is a TOPOLOGY, the very thing
7
- * `remotes:` states in production, and not a mode of testing.
8
- *
9
- * The sub-directory below `tests/` carries nothing. A name like `it('refuses a payment')`
10
- * is prose, and prose deciding how an app is wired is the hidden runtime the doctrine
11
- * refuses; a path is a position, which a reader sees by looking at where the file sits.
12
- */
1
+ /** What a test file's position states about its subject. */
13
2
  export interface Scope {
14
3
  /** The project the app boots from — where `fronds/` and `fougere.config.ts` live. */
15
4
  root: string;
16
5
  /** The frond under test. Absent means every frond is real: several of them, together. */
17
6
  frond?: string;
18
7
  }
19
- /**
20
- * The frond a path sits in, or nothing.
21
- *
22
- * The LAST `fronds/` segment wins: a frond may hold a synced copy of a neighbour under
23
- * `.fougere/remotes/`, and a test that ever lands beside one is about the inner frond.
24
- */
8
+ /** The frond a path sits in, or nothing. */
25
9
  export declare function frondOf(path: string, frondsDir?: string): string | undefined;
26
- /**
27
- * Where the project starts: the first ancestor holding a config or a `fronds/`.
28
- *
29
- * The config is probed FIRST, which is what lets the rest of this file ask it where fronds
30
- * live: a project that renamed the directory still declares one, and only a project with
31
- * no config at all is found by the convention.
32
- */
10
+ /** Where the project starts. */
33
11
  export declare function rootOf(path: string): string | undefined;
34
- /**
35
- * The scope a test file declares by where it sits.
36
- *
37
- * Returns nothing when the file sits outside any project — a caller then states `root`
38
- * itself, which is what this package's own tests do against their fixtures.
39
- */
12
+ /** The scope a test file declares by where it sits. */
40
13
  export declare function scopeOf(path: string): Promise<Scope | undefined>;
41
- /**
42
- * The path of the running test file, from vitest.
43
- *
44
- * Read rather than guessed: `expect.getState()` is vitest's own API. Handed in by the
45
- * caller because this module is ESM and cannot `require`, and because a package that
46
- * imports vitest at the top level stops being loadable outside a test run.
47
- */
14
+ /** The path of the running test file, from vitest. */
48
15
  export declare function scopeOfRun(testPath: string | undefined): Promise<Scope | undefined>;
49
16
  //# sourceMappingURL=scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,KAAK;IACpB,qFAAqF;IACrF,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAmC,GAAG,MAAM,GAAG,SAAS,CAMxG;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASvD;AAED;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAQtE;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAEzF"}
1
+ {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAIA,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