@kylewillett/troupe 0.1.1 → 0.2.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 (81) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +129 -3
  3. package/dist/ask.d.ts +5 -1
  4. package/dist/ask.js +16 -0
  5. package/dist/backstage/index.d.ts +2 -1
  6. package/dist/backstage/index.js +1 -0
  7. package/dist/backstage/source.d.ts +1 -1
  8. package/dist/backstage/source.js +65 -2
  9. package/dist/backstage/types.d.ts +65 -4
  10. package/dist/backstage/types.js +2 -1
  11. package/dist/backstage-ui/assets/index-CG896RLZ.css +1 -0
  12. package/dist/backstage-ui/assets/index-DF_Xnc1u.js +9 -0
  13. package/dist/backstage-ui/index.html +2 -2
  14. package/dist/cell.d.ts +16 -14
  15. package/dist/cell.js +38 -13
  16. package/dist/checks.d.ts +10 -0
  17. package/dist/checks.js +34 -2
  18. package/dist/cluster/index.d.ts +6 -0
  19. package/dist/cluster/index.js +4 -0
  20. package/dist/cluster/leases.d.ts +37 -0
  21. package/dist/cluster/leases.js +132 -0
  22. package/dist/cluster/membership.d.ts +100 -0
  23. package/dist/cluster/membership.js +559 -0
  24. package/dist/cluster/memory.d.ts +31 -0
  25. package/dist/cluster/memory.js +187 -0
  26. package/dist/cluster/placement.d.ts +10 -0
  27. package/dist/cluster/placement.js +30 -0
  28. package/dist/cluster/postgres/index.d.ts +1 -0
  29. package/dist/cluster/postgres/index.js +3 -0
  30. package/dist/cluster/postgres/schema.d.ts +7 -0
  31. package/dist/cluster/postgres/schema.js +33 -0
  32. package/dist/cluster/postgres/schema.sql +18 -0
  33. package/dist/cluster/postgres/store.d.ts +28 -0
  34. package/dist/cluster/postgres/store.js +124 -0
  35. package/dist/cluster/region.d.ts +103 -0
  36. package/dist/cluster/region.js +843 -0
  37. package/dist/cluster/remoting.d.ts +79 -0
  38. package/dist/cluster/remoting.js +755 -0
  39. package/dist/cluster/shard-memory.d.ts +14 -0
  40. package/dist/cluster/shard-memory.js +92 -0
  41. package/dist/cluster/shard-store.d.ts +62 -0
  42. package/dist/cluster/shard-store.js +36 -0
  43. package/dist/cluster/shard.d.ts +54 -0
  44. package/dist/cluster/shard.js +278 -0
  45. package/dist/cluster/sharding.d.ts +109 -0
  46. package/dist/cluster/sharding.js +278 -0
  47. package/dist/cluster/table.d.ts +29 -0
  48. package/dist/cluster/table.js +74 -0
  49. package/dist/cluster/transport.d.ts +29 -0
  50. package/dist/cluster/transport.js +4 -0
  51. package/dist/cluster/wire.d.ts +90 -0
  52. package/dist/cluster/wire.js +177 -0
  53. package/dist/hash.d.ts +7 -0
  54. package/dist/hash.js +25 -0
  55. package/dist/internal.d.ts +134 -2
  56. package/dist/internal.js +12 -1
  57. package/dist/json.d.ts +44 -0
  58. package/dist/json.js +143 -0
  59. package/dist/node/cluster/frames.d.ts +31 -0
  60. package/dist/node/cluster/frames.js +73 -0
  61. package/dist/node/cluster/index.d.ts +1 -0
  62. package/dist/node/cluster/index.js +3 -0
  63. package/dist/node/cluster/tcp.d.ts +101 -0
  64. package/dist/node/cluster/tcp.js +416 -0
  65. package/dist/persistence/actor.js +1 -1
  66. package/dist/persistence/backend.d.ts +1 -10
  67. package/dist/persistence/backend.js +4 -34
  68. package/dist/persistence/postgres/index.d.ts +2 -1
  69. package/dist/persistence/postgres/index.js +1 -1
  70. package/dist/persistence/postgres/pool.d.ts +44 -0
  71. package/dist/persistence/postgres/pool.js +65 -0
  72. package/dist/persistence/postgres/postgres.d.ts +1 -33
  73. package/dist/persistence/postgres/postgres.js +4 -63
  74. package/dist/system.d.ts +1 -1
  75. package/dist/system.js +190 -24
  76. package/dist/types.d.ts +86 -3
  77. package/package.json +21 -2
  78. package/dist/backstage-ui/assets/index-Bg0MCiqs.css +0 -1
  79. package/dist/backstage-ui/assets/index-CeefBsDh.js +0 -9
  80. package/dist/persistence/json.d.ts +0 -7
  81. package/dist/persistence/json.js +0 -75
@@ -1,7 +0,0 @@
1
- /**
2
- * Where `value` stops being a JSON value, as a path such as `$.items[2]` with the reason, or
3
- * `undefined` if it is one.
4
- */
5
- export declare function jsonProblem(value: unknown): string | undefined;
6
- /** Whether `value` is a JSON value: what `JSON.parse` could have produced. */
7
- export declare function isJsonValue(value: unknown): boolean;
@@ -1,75 +0,0 @@
1
- // Events and snapshot states are JSON values (decision 0014): what every backend can store and give
2
- // back deep-equal. These checks run before anything is written, so a value that JSON would quietly
3
- // change, such as `undefined` or a `Date`, fails where it's produced instead of on recovery.
4
- /**
5
- * Where `value` stops being a JSON value, as a path such as `$.items[2]` with the reason, or
6
- * `undefined` if it is one.
7
- */
8
- export function jsonProblem(value) {
9
- return problemAt(value, '$', new Set());
10
- }
11
- /** Whether `value` is a JSON value: what `JSON.parse` could have produced. */
12
- export function isJsonValue(value) {
13
- return jsonProblem(value) === undefined;
14
- }
15
- function problemAt(value, path, ancestors) {
16
- switch (typeof value) {
17
- case 'string':
18
- case 'boolean':
19
- return undefined;
20
- case 'number':
21
- // -0 passes, as JSON.parse('-0') gives it, though it comes back as 0.
22
- return Number.isFinite(value) ? undefined : `${path} is ${String(value)}`;
23
- case 'object':
24
- if (value === null)
25
- return undefined;
26
- return objectProblem(value, path, ancestors);
27
- case 'undefined':
28
- return `${path} is undefined`;
29
- default:
30
- return `${path} is a ${typeof value}`;
31
- }
32
- }
33
- function objectProblem(value, path, ancestors) {
34
- if (ancestors.has(value))
35
- return `${path} is a cycle`;
36
- if (Object.getOwnPropertySymbols(value).length > 0)
37
- return `${path} has symbol keys`;
38
- ancestors.add(value);
39
- try {
40
- if (Array.isArray(value))
41
- return arrayProblem(value, path, ancestors);
42
- const proto = Object.getPrototypeOf(value);
43
- if (proto !== Object.prototype && proto !== null) {
44
- return `${path} is not a plain object (${constructorName(value)})`;
45
- }
46
- for (const [key, item] of Object.entries(value)) {
47
- const problem = problemAt(item, `${path}${keyPath(key)}`, ancestors);
48
- if (problem !== undefined)
49
- return problem;
50
- }
51
- return undefined;
52
- }
53
- finally {
54
- ancestors.delete(value);
55
- }
56
- }
57
- function arrayProblem(value, path, ancestors) {
58
- for (let i = 0; i < value.length; i++) {
59
- // A hole would come back as null.
60
- if (!(i in value))
61
- return `${path}[${String(i)}] is a hole`;
62
- const problem = problemAt(value[i], `${path}[${String(i)}]`, ancestors);
63
- if (problem !== undefined)
64
- return problem;
65
- }
66
- return undefined;
67
- }
68
- function constructorName(value) {
69
- const ctor = value.constructor;
70
- return typeof ctor === 'function' && ctor.name !== '' ? ctor.name : 'an anonymous class';
71
- }
72
- const IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
73
- function keyPath(key) {
74
- return IDENTIFIER.test(key) ? `.${key}` : `[${JSON.stringify(key)}]`;
75
- }