@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.
- package/LICENSE +109 -0
- package/README.md +24 -2
- package/dist/blocks-HVTAQ5W2.js +233 -0
- package/dist/chunk-2ABSVMGB.js +13 -0
- package/dist/chunk-2P4AZTFL.js +358 -0
- package/dist/chunk-2S7375SC.js +802 -0
- package/dist/chunk-5KSXSK7Y.js +47 -0
- package/dist/chunk-6UWRT4VM.js +220 -0
- package/dist/chunk-BEKL3CA2.js +28975 -0
- package/dist/chunk-E5JLTLRM.js +50 -0
- package/dist/chunk-HDIOVFAZ.js +544 -0
- package/dist/chunk-KGHA67HG.js +765 -0
- package/dist/chunk-MAXLUQKB.js +1287 -0
- package/dist/chunk-MINQ46RU.js +16485 -0
- package/dist/chunk-STJZJIRA.js +11378 -0
- package/dist/chunk-VL62IMBN.js +1423 -0
- package/dist/chunk-X6I2LWB3.js +24319 -0
- package/dist/chunk-Y7PQ7NIL.js +1178 -0
- package/dist/chunk-ZRWF6QZS.js +2357 -0
- package/dist/cli-BRSACHSG.js +31393 -0
- package/dist/cli-XHC6QBQW.js +121 -0
- package/dist/cli.js +25 -0
- package/dist/client-repo-G55G4OLV.js +55 -0
- package/dist/create.js +25 -0
- package/dist/fields-64BQJA62.js +48 -0
- package/dist/invoke-5SR5ZWW7.js +26 -0
- package/dist/person-AZFEPZOE.js +58 -0
- package/dist/platform/migrations/0001_init.sql +59 -0
- package/dist/platform/migrations/0002_users_settings.sql +34 -0
- package/dist/platform/migrations/0003_people_organisations.sql +225 -0
- package/dist/platform/migrations/0004_activities_tasks.sql +88 -0
- package/dist/platform/migrations/0005_views_audit.sql +79 -0
- package/dist/platform/migrations/0006_search.sql +223 -0
- package/dist/platform/migrations/0007_crm_views.sql +141 -0
- package/dist/platform/migrations/0008_audit_redaction.sql +116 -0
- package/dist/platform/migrations/0010_approval_queue.sql +90 -0
- package/dist/platform/migrations/0011_connected_apps.sql +36 -0
- package/dist/platform/migrations/0020_extensions.sql +373 -0
- package/dist/platform/migrations/0030_extension_proposals.sql +29 -0
- package/dist/platform/migrations/0050_live_row_indexes.sql +32 -0
- package/dist/platform/migrations/0060_audit_read_counts.sql +31 -0
- package/dist/platform/migrations/0061_audit_retention.sql +95 -0
- package/dist/platform/migrations/0062_run_history_retention.sql +6 -0
- package/dist/platform/migrations/0063_pending_action_compaction.sql +18 -0
- package/dist/platform/migrations/0064_drop_rate_limit.sql +6 -0
- package/dist/platform/migrations/0065_storage_stats.sql +13 -0
- package/dist/platform/migrations/0070_drop_proposals_ext_idx.sql +9 -0
- package/dist/platform/migrations/0080_views_dashboards.sql +46 -0
- package/dist/platform/migrations/0100_stage_history.sql +54 -0
- package/dist/platform/migrations/0110_integrations.sql +103 -0
- package/dist/platform/migrations/0111_email_calendar_sync.sql +137 -0
- package/dist/platform/migrations/0112_sync_item_occurred_at.sql +8 -0
- package/dist/platform/migrations/0130_automations.sql +113 -0
- package/dist/platform/migrations/0131_notifications.sql +29 -0
- package/dist/platform/migrations/0132_automation_runtime.sql +14 -0
- package/dist/platform/migrations/0150_ai_summaries_embeddings.sql +48 -0
- package/dist/platform/migrations/0160_releases.sql +41 -0
- package/dist/platform/migrations/0161_setup_wizard.sql +30 -0
- package/dist/platform/migrations/0170_automation_connections.sql +32 -0
- package/dist/platform/migrations/0171_automation_outbox.sql +23 -0
- package/dist/platform/migrations/0172_notification_delivery.sql +46 -0
- package/dist/platform/migrations/0200_assistant_conversations.sql +25 -0
- package/dist/platform/migrations/0205_policy_adjudicator.sql +61 -0
- package/dist/platform/migrations/0210_daily_digest.sql +33 -0
- package/dist/platform/migrations/0220_entitlements.sql +13 -0
- package/dist/platform/migrations/0221_support_grants.sql +33 -0
- package/dist/platform/migrations/0250_judge.sql +11 -0
- package/dist/platform/migrations/0251_adjudication_judgement.sql +8 -0
- package/dist/platform/migrations/0252_judge_usage.sql +14 -0
- package/dist/platform/migrations/0255_summary_checks.sql +9 -0
- package/dist/platform/migrations/0256_outbound_check.sql +9 -0
- package/dist/platform/migrations/0260_ai_usage.sql +20 -0
- package/dist/platform/migrations/0270_assistant_conversation_refs.sql +29 -0
- package/dist/platform/migrations/0310_assignment_rules.sql +54 -0
- package/dist/platform/migrations/0320_duplicates.sql +41 -0
- package/dist/platform/migrations/0330_erase_completeness.sql +54 -0
- package/dist/platform/migrations/0350_assistant_thread.sql +38 -0
- package/dist/platform/migrations/0351_assistant_model_roles.sql +26 -0
- package/dist/platform/migrations/0352_assistant_memory.sql +74 -0
- package/dist/platform/migrations/0358_ai_cache_observation.sql +24 -0
- package/dist/platform/migrations/0359_ai_compaction_decision.sql +25 -0
- package/dist/platform/migrations/0360_ai_cache_estimate.sql +35 -0
- package/dist/platform/migrations/0361_voice_preferences.sql +27 -0
- package/dist/platform/migrations/0362_voice_usage.sql +17 -0
- package/dist/platform/migrations/0365_routines.sql +38 -0
- package/dist/platform/migrations/0370_approval_execution.sql +20 -0
- package/dist/platform/migrations/0371_agent_jobs.sql +65 -0
- package/dist/platform/migrations/0380_rec_views.sql +94 -0
- package/dist/platform/migrations/0400_customer_audit_actor.sql +142 -0
- package/dist/platform/migrations/0401_customer_accounts.sql +61 -0
- package/dist/platform/migrations/0402_erase_requests.sql +34 -0
- package/dist/platform/migrations/0410_idempotency_keys.sql +45 -0
- package/dist/platform/migrations/0411_device_sessions.sql +33 -0
- package/dist/platform/migrations/0420_transition_history.sql +100 -0
- package/dist/platform/migrations/0421_orders.sql +134 -0
- package/dist/platform/migrations/0422_order_payments.sql +109 -0
- package/dist/platform/migrations/0440_capacity.sql +100 -0
- package/dist/platform/migrations/0441_capacity_views.sql +40 -0
- package/dist/platform/migrations/0450_order_grants.sql +21 -0
- package/dist/platform/migrations/0451_pack_roles.sql +18 -0
- package/dist/platform/migrations/0460_content.sql +59 -0
- package/dist/platform/migrations/0461_media.sql +52 -0
- package/dist/platform/migrations/0470_publish_versions.sql +36 -0
- package/dist/platform/migrations/0471_permission_grants.sql +18 -0
- package/dist/platform/migrations/0490_staff_invites.sql +40 -0
- package/dist/platform/migrations/0491_sign_in_mail_kind.sql +10 -0
- package/dist/platform/migrations/0492_email_confirmation_and_sign_in_confirm.sql +30 -0
- package/dist/platform/migrations/0500_published_media_field.sql +25 -0
- package/dist/platform/migrations/0501_import_keys.sql +23 -0
- package/dist/platform/sdk/automation-check.ts +534 -0
- package/dist/platform/sdk/automation.ts +743 -0
- package/dist/platform/sdk/behaviour.ts +215 -0
- package/dist/platform/sdk/capacity.ts +112 -0
- package/dist/platform/sdk/contract.ts +766 -0
- package/dist/platform/sdk/document.ts +788 -0
- package/dist/platform/sdk/field-types.ts +106 -0
- package/dist/platform/sdk/formula/ast.ts +72 -0
- package/dist/platform/sdk/formula/compile.ts +454 -0
- package/dist/platform/sdk/formula/index.ts +4 -0
- package/dist/platform/sdk/formula/parser.ts +417 -0
- package/dist/platform/sdk/index.ts +33 -0
- package/dist/platform/sdk/manifest.ts +1484 -0
- package/dist/platform/sdk/media.ts +46 -0
- package/dist/platform/sdk/permissions.ts +60 -0
- package/dist/platform/sdk/renamed.ts +63 -0
- package/dist/platform/sdk/rich-text-fixture.ts +68 -0
- package/dist/platform/sdk/rich-text.ts +173 -0
- package/dist/platform/sdk/runtime.ts +410 -0
- package/dist/platform/sdk/sellable.ts +396 -0
- package/dist/platform/sdk/slug.ts +25 -0
- package/dist/platform/sdk/states.ts +162 -0
- package/dist/platform/sdk/testing.ts +836 -0
- package/dist/products-2H5DR232.js +11 -0
- package/dist/run-4JNFLYXV.js +847 -0
- package/dist/src-J27WXNLY.js +270 -0
- package/dist/src-SSVOBH6L.js +31 -0
- package/dist/token-MOJUA2U6.js +70 -0
- package/dist/token-util-TENRN4V7.js +6 -0
- package/package.json +33 -4
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
MEDIA_TYPES
|
|
4
|
+
} from "./chunk-X6I2LWB3.js";
|
|
5
|
+
|
|
6
|
+
// ../core/src/fields/types.ts
|
|
7
|
+
function defineObject(object) {
|
|
8
|
+
const names = /* @__PURE__ */ new Set();
|
|
9
|
+
for (const field of object.fields) {
|
|
10
|
+
if (names.has(field.name)) throw new Error(`${object.name}: duplicate field ${field.name}`);
|
|
11
|
+
names.add(field.name);
|
|
12
|
+
if ((field.filterable || field.sortable) && !field.column && !field.related) {
|
|
13
|
+
throw new Error(`${object.name}.${field.name}: filterable fields need a column or related`);
|
|
14
|
+
}
|
|
15
|
+
if (field.sortable && !field.column) {
|
|
16
|
+
throw new Error(`${object.name}.${field.name}: only single-valued fields can be sortable`);
|
|
17
|
+
}
|
|
18
|
+
if (field.type === "enum" && !field.enumValues?.length) {
|
|
19
|
+
throw new Error(`${object.name}.${field.name}: enum fields need enumValues`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (!names.has(object.defaultSort.field)) {
|
|
23
|
+
throw new Error(`${object.name}: default sort field ${object.defaultSort.field} is unknown`);
|
|
24
|
+
}
|
|
25
|
+
return object;
|
|
26
|
+
}
|
|
27
|
+
function getField(object, name) {
|
|
28
|
+
return object.fields.find((field) => field.name === name);
|
|
29
|
+
}
|
|
30
|
+
function timelineFields(object) {
|
|
31
|
+
return object.fields.filter((field) => field.track === "timeline").map((field) => field.name);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ../core/src/fields/activity.ts
|
|
35
|
+
var activityObject = defineObject({
|
|
36
|
+
name: "activity",
|
|
37
|
+
label: "Activity",
|
|
38
|
+
plural: "Activities",
|
|
39
|
+
source: "rec_activity",
|
|
40
|
+
defaultSort: { field: "occurredAt", direction: "desc" },
|
|
41
|
+
fields: [
|
|
42
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
43
|
+
{
|
|
44
|
+
name: "type",
|
|
45
|
+
label: "Type",
|
|
46
|
+
type: "enum",
|
|
47
|
+
enumValues: ["note", "email", "call", "meeting", "system"],
|
|
48
|
+
column: "type",
|
|
49
|
+
filterable: true,
|
|
50
|
+
sortable: true
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "subject",
|
|
54
|
+
label: "Subject",
|
|
55
|
+
type: "text",
|
|
56
|
+
column: "subject",
|
|
57
|
+
filterable: true,
|
|
58
|
+
sortable: true
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "body",
|
|
62
|
+
label: "Body",
|
|
63
|
+
type: "text",
|
|
64
|
+
column: "body",
|
|
65
|
+
filterable: true,
|
|
66
|
+
sortable: false
|
|
67
|
+
},
|
|
68
|
+
{ name: "payload", label: "Details", type: "json", filterable: false, sortable: false },
|
|
69
|
+
{
|
|
70
|
+
name: "occurredAt",
|
|
71
|
+
label: "When",
|
|
72
|
+
type: "datetime",
|
|
73
|
+
column: "occurred_at",
|
|
74
|
+
filterable: true,
|
|
75
|
+
sortable: true
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "authorUserId",
|
|
79
|
+
label: "Author",
|
|
80
|
+
type: "id",
|
|
81
|
+
column: "author_user_id",
|
|
82
|
+
filterable: true,
|
|
83
|
+
sortable: false
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "authorActor",
|
|
87
|
+
label: "Author type",
|
|
88
|
+
type: "enum",
|
|
89
|
+
enumValues: ["human", "assistant", "mcp", "automation", "system"],
|
|
90
|
+
column: "author_actor",
|
|
91
|
+
filterable: true,
|
|
92
|
+
sortable: false
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "linkedRecordId",
|
|
96
|
+
label: "Linked record",
|
|
97
|
+
type: "id",
|
|
98
|
+
related: { from: "core_activity_links r", link: "r.activity_id", column: "r.record_id" },
|
|
99
|
+
filterable: true,
|
|
100
|
+
sortable: false
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "createdAt",
|
|
104
|
+
label: "Created",
|
|
105
|
+
type: "datetime",
|
|
106
|
+
column: "created_at",
|
|
107
|
+
filterable: true,
|
|
108
|
+
sortable: true
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// ../core/src/fields/media.ts
|
|
114
|
+
var mediaObject = defineObject({
|
|
115
|
+
name: "media",
|
|
116
|
+
label: "Media",
|
|
117
|
+
plural: "Media",
|
|
118
|
+
source: "rec_media",
|
|
119
|
+
titleField: "name",
|
|
120
|
+
defaultSort: { field: "createdAt", direction: "desc" },
|
|
121
|
+
fields: [
|
|
122
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
123
|
+
{ name: "name", label: "Name", type: "text", column: "name", filterable: true, sortable: true },
|
|
124
|
+
{
|
|
125
|
+
name: "type",
|
|
126
|
+
label: "Type",
|
|
127
|
+
type: "enum",
|
|
128
|
+
enumValues: MEDIA_TYPES,
|
|
129
|
+
column: "type",
|
|
130
|
+
filterable: true,
|
|
131
|
+
sortable: true
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: "bytes",
|
|
135
|
+
label: "Size",
|
|
136
|
+
type: "number",
|
|
137
|
+
column: "bytes",
|
|
138
|
+
filterable: true,
|
|
139
|
+
sortable: true
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "width",
|
|
143
|
+
label: "Width",
|
|
144
|
+
type: "number",
|
|
145
|
+
column: "width",
|
|
146
|
+
filterable: true,
|
|
147
|
+
sortable: true
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: "height",
|
|
151
|
+
label: "Height",
|
|
152
|
+
type: "number",
|
|
153
|
+
column: "height",
|
|
154
|
+
filterable: true,
|
|
155
|
+
sortable: true
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "alt",
|
|
159
|
+
label: "Alt text",
|
|
160
|
+
type: "text",
|
|
161
|
+
column: "alt",
|
|
162
|
+
filterable: true,
|
|
163
|
+
sortable: false
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "createdAt",
|
|
167
|
+
label: "Uploaded",
|
|
168
|
+
type: "datetime",
|
|
169
|
+
column: "created_at",
|
|
170
|
+
filterable: true,
|
|
171
|
+
sortable: true
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: "createdBy",
|
|
175
|
+
label: "Uploaded by",
|
|
176
|
+
type: "id",
|
|
177
|
+
column: "created_by",
|
|
178
|
+
filterable: true,
|
|
179
|
+
sortable: false
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// ../core/src/fields/order.ts
|
|
185
|
+
var ORDER_STATES = [
|
|
186
|
+
"pending",
|
|
187
|
+
"part_paid",
|
|
188
|
+
"paid",
|
|
189
|
+
"cancelled",
|
|
190
|
+
"expired",
|
|
191
|
+
"refunded"
|
|
192
|
+
];
|
|
193
|
+
var STATE_LABELS = {
|
|
194
|
+
pending: "Pending",
|
|
195
|
+
part_paid: "Part paid",
|
|
196
|
+
paid: "Paid",
|
|
197
|
+
cancelled: "Cancelled",
|
|
198
|
+
expired: "Expired",
|
|
199
|
+
refunded: "Refunded"
|
|
200
|
+
};
|
|
201
|
+
var ORDER_MACHINE = {
|
|
202
|
+
field: "state",
|
|
203
|
+
initial: "pending",
|
|
204
|
+
moves: [
|
|
205
|
+
// Only a verified payment marks an order paid, in part or in full.
|
|
206
|
+
{ from: ["pending", "part_paid", "expired"], to: "paid", by: ["host"] },
|
|
207
|
+
// A late deposit staff honour (ADR 0429) makes an expired order part paid.
|
|
208
|
+
{ from: ["pending", "expired"], to: "part_paid", by: ["host"] },
|
|
209
|
+
// A buyer may give up an order they have paid nothing on. Once money is on it, staff cancel.
|
|
210
|
+
{ from: "pending", to: "cancelled", by: ["staff", "customer"], final: true },
|
|
211
|
+
{ from: "part_paid", to: "cancelled", by: ["staff"], final: true },
|
|
212
|
+
// Not final: a late payment staff choose to honour makes it paid.
|
|
213
|
+
{ from: "pending", to: "expired", by: ["host"] },
|
|
214
|
+
{ from: "paid", to: "refunded", by: ["host"], final: true }
|
|
215
|
+
]
|
|
216
|
+
};
|
|
217
|
+
var id = { type: "id", filterable: true, sortable: false };
|
|
218
|
+
var amount = { type: "number", filterable: true, sortable: true };
|
|
219
|
+
var when = { type: "datetime", filterable: true, sortable: true };
|
|
220
|
+
var orderObject = defineObject({
|
|
221
|
+
name: "order",
|
|
222
|
+
label: "Order",
|
|
223
|
+
plural: "Orders",
|
|
224
|
+
source: "rec_order",
|
|
225
|
+
defaultSort: { field: "createdAt", direction: "desc" },
|
|
226
|
+
states: ORDER_MACHINE,
|
|
227
|
+
customer: {
|
|
228
|
+
field: "personId",
|
|
229
|
+
read: [
|
|
230
|
+
"state",
|
|
231
|
+
"currency",
|
|
232
|
+
"total",
|
|
233
|
+
"paid",
|
|
234
|
+
"balance",
|
|
235
|
+
"refunded",
|
|
236
|
+
"pay",
|
|
237
|
+
"deposit",
|
|
238
|
+
"balanceDueAt",
|
|
239
|
+
"expiresAt",
|
|
240
|
+
"paidAt",
|
|
241
|
+
"createdAt"
|
|
242
|
+
],
|
|
243
|
+
write: []
|
|
244
|
+
},
|
|
245
|
+
fields: [
|
|
246
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
247
|
+
{
|
|
248
|
+
...id,
|
|
249
|
+
name: "personId",
|
|
250
|
+
label: "Person",
|
|
251
|
+
column: "person_id",
|
|
252
|
+
// What the customer declaration needs to know: this is whose order it is.
|
|
253
|
+
fieldType: "relation",
|
|
254
|
+
options: { to: "person" }
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: "email",
|
|
258
|
+
label: "Email",
|
|
259
|
+
type: "text",
|
|
260
|
+
column: "email",
|
|
261
|
+
filterable: true,
|
|
262
|
+
sortable: false
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: "state",
|
|
266
|
+
label: "State",
|
|
267
|
+
type: "enum",
|
|
268
|
+
enumValues: ORDER_STATES,
|
|
269
|
+
column: "state",
|
|
270
|
+
filterable: true,
|
|
271
|
+
sortable: true,
|
|
272
|
+
options: {
|
|
273
|
+
choices: ORDER_STATES.map((value) => ({ value, label: STATE_LABELS[value] }))
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: "currency",
|
|
278
|
+
label: "Currency",
|
|
279
|
+
type: "text",
|
|
280
|
+
column: "currency",
|
|
281
|
+
filterable: true,
|
|
282
|
+
sortable: false
|
|
283
|
+
},
|
|
284
|
+
{ ...amount, name: "total", label: "Total", column: "total" },
|
|
285
|
+
{ ...amount, name: "paid", label: "Paid", column: "paid" },
|
|
286
|
+
{ ...amount, name: "balance", label: "Balance", column: "balance" },
|
|
287
|
+
{ ...amount, name: "refunded", label: "Refunded", column: "refunded" },
|
|
288
|
+
{
|
|
289
|
+
name: "pay",
|
|
290
|
+
label: "Paying",
|
|
291
|
+
type: "enum",
|
|
292
|
+
enumValues: ["full", "deposit"],
|
|
293
|
+
column: "pay",
|
|
294
|
+
filterable: true,
|
|
295
|
+
sortable: false
|
|
296
|
+
},
|
|
297
|
+
{ ...amount, name: "deposit", label: "Deposit", column: "deposit" },
|
|
298
|
+
{ ...when, name: "balanceDueAt", label: "Balance due", column: "balance_due_at" },
|
|
299
|
+
{ ...when, name: "expiresAt", label: "Expires", column: "expires_at" },
|
|
300
|
+
{
|
|
301
|
+
name: "placedAs",
|
|
302
|
+
label: "Placed by",
|
|
303
|
+
type: "enum",
|
|
304
|
+
enumValues: ["customer", "public", "staff"],
|
|
305
|
+
column: "placed_as",
|
|
306
|
+
filterable: true,
|
|
307
|
+
sortable: false
|
|
308
|
+
},
|
|
309
|
+
{ ...when, name: "paidAt", label: "Paid on", column: "paid_at" },
|
|
310
|
+
{ ...when, name: "cancelledAt", label: "Cancelled on", column: "cancelled_at" },
|
|
311
|
+
{ ...when, name: "refundedAt", label: "Refunded on", column: "refunded_at" },
|
|
312
|
+
{ ...when, name: "createdAt", label: "Created", column: "created_at" },
|
|
313
|
+
{ ...when, name: "updatedAt", label: "Updated", column: "updated_at" }
|
|
314
|
+
]
|
|
315
|
+
});
|
|
316
|
+
var orderLineObject = defineObject({
|
|
317
|
+
name: "orderLine",
|
|
318
|
+
label: "Order line",
|
|
319
|
+
plural: "Order lines",
|
|
320
|
+
source: "rec_order_line",
|
|
321
|
+
defaultSort: { field: "position", direction: "asc" },
|
|
322
|
+
customer: {
|
|
323
|
+
field: "personId",
|
|
324
|
+
read: ["orderId", "position", "object", "recordId", "title", "quantity", "unitPrice", "total"],
|
|
325
|
+
write: []
|
|
326
|
+
},
|
|
327
|
+
fields: [
|
|
328
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
329
|
+
{ ...id, name: "orderId", label: "Order", column: "order_id" },
|
|
330
|
+
{
|
|
331
|
+
...id,
|
|
332
|
+
name: "personId",
|
|
333
|
+
label: "Person",
|
|
334
|
+
column: "person_id",
|
|
335
|
+
fieldType: "relation",
|
|
336
|
+
options: { to: "person" }
|
|
337
|
+
},
|
|
338
|
+
{ ...amount, name: "position", label: "Position", column: "position" },
|
|
339
|
+
{
|
|
340
|
+
name: "object",
|
|
341
|
+
label: "What is bought",
|
|
342
|
+
type: "text",
|
|
343
|
+
column: "object_type",
|
|
344
|
+
filterable: true,
|
|
345
|
+
sortable: false
|
|
346
|
+
},
|
|
347
|
+
{ ...id, name: "recordId", label: "Record", column: "record_id" },
|
|
348
|
+
{
|
|
349
|
+
name: "title",
|
|
350
|
+
label: "Title",
|
|
351
|
+
type: "text",
|
|
352
|
+
column: "title",
|
|
353
|
+
filterable: true,
|
|
354
|
+
sortable: false
|
|
355
|
+
},
|
|
356
|
+
{ ...amount, name: "quantity", label: "Quantity", column: "quantity" },
|
|
357
|
+
{ ...amount, name: "unitPrice", label: "Unit price", column: "unit_price" },
|
|
358
|
+
{ ...amount, name: "total", label: "Line total", column: "line_total" },
|
|
359
|
+
{ ...when, name: "createdAt", label: "Created", column: "created_at" }
|
|
360
|
+
]
|
|
361
|
+
});
|
|
362
|
+
var BASE_OBJECTS = {
|
|
363
|
+
order: orderObject,
|
|
364
|
+
orderLine: orderLineObject,
|
|
365
|
+
// Stage 28 (ADR 0444): the media library.
|
|
366
|
+
media: mediaObject
|
|
367
|
+
};
|
|
368
|
+
var BASE_TABLES = {
|
|
369
|
+
order: "core_order",
|
|
370
|
+
orderLine: "core_order_line",
|
|
371
|
+
media: "core_media"
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
// ../core/src/fields/organisation.ts
|
|
375
|
+
var organisationObject = defineObject({
|
|
376
|
+
name: "organisation",
|
|
377
|
+
label: "Organisation",
|
|
378
|
+
source: "rec_organisation",
|
|
379
|
+
defaultSort: { field: "name", direction: "asc" },
|
|
380
|
+
ownerField: "ownerId",
|
|
381
|
+
fields: [
|
|
382
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
383
|
+
{
|
|
384
|
+
name: "name",
|
|
385
|
+
label: "Name",
|
|
386
|
+
type: "text",
|
|
387
|
+
column: "name",
|
|
388
|
+
filterable: true,
|
|
389
|
+
sortable: true,
|
|
390
|
+
track: "timeline"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
name: "primaryDomain",
|
|
394
|
+
label: "Primary domain",
|
|
395
|
+
type: "text",
|
|
396
|
+
column: "primary_domain",
|
|
397
|
+
filterable: true,
|
|
398
|
+
sortable: true
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
name: "domains",
|
|
402
|
+
label: "Domains",
|
|
403
|
+
type: "text",
|
|
404
|
+
related: {
|
|
405
|
+
from: "core_organisation_domains r",
|
|
406
|
+
link: "r.organisation_id",
|
|
407
|
+
column: "r.domain"
|
|
408
|
+
},
|
|
409
|
+
filterable: true,
|
|
410
|
+
sortable: false,
|
|
411
|
+
track: "timeline"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
name: "website",
|
|
415
|
+
label: "Website",
|
|
416
|
+
type: "text",
|
|
417
|
+
column: "website",
|
|
418
|
+
filterable: true,
|
|
419
|
+
sortable: true
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
name: "industry",
|
|
423
|
+
label: "Industry",
|
|
424
|
+
type: "text",
|
|
425
|
+
column: "industry",
|
|
426
|
+
filterable: true,
|
|
427
|
+
sortable: true
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "parentId",
|
|
431
|
+
label: "Parent organisation",
|
|
432
|
+
type: "id",
|
|
433
|
+
column: "parent_id",
|
|
434
|
+
filterable: true,
|
|
435
|
+
sortable: false,
|
|
436
|
+
track: "timeline"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
name: "parentName",
|
|
440
|
+
label: "Parent name",
|
|
441
|
+
type: "text",
|
|
442
|
+
column: "parent_name",
|
|
443
|
+
filterable: true,
|
|
444
|
+
sortable: true
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
name: "ownerId",
|
|
448
|
+
label: "Owner",
|
|
449
|
+
type: "id",
|
|
450
|
+
column: "owner_id",
|
|
451
|
+
filterable: true,
|
|
452
|
+
sortable: false,
|
|
453
|
+
track: "timeline"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
name: "currentPeopleCount",
|
|
457
|
+
label: "People",
|
|
458
|
+
type: "number",
|
|
459
|
+
column: "current_people_count",
|
|
460
|
+
filterable: true,
|
|
461
|
+
sortable: true
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
name: "tags",
|
|
465
|
+
label: "Tags",
|
|
466
|
+
type: "text",
|
|
467
|
+
related: {
|
|
468
|
+
from: "core_record_tags rt JOIN core_tags r ON r.id = rt.tag_id",
|
|
469
|
+
link: "rt.record_id",
|
|
470
|
+
column: "r.name",
|
|
471
|
+
where: "rt.object_type = 'organisation'"
|
|
472
|
+
},
|
|
473
|
+
filterable: true,
|
|
474
|
+
sortable: false
|
|
475
|
+
},
|
|
476
|
+
{ name: "addresses", label: "Addresses", type: "json", filterable: false, sortable: false },
|
|
477
|
+
{ name: "avatarKey", label: "Logo", type: "text", filterable: false, sortable: false },
|
|
478
|
+
{ name: "description", label: "Description", type: "text", filterable: false, sortable: false },
|
|
479
|
+
{
|
|
480
|
+
name: "createdAt",
|
|
481
|
+
label: "Created",
|
|
482
|
+
type: "datetime",
|
|
483
|
+
column: "created_at",
|
|
484
|
+
filterable: true,
|
|
485
|
+
sortable: true
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
name: "updatedAt",
|
|
489
|
+
label: "Updated",
|
|
490
|
+
type: "datetime",
|
|
491
|
+
column: "updated_at",
|
|
492
|
+
filterable: true,
|
|
493
|
+
sortable: true
|
|
494
|
+
}
|
|
495
|
+
]
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
// ../core/src/fields/person.ts
|
|
499
|
+
var personObject = defineObject({
|
|
500
|
+
name: "person",
|
|
501
|
+
label: "Person",
|
|
502
|
+
source: "rec_person",
|
|
503
|
+
defaultSort: { field: "displayName", direction: "asc" },
|
|
504
|
+
ownerField: "ownerId",
|
|
505
|
+
// A Person is their own customer (stage 22, ADR 0402): signed in, they read their name, primary
|
|
506
|
+
// email and primary phone (`me.get`) and change their name and phone (`me.update`). The email is
|
|
507
|
+
// not writable: it would tell a customer whether an address belongs to another person (the
|
|
508
|
+
// uniqueness conflict), and sign-in uses the account's own address, not this one.
|
|
509
|
+
customer: {
|
|
510
|
+
field: "id",
|
|
511
|
+
read: ["displayName", "givenName", "familyName", "primaryEmail", "primaryPhone"],
|
|
512
|
+
write: ["displayName", "givenName", "familyName", "primaryPhone"]
|
|
513
|
+
},
|
|
514
|
+
fields: [
|
|
515
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
516
|
+
{
|
|
517
|
+
name: "displayName",
|
|
518
|
+
label: "Name",
|
|
519
|
+
type: "text",
|
|
520
|
+
column: "display_name",
|
|
521
|
+
filterable: true,
|
|
522
|
+
sortable: true
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
name: "givenName",
|
|
526
|
+
label: "Given name",
|
|
527
|
+
type: "text",
|
|
528
|
+
column: "given_name",
|
|
529
|
+
filterable: true,
|
|
530
|
+
sortable: true
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
name: "familyName",
|
|
534
|
+
label: "Family name",
|
|
535
|
+
type: "text",
|
|
536
|
+
column: "family_name",
|
|
537
|
+
filterable: true,
|
|
538
|
+
sortable: true
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
name: "primaryEmail",
|
|
542
|
+
label: "Primary email",
|
|
543
|
+
type: "text",
|
|
544
|
+
column: "primary_email",
|
|
545
|
+
filterable: true,
|
|
546
|
+
sortable: true
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
name: "emails",
|
|
550
|
+
label: "Emails",
|
|
551
|
+
type: "text",
|
|
552
|
+
related: { from: "core_person_emails r", link: "r.person_id", column: "r.email" },
|
|
553
|
+
filterable: true,
|
|
554
|
+
sortable: false
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
name: "primaryPhone",
|
|
558
|
+
label: "Primary phone",
|
|
559
|
+
type: "text",
|
|
560
|
+
column: "primary_phone",
|
|
561
|
+
filterable: true,
|
|
562
|
+
sortable: true
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
name: "phones",
|
|
566
|
+
label: "Phones",
|
|
567
|
+
type: "text",
|
|
568
|
+
related: { from: "core_person_phones r", link: "r.person_id", column: "r.number" },
|
|
569
|
+
filterable: true,
|
|
570
|
+
sortable: false
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
name: "jobTitle",
|
|
574
|
+
label: "Job title",
|
|
575
|
+
type: "text",
|
|
576
|
+
column: "job_title",
|
|
577
|
+
filterable: true,
|
|
578
|
+
sortable: true
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
name: "organisationId",
|
|
582
|
+
label: "Organisation",
|
|
583
|
+
type: "id",
|
|
584
|
+
column: "organisation_id",
|
|
585
|
+
filterable: true,
|
|
586
|
+
sortable: false
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
name: "organisationName",
|
|
590
|
+
label: "Organisation name",
|
|
591
|
+
type: "text",
|
|
592
|
+
column: "organisation_name",
|
|
593
|
+
filterable: true,
|
|
594
|
+
sortable: true
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
name: "location",
|
|
598
|
+
label: "Location",
|
|
599
|
+
type: "text",
|
|
600
|
+
column: "location",
|
|
601
|
+
filterable: true,
|
|
602
|
+
sortable: true
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
name: "timezone",
|
|
606
|
+
label: "Timezone",
|
|
607
|
+
type: "text",
|
|
608
|
+
column: "timezone",
|
|
609
|
+
filterable: true,
|
|
610
|
+
sortable: true
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
name: "ownerId",
|
|
614
|
+
label: "Owner",
|
|
615
|
+
type: "id",
|
|
616
|
+
column: "owner_id",
|
|
617
|
+
filterable: true,
|
|
618
|
+
sortable: false,
|
|
619
|
+
track: "timeline"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
name: "tags",
|
|
623
|
+
label: "Tags",
|
|
624
|
+
type: "text",
|
|
625
|
+
related: {
|
|
626
|
+
from: "core_record_tags rt JOIN core_tags r ON r.id = rt.tag_id",
|
|
627
|
+
link: "rt.record_id",
|
|
628
|
+
column: "r.name",
|
|
629
|
+
where: "rt.object_type = 'person'"
|
|
630
|
+
},
|
|
631
|
+
filterable: true,
|
|
632
|
+
sortable: false
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
name: "socialProfiles",
|
|
636
|
+
label: "Social profiles",
|
|
637
|
+
type: "json",
|
|
638
|
+
filterable: false,
|
|
639
|
+
sortable: false
|
|
640
|
+
},
|
|
641
|
+
{ name: "avatarKey", label: "Avatar", type: "text", filterable: false, sortable: false },
|
|
642
|
+
{ name: "description", label: "Description", type: "text", filterable: false, sortable: false },
|
|
643
|
+
{
|
|
644
|
+
name: "createdAt",
|
|
645
|
+
label: "Created",
|
|
646
|
+
type: "datetime",
|
|
647
|
+
column: "created_at",
|
|
648
|
+
filterable: true,
|
|
649
|
+
sortable: true
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: "updatedAt",
|
|
653
|
+
label: "Updated",
|
|
654
|
+
type: "datetime",
|
|
655
|
+
column: "updated_at",
|
|
656
|
+
filterable: true,
|
|
657
|
+
sortable: true
|
|
658
|
+
}
|
|
659
|
+
]
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
// ../core/src/fields/task.ts
|
|
663
|
+
var taskObject = defineObject({
|
|
664
|
+
name: "task",
|
|
665
|
+
label: "Task",
|
|
666
|
+
source: "rec_task",
|
|
667
|
+
defaultSort: { field: "dueAt", direction: "asc" },
|
|
668
|
+
fields: [
|
|
669
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
670
|
+
{
|
|
671
|
+
name: "title",
|
|
672
|
+
label: "Title",
|
|
673
|
+
type: "text",
|
|
674
|
+
column: "title",
|
|
675
|
+
filterable: true,
|
|
676
|
+
sortable: true
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
name: "notes",
|
|
680
|
+
label: "Notes",
|
|
681
|
+
type: "text",
|
|
682
|
+
column: "notes",
|
|
683
|
+
filterable: true,
|
|
684
|
+
sortable: false
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
name: "dueAt",
|
|
688
|
+
label: "Due",
|
|
689
|
+
type: "datetime",
|
|
690
|
+
column: "due_at",
|
|
691
|
+
filterable: true,
|
|
692
|
+
sortable: true
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
name: "status",
|
|
696
|
+
label: "Status",
|
|
697
|
+
type: "enum",
|
|
698
|
+
enumValues: ["open", "done"],
|
|
699
|
+
column: "status",
|
|
700
|
+
filterable: true,
|
|
701
|
+
sortable: true
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
name: "completedAt",
|
|
705
|
+
label: "Completed",
|
|
706
|
+
type: "datetime",
|
|
707
|
+
column: "completed_at",
|
|
708
|
+
filterable: true,
|
|
709
|
+
sortable: true
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
name: "assigneeId",
|
|
713
|
+
label: "Assignee",
|
|
714
|
+
type: "id",
|
|
715
|
+
column: "assignee_id",
|
|
716
|
+
filterable: true,
|
|
717
|
+
sortable: false
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
name: "createdBy",
|
|
721
|
+
label: "Created by",
|
|
722
|
+
type: "id",
|
|
723
|
+
column: "created_by",
|
|
724
|
+
filterable: true,
|
|
725
|
+
sortable: false
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
name: "linkedRecordId",
|
|
729
|
+
label: "Linked record",
|
|
730
|
+
type: "id",
|
|
731
|
+
related: { from: "core_task_links r", link: "r.task_id", column: "r.record_id" },
|
|
732
|
+
filterable: true,
|
|
733
|
+
sortable: false
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
name: "createdAt",
|
|
737
|
+
label: "Created",
|
|
738
|
+
type: "datetime",
|
|
739
|
+
column: "created_at",
|
|
740
|
+
filterable: true,
|
|
741
|
+
sortable: true
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
name: "updatedAt",
|
|
745
|
+
label: "Updated",
|
|
746
|
+
type: "datetime",
|
|
747
|
+
column: "updated_at",
|
|
748
|
+
filterable: true,
|
|
749
|
+
sortable: true
|
|
750
|
+
}
|
|
751
|
+
]
|
|
752
|
+
});
|
|
753
|
+
|
|
754
|
+
// ../core/src/fields/index.ts
|
|
755
|
+
var CORE_OBJECTS = {
|
|
756
|
+
person: personObject,
|
|
757
|
+
organisation: organisationObject,
|
|
758
|
+
activity: activityObject,
|
|
759
|
+
task: taskObject
|
|
760
|
+
};
|
|
761
|
+
var extensionObjects = /* @__PURE__ */ new Map();
|
|
762
|
+
function setExtensionObjects(objects) {
|
|
763
|
+
extensionObjects = objects;
|
|
764
|
+
}
|
|
765
|
+
function getObject(name) {
|
|
766
|
+
const extended = extensionObjects.get(name);
|
|
767
|
+
if (extended) return extended;
|
|
768
|
+
if (Object.hasOwn(CORE_OBJECTS, name)) {
|
|
769
|
+
return CORE_OBJECTS[name];
|
|
770
|
+
}
|
|
771
|
+
return Object.hasOwn(BASE_OBJECTS, name) ? BASE_OBJECTS[name] : void 0;
|
|
772
|
+
}
|
|
773
|
+
function listObjects() {
|
|
774
|
+
const core = Object.keys(CORE_OBJECTS).map((name) => getObject(name));
|
|
775
|
+
const ext = [...extensionObjects.values()].filter((object) => !Object.hasOwn(CORE_OBJECTS, object.name)).sort((a, b) => a.name.localeCompare(b.name));
|
|
776
|
+
return [...core, ...ext];
|
|
777
|
+
}
|
|
778
|
+
function isCoreObject(name) {
|
|
779
|
+
return Object.hasOwn(CORE_OBJECTS, name);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
export {
|
|
783
|
+
defineObject,
|
|
784
|
+
getField,
|
|
785
|
+
timelineFields,
|
|
786
|
+
activityObject,
|
|
787
|
+
mediaObject,
|
|
788
|
+
ORDER_STATES,
|
|
789
|
+
ORDER_MACHINE,
|
|
790
|
+
orderObject,
|
|
791
|
+
orderLineObject,
|
|
792
|
+
BASE_OBJECTS,
|
|
793
|
+
BASE_TABLES,
|
|
794
|
+
organisationObject,
|
|
795
|
+
personObject,
|
|
796
|
+
taskObject,
|
|
797
|
+
CORE_OBJECTS,
|
|
798
|
+
setExtensionObjects,
|
|
799
|
+
getObject,
|
|
800
|
+
listObjects,
|
|
801
|
+
isCoreObject
|
|
802
|
+
};
|