@composable-os/cli 0.0.0-stage → 0.1.0-beta.7

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 (139) hide show
  1. package/LICENSE +109 -0
  2. package/README.md +24 -2
  3. package/dist/blocks-HVTAQ5W2.js +233 -0
  4. package/dist/chunk-2ABSVMGB.js +13 -0
  5. package/dist/chunk-2P4AZTFL.js +358 -0
  6. package/dist/chunk-2S7375SC.js +802 -0
  7. package/dist/chunk-5KSXSK7Y.js +47 -0
  8. package/dist/chunk-6UWRT4VM.js +220 -0
  9. package/dist/chunk-BEKL3CA2.js +28975 -0
  10. package/dist/chunk-E5JLTLRM.js +50 -0
  11. package/dist/chunk-HDIOVFAZ.js +544 -0
  12. package/dist/chunk-KGHA67HG.js +765 -0
  13. package/dist/chunk-MAXLUQKB.js +1287 -0
  14. package/dist/chunk-MINQ46RU.js +16485 -0
  15. package/dist/chunk-STJZJIRA.js +11378 -0
  16. package/dist/chunk-VL62IMBN.js +1423 -0
  17. package/dist/chunk-X6I2LWB3.js +24319 -0
  18. package/dist/chunk-Y7PQ7NIL.js +1178 -0
  19. package/dist/chunk-ZRWF6QZS.js +2357 -0
  20. package/dist/cli-BRSACHSG.js +31393 -0
  21. package/dist/cli-XHC6QBQW.js +121 -0
  22. package/dist/cli.js +25 -0
  23. package/dist/client-repo-G55G4OLV.js +55 -0
  24. package/dist/create.js +25 -0
  25. package/dist/fields-64BQJA62.js +48 -0
  26. package/dist/invoke-5SR5ZWW7.js +26 -0
  27. package/dist/person-AZFEPZOE.js +58 -0
  28. package/dist/platform/migrations/0001_init.sql +59 -0
  29. package/dist/platform/migrations/0002_users_settings.sql +34 -0
  30. package/dist/platform/migrations/0003_people_organisations.sql +225 -0
  31. package/dist/platform/migrations/0004_activities_tasks.sql +88 -0
  32. package/dist/platform/migrations/0005_views_audit.sql +79 -0
  33. package/dist/platform/migrations/0006_search.sql +223 -0
  34. package/dist/platform/migrations/0007_crm_views.sql +141 -0
  35. package/dist/platform/migrations/0008_audit_redaction.sql +116 -0
  36. package/dist/platform/migrations/0010_approval_queue.sql +90 -0
  37. package/dist/platform/migrations/0011_connected_apps.sql +36 -0
  38. package/dist/platform/migrations/0020_extensions.sql +373 -0
  39. package/dist/platform/migrations/0030_extension_proposals.sql +29 -0
  40. package/dist/platform/migrations/0050_live_row_indexes.sql +32 -0
  41. package/dist/platform/migrations/0060_audit_read_counts.sql +31 -0
  42. package/dist/platform/migrations/0061_audit_retention.sql +95 -0
  43. package/dist/platform/migrations/0062_run_history_retention.sql +6 -0
  44. package/dist/platform/migrations/0063_pending_action_compaction.sql +18 -0
  45. package/dist/platform/migrations/0064_drop_rate_limit.sql +6 -0
  46. package/dist/platform/migrations/0065_storage_stats.sql +13 -0
  47. package/dist/platform/migrations/0070_drop_proposals_ext_idx.sql +9 -0
  48. package/dist/platform/migrations/0080_views_dashboards.sql +46 -0
  49. package/dist/platform/migrations/0100_stage_history.sql +54 -0
  50. package/dist/platform/migrations/0110_integrations.sql +103 -0
  51. package/dist/platform/migrations/0111_email_calendar_sync.sql +137 -0
  52. package/dist/platform/migrations/0112_sync_item_occurred_at.sql +8 -0
  53. package/dist/platform/migrations/0130_automations.sql +113 -0
  54. package/dist/platform/migrations/0131_notifications.sql +29 -0
  55. package/dist/platform/migrations/0132_automation_runtime.sql +14 -0
  56. package/dist/platform/migrations/0150_ai_summaries_embeddings.sql +48 -0
  57. package/dist/platform/migrations/0160_releases.sql +41 -0
  58. package/dist/platform/migrations/0161_setup_wizard.sql +30 -0
  59. package/dist/platform/migrations/0170_automation_connections.sql +32 -0
  60. package/dist/platform/migrations/0171_automation_outbox.sql +23 -0
  61. package/dist/platform/migrations/0172_notification_delivery.sql +46 -0
  62. package/dist/platform/migrations/0200_assistant_conversations.sql +25 -0
  63. package/dist/platform/migrations/0205_policy_adjudicator.sql +61 -0
  64. package/dist/platform/migrations/0210_daily_digest.sql +33 -0
  65. package/dist/platform/migrations/0220_entitlements.sql +13 -0
  66. package/dist/platform/migrations/0221_support_grants.sql +33 -0
  67. package/dist/platform/migrations/0250_judge.sql +11 -0
  68. package/dist/platform/migrations/0251_adjudication_judgement.sql +8 -0
  69. package/dist/platform/migrations/0252_judge_usage.sql +14 -0
  70. package/dist/platform/migrations/0255_summary_checks.sql +9 -0
  71. package/dist/platform/migrations/0256_outbound_check.sql +9 -0
  72. package/dist/platform/migrations/0260_ai_usage.sql +20 -0
  73. package/dist/platform/migrations/0270_assistant_conversation_refs.sql +29 -0
  74. package/dist/platform/migrations/0310_assignment_rules.sql +54 -0
  75. package/dist/platform/migrations/0320_duplicates.sql +41 -0
  76. package/dist/platform/migrations/0330_erase_completeness.sql +54 -0
  77. package/dist/platform/migrations/0350_assistant_thread.sql +38 -0
  78. package/dist/platform/migrations/0351_assistant_model_roles.sql +26 -0
  79. package/dist/platform/migrations/0352_assistant_memory.sql +74 -0
  80. package/dist/platform/migrations/0358_ai_cache_observation.sql +24 -0
  81. package/dist/platform/migrations/0359_ai_compaction_decision.sql +25 -0
  82. package/dist/platform/migrations/0360_ai_cache_estimate.sql +35 -0
  83. package/dist/platform/migrations/0361_voice_preferences.sql +27 -0
  84. package/dist/platform/migrations/0362_voice_usage.sql +17 -0
  85. package/dist/platform/migrations/0365_routines.sql +38 -0
  86. package/dist/platform/migrations/0370_approval_execution.sql +20 -0
  87. package/dist/platform/migrations/0371_agent_jobs.sql +65 -0
  88. package/dist/platform/migrations/0380_rec_views.sql +94 -0
  89. package/dist/platform/migrations/0400_customer_audit_actor.sql +142 -0
  90. package/dist/platform/migrations/0401_customer_accounts.sql +61 -0
  91. package/dist/platform/migrations/0402_erase_requests.sql +34 -0
  92. package/dist/platform/migrations/0410_idempotency_keys.sql +45 -0
  93. package/dist/platform/migrations/0411_device_sessions.sql +33 -0
  94. package/dist/platform/migrations/0420_transition_history.sql +100 -0
  95. package/dist/platform/migrations/0421_orders.sql +134 -0
  96. package/dist/platform/migrations/0422_order_payments.sql +109 -0
  97. package/dist/platform/migrations/0440_capacity.sql +100 -0
  98. package/dist/platform/migrations/0441_capacity_views.sql +40 -0
  99. package/dist/platform/migrations/0450_order_grants.sql +21 -0
  100. package/dist/platform/migrations/0451_pack_roles.sql +18 -0
  101. package/dist/platform/migrations/0460_content.sql +59 -0
  102. package/dist/platform/migrations/0461_media.sql +52 -0
  103. package/dist/platform/migrations/0470_publish_versions.sql +36 -0
  104. package/dist/platform/migrations/0471_permission_grants.sql +18 -0
  105. package/dist/platform/migrations/0490_staff_invites.sql +40 -0
  106. package/dist/platform/migrations/0491_sign_in_mail_kind.sql +10 -0
  107. package/dist/platform/migrations/0492_email_confirmation_and_sign_in_confirm.sql +30 -0
  108. package/dist/platform/migrations/0500_published_media_field.sql +25 -0
  109. package/dist/platform/migrations/0501_import_keys.sql +23 -0
  110. package/dist/platform/sdk/automation-check.ts +534 -0
  111. package/dist/platform/sdk/automation.ts +743 -0
  112. package/dist/platform/sdk/behaviour.ts +215 -0
  113. package/dist/platform/sdk/capacity.ts +112 -0
  114. package/dist/platform/sdk/contract.ts +766 -0
  115. package/dist/platform/sdk/document.ts +788 -0
  116. package/dist/platform/sdk/field-types.ts +106 -0
  117. package/dist/platform/sdk/formula/ast.ts +72 -0
  118. package/dist/platform/sdk/formula/compile.ts +454 -0
  119. package/dist/platform/sdk/formula/index.ts +4 -0
  120. package/dist/platform/sdk/formula/parser.ts +417 -0
  121. package/dist/platform/sdk/index.ts +33 -0
  122. package/dist/platform/sdk/manifest.ts +1484 -0
  123. package/dist/platform/sdk/media.ts +46 -0
  124. package/dist/platform/sdk/permissions.ts +60 -0
  125. package/dist/platform/sdk/renamed.ts +63 -0
  126. package/dist/platform/sdk/rich-text-fixture.ts +68 -0
  127. package/dist/platform/sdk/rich-text.ts +173 -0
  128. package/dist/platform/sdk/runtime.ts +410 -0
  129. package/dist/platform/sdk/sellable.ts +396 -0
  130. package/dist/platform/sdk/slug.ts +25 -0
  131. package/dist/platform/sdk/states.ts +162 -0
  132. package/dist/platform/sdk/testing.ts +836 -0
  133. package/dist/products-2H5DR232.js +11 -0
  134. package/dist/run-4JNFLYXV.js +847 -0
  135. package/dist/src-J27WXNLY.js +270 -0
  136. package/dist/src-SSVOBH6L.js +31 -0
  137. package/dist/token-MOJUA2U6.js +70 -0
  138. package/dist/token-util-TENRN4V7.js +6 -0
  139. package/package.json +33 -4
@@ -0,0 +1,215 @@
1
+ // Contract checks for an object's behaviour keys (ADR 0100): indexes, timeline links, the stage
2
+ // behaviour and seed records. Called by validateManifest for every declared object.
3
+ import { STAGE_TYPES } from "./contract.ts";
4
+ import type { FieldTypeName } from "./field-types.ts";
5
+ import type { ExtensionManifest, FieldManifest, ObjectManifest } from "./manifest.ts";
6
+
7
+ const NUMERIC: readonly FieldTypeName[] = ["number", "percent", "currency"];
8
+ const SEED_KEY_RE = /^[a-z][a-zA-Z0-9]{0,39}$/;
9
+
10
+ /** Reports problems with `objects.<name>`'s behaviour keys through `contract`. */
11
+ export function checkObjectBehaviour(
12
+ m: ExtensionManifest,
13
+ name: string,
14
+ object: ObjectManifest,
15
+ contract: (path: string, message: string) => void,
16
+ ): void {
17
+ const path = `objects.${name}`;
18
+ const fieldOf = (local: string): FieldManifest | undefined =>
19
+ Object.hasOwn(object.fields, local) ? object.fields[local] : undefined;
20
+ const isSingle = (field: FieldManifest | undefined) =>
21
+ field !== undefined && field.type !== "formula" && field.type !== "multiSelect" && !field.many;
22
+ const relationTo = (field: FieldManifest | undefined) =>
23
+ field?.type === "relation" && !field.many ? field.to : undefined;
24
+ const ownObject = (target: string | undefined) =>
25
+ target?.startsWith(`${m.id}.`) ? m.objects[target.slice(m.id.length + 1)] : undefined;
26
+
27
+ (object.indexes ?? []).forEach((columns, i) => {
28
+ if (new Set(columns).size !== columns.length) {
29
+ contract(`${path}.indexes.${i}`, "An index lists each field once");
30
+ }
31
+ for (const column of columns) {
32
+ if (column === "createdAt" || column === "updatedAt") continue;
33
+ if (!isSingle(fieldOf(column))) {
34
+ contract(
35
+ `${path}.indexes.${i}`,
36
+ `Index field "${column}" must be a single-valued, non-formula field of ${name}`,
37
+ );
38
+ }
39
+ }
40
+ });
41
+
42
+ (object.timelineLinks ?? []).forEach((local, i) => {
43
+ if (!relationTo(fieldOf(local))) {
44
+ contract(`${path}.timelineLinks.${i}`, `"${local}" must be a relation field (one record)`);
45
+ }
46
+ });
47
+
48
+ const stages = object.stages;
49
+ if (stages) {
50
+ const sp = `${path}.stages`;
51
+ const stageTarget = relationTo(fieldOf(stages.field));
52
+ const stageObject = ownObject(stageTarget);
53
+ if (!stageObject) {
54
+ contract(
55
+ `${sp}.field`,
56
+ `"${stages.field}" must be a relation field (one record) to another of this extension's objects`,
57
+ );
58
+ } else {
59
+ if (fieldOf(stages.field)?.readOnly) {
60
+ contract(`${sp}.field`, "The stage field cannot be read-only");
61
+ }
62
+ const sf = (local: string): FieldManifest | undefined =>
63
+ Object.hasOwn(stageObject.fields, local) ? stageObject.fields[local] : undefined;
64
+ const type = sf(stages.stage.type);
65
+ const values = type?.options?.map((o) => o.value) ?? [];
66
+ if (type?.type !== "select" || !STAGE_TYPES.every((t) => values.includes(t))) {
67
+ contract(
68
+ `${sp}.stage.type`,
69
+ `"${stages.stage.type}" must be a select field of ${stageTarget} with options open, won and lost`,
70
+ );
71
+ }
72
+ const order = sf(stages.stage.order);
73
+ if (!order || !NUMERIC.includes(order.type)) {
74
+ contract(
75
+ `${sp}.stage.order`,
76
+ `"${stages.stage.order}" must be a number field of ${stageTarget}`,
77
+ );
78
+ }
79
+ if (stages.stage.requiredFields !== undefined) {
80
+ const required = sf(stages.stage.requiredFields);
81
+ if (required?.type !== "multiSelect") {
82
+ contract(
83
+ `${sp}.stage.requiredFields`,
84
+ `"${stages.stage.requiredFields}" must be a multiSelect field of ${stageTarget}`,
85
+ );
86
+ } else {
87
+ for (const option of required.options ?? []) {
88
+ const target = fieldOf(option.value);
89
+ if (!target || target.type === "formula" || target.readOnly) {
90
+ contract(
91
+ `${sp}.stage.requiredFields`,
92
+ `Option "${option.value}" must name a writable field of ${name}`,
93
+ );
94
+ }
95
+ }
96
+ }
97
+ }
98
+ if (stages.stage.probability !== undefined) {
99
+ const probability = sf(stages.stage.probability);
100
+ if (!probability || !NUMERIC.includes(probability.type)) {
101
+ contract(
102
+ `${sp}.stage.probability`,
103
+ `"${stages.stage.probability}" must be a number or percent field of ${stageTarget}`,
104
+ );
105
+ }
106
+ }
107
+ const stageGroup = stages.stage.group ? relationTo(sf(stages.stage.group)) : undefined;
108
+ if (stages.stage.group !== undefined && !stageGroup) {
109
+ contract(
110
+ `${sp}.stage.group`,
111
+ `"${stages.stage.group}" must be a relation field (one record) of ${stageTarget}`,
112
+ );
113
+ }
114
+ if ((stages.group === undefined) !== (stages.stage.group === undefined)) {
115
+ contract(`${sp}.group`, "Declare both group and stage.group, or neither");
116
+ } else if (stages.group !== undefined && relationTo(fieldOf(stages.group)) !== stageGroup) {
117
+ contract(
118
+ `${sp}.group`,
119
+ `"${stages.group}" must be a relation field to the same object as ${stageTarget}.${stages.stage.group}`,
120
+ );
121
+ }
122
+ }
123
+ if (stages.probability) {
124
+ const field = fieldOf(stages.probability.field);
125
+ if (!field || !NUMERIC.includes(field.type) || field.readOnly) {
126
+ contract(
127
+ `${sp}.probability.field`,
128
+ `"${stages.probability.field}" must be a writable number or percent field`,
129
+ );
130
+ }
131
+ const flag = fieldOf(stages.probability.overridden);
132
+ if (flag?.type !== "boolean" || flag.readOnly) {
133
+ contract(
134
+ `${sp}.probability.overridden`,
135
+ `"${stages.probability.overridden}" must be a writable boolean field`,
136
+ );
137
+ }
138
+ if (!stages.stage.probability) {
139
+ contract(`${sp}.stage.probability`, "probability needs the stage's default probability");
140
+ }
141
+ }
142
+ if (stages.closedDate !== undefined) {
143
+ const field = fieldOf(stages.closedDate);
144
+ if ((field?.type !== "date" && field?.type !== "datetime") || !field.readOnly) {
145
+ contract(
146
+ `${sp}.closedDate`,
147
+ `"${stages.closedDate}" must be a read-only date or datetime field`,
148
+ );
149
+ }
150
+ }
151
+ if (stages.status !== undefined) {
152
+ const field = fieldOf(stages.status);
153
+ const values = field?.options?.map((o) => o.value) ?? [];
154
+ if (
155
+ field?.type !== "select" ||
156
+ !field.readOnly ||
157
+ !STAGE_TYPES.every((t) => values.includes(t))
158
+ ) {
159
+ contract(
160
+ `${sp}.status`,
161
+ `"${stages.status}" must be a read-only select field with options open, won and lost`,
162
+ );
163
+ }
164
+ }
165
+ if (stages.defaultGroupSetting !== undefined) {
166
+ const setting = m.settings?.[stages.defaultGroupSetting];
167
+ if (!stages.group) {
168
+ contract(`${sp}.defaultGroupSetting`, "defaultGroupSetting needs a group");
169
+ } else if (setting?.type !== "text" && setting?.type !== "select") {
170
+ contract(
171
+ `${sp}.defaultGroupSetting`,
172
+ `"${stages.defaultGroupSetting}" must be a text or select setting of this extension`,
173
+ );
174
+ }
175
+ }
176
+ for (const [type, list] of Object.entries(stages.requiredByType ?? {})) {
177
+ for (const local of list ?? []) {
178
+ const field = fieldOf(local);
179
+ if (!field || field.type === "formula" || field.readOnly) {
180
+ contract(
181
+ `${sp}.requiredByType.${type}`,
182
+ `"${local}" must be a writable field of ${name}`,
183
+ );
184
+ }
185
+ }
186
+ }
187
+ }
188
+
189
+ for (const [key, values] of Object.entries(object.seed ?? {})) {
190
+ const kp = `${path}.seed.${key}`;
191
+ if (!SEED_KEY_RE.test(key)) contract(kp, "Seed keys must be camelCase");
192
+ for (const [local, value] of Object.entries(values)) {
193
+ const field = fieldOf(local);
194
+ if (!field || field.type === "formula" || field.readOnly) {
195
+ contract(`${kp}.${local}`, `"${local}" is not a writable field of ${name}`);
196
+ continue;
197
+ }
198
+ if (value && typeof value === "object" && !Array.isArray(value)) {
199
+ const ref = (value as { seed?: unknown }).seed;
200
+ const target = ownObject(field.type === "relation" ? field.to : undefined);
201
+ if (typeof ref !== "string" || !target?.seed || !Object.hasOwn(target.seed, ref)) {
202
+ contract(
203
+ `${kp}.${local}`,
204
+ "A seed reference ({ seed: key }) must name a seed record of the relation's target",
205
+ );
206
+ }
207
+ }
208
+ }
209
+ for (const [local, field] of Object.entries(object.fields)) {
210
+ if (field.required && !(local in values)) {
211
+ contract(kp, `Seed record "${key}" needs required field "${local}"`);
212
+ }
213
+ }
214
+ }
215
+ }
@@ -0,0 +1,112 @@
1
+ // The `capacity` behaviour (stage 26, ADR 0430, ADR 0431): an object declares that its records
2
+ // have a limited number of places, and the host never gives out more than there are, for every
3
+ // actor. Its declaration, its manifest schema and its contract checks live here; the host's side
4
+ // is packages/core/src/capacity/.
5
+ import { z } from "zod";
6
+ import type { ExtensionManifest, FieldManifest, ObjectManifest } from "./manifest.ts";
7
+
8
+ /**
9
+ * What customers and the public are told about a record's places (staff always see the real
10
+ * numbers): `exact`, the number left; `low`, available, "only N left" at or below `lowAt`, or sold
11
+ * out; `availability`, available or sold out.
12
+ */
13
+ export const CAPACITY_SHOW = ["exact", "low", "availability"] as const;
14
+ export type CapacityShow = (typeof CAPACITY_SHOW)[number];
15
+
16
+ /**
17
+ * The read-only values the host adds to every record of an object with a capacity: places held
18
+ * while someone pays, places taken, and places left (the record's and its pool's, whichever is
19
+ * fewer; null when unlimited). An object with a capacity cannot have fields of these names.
20
+ */
21
+ export const CAPACITY_VALUES = ["held", "taken", "available"] as const;
22
+
23
+ /**
24
+ * A limited number of places (ADR 0430). The host keeps a counter per record and refuses, in the
25
+ * database, any claim past the places: a hold while an order is unpaid, confirmed when it is paid.
26
+ * A hold has no clock of its own: it lasts as long as what it was taken for.
27
+ *
28
+ * - `places` is this object's number field holding how many places there are. Empty means
29
+ * unlimited. Staff edit it; lowering it below what is held and taken is refused with the
30
+ * numbers, for every actor, and nothing ever sells beyond it.
31
+ * - `pool` is a relation field (one record) to another of this extension's objects that itself
32
+ * declares a capacity, and no pool: a claim on this record also claims on that record, in the
33
+ * same batch (a ticket type's places within its event's). One level only.
34
+ * - `show` is what customers and the public are told (default `availability`); `lowAt` is the
35
+ * threshold for `low`.
36
+ * - `releaseOnRefund` (default true): a refunded order's places go back on sale.
37
+ */
38
+ export interface CapacitySpec {
39
+ places: string;
40
+ pool?: string;
41
+ show?: CapacityShow;
42
+ lowAt?: number;
43
+ releaseOnRefund?: boolean;
44
+ }
45
+
46
+ const fieldName = z.string().max(40);
47
+
48
+ export const capacityManifestSchema = z
49
+ .object({
50
+ places: fieldName,
51
+ pool: fieldName.optional(),
52
+ show: z.enum(CAPACITY_SHOW).optional(),
53
+ lowAt: z.number().int().min(1).max(1_000_000).optional(),
54
+ releaseOnRefund: z.boolean().optional(),
55
+ })
56
+ .strict();
57
+ export type CapacityManifest = z.infer<typeof capacityManifestSchema>;
58
+
59
+ /** Reports problems with `objects.<name>.capacity` through `contract`. */
60
+ export function checkObjectCapacity(
61
+ m: ExtensionManifest,
62
+ name: string,
63
+ object: ObjectManifest,
64
+ contract: (path: string, message: string) => void,
65
+ ): void {
66
+ const capacity = object.capacity;
67
+ if (!capacity) return;
68
+ const path = `objects.${name}.capacity`;
69
+ const fieldOf = (local: string): FieldManifest | undefined =>
70
+ Object.hasOwn(object.fields, local) ? object.fields[local] : undefined;
71
+
72
+ const places = fieldOf(capacity.places);
73
+ if (places?.type !== "number" || places.many) {
74
+ contract(`${path}.places`, `"${capacity.places}" must be a number field of ${name}`);
75
+ }
76
+ for (const reserved of CAPACITY_VALUES) {
77
+ if (Object.hasOwn(object.fields, reserved)) {
78
+ contract(
79
+ `objects.${name}.fields.${reserved}`,
80
+ `"${reserved}" is a value the host adds to an object with a capacity; rename the field`,
81
+ );
82
+ }
83
+ }
84
+ if (capacity.pool !== undefined) {
85
+ const pool = fieldOf(capacity.pool);
86
+ const target = pool?.type === "relation" && !pool.many ? pool.to : undefined;
87
+ const local = target?.startsWith(`${m.id}.`) ? target.slice(m.id.length + 1) : undefined;
88
+ const targetObject =
89
+ local !== undefined && Object.hasOwn(m.objects, local) ? m.objects[local] : undefined;
90
+ if (!targetObject) {
91
+ contract(
92
+ `${path}.pool`,
93
+ `"${capacity.pool}" must be a relation field (one record) to another of this extension's objects`,
94
+ );
95
+ } else if (local === name) {
96
+ contract(`${path}.pool`, "An object cannot be its own pool");
97
+ } else if (!targetObject.capacity) {
98
+ contract(`${path}.pool`, `The pool's object ${target} must declare a capacity`);
99
+ } else if (targetObject.capacity.pool !== undefined) {
100
+ contract(
101
+ `${path}.pool`,
102
+ `The pool's object ${target} has a pool of its own; capacity has one level of pool`,
103
+ );
104
+ }
105
+ }
106
+ if (capacity.lowAt !== undefined && capacity.show !== "low") {
107
+ contract(`${path}.lowAt`, 'lowAt is the threshold of show: "low"');
108
+ }
109
+ if (capacity.show === "low" && capacity.lowAt === undefined) {
110
+ contract(`${path}.lowAt`, 'show: "low" needs lowAt, the number at or below which it says so');
111
+ }
112
+ }