@composable-os/cli 0.1.0-beta.10 → 0.1.0-beta.13
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/dist/{accounts-X4CKM3HL.js → accounts-GOCNY6WI.js} +17 -14
- package/dist/app-RPRZMLU5.js +43 -0
- package/dist/app-upload-YJVEKZC6.js +198 -0
- package/dist/{blocks-YWDHEBOK.js → blocks-DE4RRWPJ.js} +207 -25
- package/dist/{chunk-VY64DMQO.js → chunk-2B6YUYZV.js} +23576 -11674
- package/dist/{run-RT2HVWMK.js → chunk-2CCHB37H.js} +9 -146
- package/dist/{chunk-DU6OIFOU.js → chunk-3OGDWKJ3.js} +530 -434
- package/dist/chunk-5D7BDF4Y.js +141 -0
- package/dist/{chunk-WO6D3XP3.js → chunk-6CM3WZG5.js} +13 -2470
- package/dist/chunk-CIBJGB5H.js +962 -0
- package/dist/chunk-EPDTPGZJ.js +330 -0
- package/dist/{chunk-LLULPZAJ.js → chunk-HAYF4G5V.js} +66 -23
- package/dist/chunk-HCG6T53D.js +61904 -0
- package/dist/chunk-JX4IFWNT.js +330 -0
- package/dist/{chunk-A4NTSYWV.js → chunk-KFHKNXGH.js} +786 -386
- package/dist/chunk-KMFMD52Z.js +13276 -0
- package/dist/{chunk-E4WCYTCT.js → chunk-LX2TTLVY.js} +174 -55
- package/dist/{chunk-GYTEW66E.js → chunk-O3R4FS2J.js} +1 -1
- package/dist/{chunk-LJFLENFC.js → chunk-Q6Y45DY6.js} +25 -2
- package/dist/{chunk-Y7JZFSTQ.js → chunk-QJZGYJVV.js} +823 -44
- package/dist/{chunk-6VXHPKGG.js → chunk-QQ3YSL5F.js} +172 -16
- package/dist/chunk-RGKJKC5T.js +876 -0
- package/dist/{chunk-IFG4FRW5.js → chunk-RSEWEFAV.js} +12 -2
- package/dist/{chunk-2ABSVMGB.js → chunk-SMJZIK2O.js} +1 -1
- package/dist/{chunk-CP6BXI6F.js → chunk-U72NEGCT.js} +8818 -3829
- package/dist/{chunk-WC5LHBBA.js → chunk-Z4IKF23A.js} +11 -7
- package/dist/chunk-Z7OVQ6BC.js +713 -0
- package/dist/{chunk-6UWRT4VM.js → chunk-ZJSFX4RD.js} +175 -3
- package/dist/{cli-2DFENR62.js → cli-OKQHHSOE.js} +17 -23
- package/dist/{cli-YIOVSKOD.js → cli-VYSD2S4Z.js} +231 -82
- package/dist/cli.js +5 -5
- package/dist/{client-repo-PRU3VCQQ.js → client-repo-NNUCHQ2Y.js} +7 -5
- package/dist/create.js +5 -5
- package/dist/{fields-2NC7LSYE.js → fields-GTHE6TTS.js} +27 -3
- package/dist/gateway-DPPEQZT4.js +25 -0
- package/dist/grants-6JY4XZO7.js +27 -0
- package/dist/invoke-MRONRZ5Q.js +33 -0
- package/dist/moves-UAUCMWL5.js +36 -0
- package/dist/{order-PUWD65BC.js → order-RKLGT74L.js} +2 -2
- package/dist/{person-WIQQ7ITU.js → person-YOZTFV4Q.js} +11 -11
- package/dist/plan-on-sale-H4F26YIN.js +26 -0
- package/dist/platform/migrations/0610_waitlists.sql +54 -0
- package/dist/platform/migrations/0630_subscription_changes.sql +122 -0
- package/dist/platform/migrations/0650_person_links.sql +90 -0
- package/dist/platform/migrations/0670_unmoved_guard.sql +52 -0
- package/dist/platform/migrations/0690_sellable_refund_due.sql +98 -0
- package/dist/platform/migrations/0730_practitioners.sql +79 -0
- package/dist/platform/migrations/0750_routine_mail.sql +98 -0
- package/dist/platform/migrations/0770_clear_fixed_role_grants.sql +64 -0
- package/dist/platform/migrations/0810_recurrence_exceptions.sql +66 -0
- package/dist/platform/migrations/0811_staff_time.sql +109 -0
- package/dist/platform/migrations/0812_staff_offers.sql +112 -0
- package/dist/platform/migrations/0813_pay_periods.sql +241 -0
- package/dist/platform/migrations/0814_staff_feed.sql +47 -0
- package/dist/platform/migrations/0815_checklists.sql +237 -0
- package/dist/platform/migrations/0816_checklist_schedules.sql +121 -0
- package/dist/platform/migrations/0817_checklist_day_window.sql +35 -0
- package/dist/platform/migrations/0850_agreements.sql +271 -0
- package/dist/platform/migrations/0851_agreement_acceptances.sql +387 -0
- package/dist/platform/migrations/0853_agreement_enforcement.sql +58 -0
- package/dist/platform/migrations/0854_agreement_copy.sql +149 -0
- package/dist/platform/migrations/0855_agreement_retention.sql +279 -0
- package/dist/platform/migrations/0856_subscription_cooling_off.sql +159 -0
- package/dist/platform/migrations/0857_agreement_copy_guardian.sql +337 -0
- package/dist/platform/migrations/0858_agreement_desk.sql +175 -0
- package/dist/platform/migrations/0910_routine_messages.sql +99 -0
- package/dist/platform/migrations/0911_texts.sql +60 -0
- package/dist/platform/migrations/0913_contact_consent.sql +93 -0
- package/dist/platform/migrations/0916_contact_mailbox_index.sql +29 -0
- package/dist/platform/migrations/0930_stock_movements.sql +95 -0
- package/dist/platform/migrations/0931_stock_low.sql +25 -0
- package/dist/platform/migrations/0932_order_delivery.sql +78 -0
- package/dist/platform/migrations/0950_order_adjustments.sql +111 -0
- package/dist/platform/migrations/0951_order_price_guards.sql +33 -0
- package/dist/platform/migrations/0952_order_paid_another_way.sql +194 -0
- package/dist/platform/migrations/0953_discount_uses.sql +183 -0
- package/dist/platform/migrations/0955_folded_addresses.sql +92 -0
- package/dist/platform/migrations/0970_published_text.sql +59 -0
- package/dist/platform/migrations/0971_publish_acks.sql +68 -0
- package/dist/platform/migrations/0990_customer_email_change.sql +65 -0
- package/dist/platform/migrations/1010_intake_links.sql +148 -0
- package/dist/platform/migrations/1030_invoices.sql +747 -0
- package/dist/platform/migrations/1031_invoice_orders.sql +327 -0
- package/dist/platform/migrations/1050_inbox_conversations.sql +83 -0
- package/dist/platform/migrations/1090_staff_hours.sql +43 -0
- package/dist/platform/migrations/1091_staff_time_margins.sql +12 -0
- package/dist/platform/migrations/1092_client_guard.sql +26 -0
- package/dist/platform/migrations/1095_thing_time.sql +70 -0
- package/dist/platform/migrations/1130_devices.sql +162 -0
- package/dist/platform/migrations/1135_person_codes.sql +88 -0
- package/dist/platform/migrations/1150_finance_periods.sql +316 -0
- package/dist/platform/migrations/1151_payouts.sql +202 -0
- package/dist/platform/migrations/1153_finance_money_dates.sql +18 -0
- package/dist/platform/migrations/1170_journeys.sql +318 -0
- package/dist/platform/migrations/1171_person_birthday.sql +52 -0
- package/dist/platform/migrations/1175_person_signals.sql +29 -0
- package/dist/platform/migrations/1190_restricted_values.sql +25 -0
- package/dist/platform/migrations/1230_note_levels.sql +113 -0
- package/dist/platform/migrations/1231_person_carers.sql +33 -0
- package/dist/platform/migrations/1232_note_kinds.sql +122 -0
- package/dist/platform/migrations/1270_time_entries.sql +145 -0
- package/dist/platform/migrations/1271_leave.sql +249 -0
- package/dist/platform/migrations/1273_time_entry_reopened.sql +21 -0
- package/dist/platform/migrations/1330_accounting.sql +260 -0
- package/dist/platform/migrations/1350_customer_feed.sql +24 -0
- package/dist/platform/migrations/1390_locations.sql +77 -0
- package/dist/platform/migrations/1410_outside_copy.sql +213 -0
- package/dist/platform/migrations/1430_inbox_activities.sql +231 -0
- package/dist/platform/migrations/1450_wrong_guesses.sql +23 -0
- package/dist/platform/sdk/acknowledge.ts +100 -0
- package/dist/platform/sdk/agreements.ts +185 -0
- package/dist/platform/sdk/allowance.ts +98 -8
- package/dist/platform/sdk/automation-check.ts +120 -9
- package/dist/platform/sdk/automation.ts +78 -10
- package/dist/platform/sdk/behaviour.ts +26 -6
- package/dist/platform/sdk/calendar-entry.ts +258 -0
- package/dist/platform/sdk/capacity.ts +103 -2
- package/dist/platform/sdk/checklists.ts +118 -0
- package/dist/platform/sdk/contract.ts +514 -27
- package/dist/platform/sdk/discount.ts +408 -0
- package/dist/platform/sdk/document.ts +4 -2
- package/dist/platform/sdk/field-types.ts +5 -0
- package/dist/platform/sdk/formula/compile.ts +10 -0
- package/dist/platform/sdk/index.ts +17 -0
- package/dist/platform/sdk/intake.ts +380 -0
- package/dist/platform/sdk/journey-signals.ts +215 -0
- package/dist/platform/sdk/manifest.ts +1313 -66
- package/dist/platform/sdk/mine.ts +161 -0
- package/dist/platform/sdk/occupies.ts +192 -0
- package/dist/platform/sdk/questions.ts +681 -0
- package/dist/platform/sdk/recurring.ts +90 -9
- package/dist/platform/sdk/restricted-fields.ts +129 -0
- package/dist/platform/sdk/rich-text.ts +112 -0
- package/dist/platform/sdk/routine-mail.ts +1272 -0
- package/dist/platform/sdk/runtime.ts +25 -12
- package/dist/platform/sdk/screens.ts +91 -0
- package/dist/platform/sdk/sellable.ts +595 -1
- package/dist/platform/sdk/slug.ts +7 -2
- package/dist/platform/sdk/staffed.ts +474 -0
- package/dist/platform/sdk/states.ts +220 -64
- package/dist/platform/sdk/stock.ts +332 -0
- package/dist/platform/sdk/team.ts +83 -0
- package/dist/platform/sdk/testing.ts +70 -6
- package/dist/platform/sdk/worked-on.ts +134 -0
- package/dist/{products-2H5DR232.js → products-GCQLSZ3U.js} +2 -2
- package/dist/run-7ID64RA6.js +65 -0
- package/dist/run-FH7OGGTV.js +131 -0
- package/dist/run-OYZIAP6M.js +3363 -0
- package/dist/{run-Y7T4TVOL.js → run-QOFRRSZV.js} +41 -60
- package/dist/{run-PZUCSDDL.js → run-TJAEWR5U.js} +21 -51
- package/dist/{src-XTOD7EXW.js → src-52VERUPK.js} +312 -4
- package/dist/src-PHRELWN5.js +40 -0
- package/dist/visibility-SZCINPP4.js +58 -0
- package/package.json +2 -2
- package/dist/chunk-6GDEDOV7.js +0 -157
- package/dist/chunk-6UPUF4ML.js +0 -29998
- package/dist/chunk-7CQGMVDO.js +0 -63
- package/dist/chunk-GYSGVT6R.js +0 -284
- package/dist/chunk-JJHHNV46.js +0 -227
- package/dist/chunk-K6T42YCH.js +0 -704
- package/dist/chunk-M7A6FR2Z.js +0 -2586
- package/dist/chunk-O2UIZHND.js +0 -249
- package/dist/chunk-Q4N55M2Z.js +0 -552
- package/dist/chunk-QGGJ2G6Z.js +0 -349
- package/dist/chunk-R4W5XAUD.js +0 -837
- package/dist/chunk-TQFGGSA4.js +0 -748
- package/dist/chunk-YJJHF65I.js +0 -759
- package/dist/chunk-Z3RMMB6S.js +0 -668
- package/dist/grants-QXMKYMGB.js +0 -32
- package/dist/invoke-I3NNNXVL.js +0 -39
- package/dist/plan-on-sale-NB774CQL.js +0 -26
- package/dist/src-GYS6NBQB.js +0 -44
- package/dist/visibility-DLGHU4YN.js +0 -33
|
@@ -0,0 +1,962 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
MEDIA_FILE_TYPES,
|
|
4
|
+
MEDIA_KINDS,
|
|
5
|
+
MEDIA_TYPES,
|
|
6
|
+
MEDIA_VIDEO_TYPE
|
|
7
|
+
} from "./chunk-U72NEGCT.js";
|
|
8
|
+
|
|
9
|
+
// ../core/src/fields/types.ts
|
|
10
|
+
function defineObject(object) {
|
|
11
|
+
const names = /* @__PURE__ */ new Set();
|
|
12
|
+
for (const field of object.fields) {
|
|
13
|
+
if (names.has(field.name)) throw new Error(`${object.name}: duplicate field ${field.name}`);
|
|
14
|
+
names.add(field.name);
|
|
15
|
+
if ((field.filterable || field.sortable) && !field.column && !field.related) {
|
|
16
|
+
throw new Error(`${object.name}.${field.name}: filterable fields need a column or related`);
|
|
17
|
+
}
|
|
18
|
+
if (field.sortable && !field.column) {
|
|
19
|
+
throw new Error(`${object.name}.${field.name}: only single-valued fields can be sortable`);
|
|
20
|
+
}
|
|
21
|
+
if (field.type === "enum" && !field.enumValues?.length) {
|
|
22
|
+
throw new Error(`${object.name}.${field.name}: enum fields need enumValues`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!names.has(object.defaultSort.field)) {
|
|
26
|
+
throw new Error(`${object.name}: default sort field ${object.defaultSort.field} is unknown`);
|
|
27
|
+
}
|
|
28
|
+
return object;
|
|
29
|
+
}
|
|
30
|
+
function getField(object, name) {
|
|
31
|
+
return object.fields.find((field) => field.name === name);
|
|
32
|
+
}
|
|
33
|
+
function timelineFields(object) {
|
|
34
|
+
return object.fields.filter((field) => field.track === "timeline").map((field) => field.name);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ../core/src/fields/invoice.ts
|
|
38
|
+
var QUOTE_STATES = [
|
|
39
|
+
"draft",
|
|
40
|
+
"sent",
|
|
41
|
+
"accepted",
|
|
42
|
+
"declined",
|
|
43
|
+
"expired",
|
|
44
|
+
"withdrawn"
|
|
45
|
+
];
|
|
46
|
+
var INVOICE_STATES = [
|
|
47
|
+
"draft",
|
|
48
|
+
"issued",
|
|
49
|
+
"sent",
|
|
50
|
+
"part_paid",
|
|
51
|
+
"paid",
|
|
52
|
+
"credited",
|
|
53
|
+
"void"
|
|
54
|
+
];
|
|
55
|
+
var INVOICE_KINDS = ["standard", "deposit", "final"];
|
|
56
|
+
var CREDIT_NOTE_STATES = ["draft", "issued"];
|
|
57
|
+
var TAX_MODES = ["exclusive", "inclusive"];
|
|
58
|
+
var LABELS = {
|
|
59
|
+
draft: "Draft",
|
|
60
|
+
sent: "Sent",
|
|
61
|
+
accepted: "Accepted",
|
|
62
|
+
declined: "Declined",
|
|
63
|
+
expired: "Expired",
|
|
64
|
+
withdrawn: "Withdrawn",
|
|
65
|
+
issued: "Issued",
|
|
66
|
+
part_paid: "Part paid",
|
|
67
|
+
paid: "Paid",
|
|
68
|
+
credited: "Credited",
|
|
69
|
+
void: "Void",
|
|
70
|
+
standard: "Standard",
|
|
71
|
+
deposit: "Deposit",
|
|
72
|
+
final: "Final",
|
|
73
|
+
exclusive: "Amounts without tax",
|
|
74
|
+
inclusive: "Amounts with tax"
|
|
75
|
+
};
|
|
76
|
+
var id = { type: "id", filterable: true, sortable: false };
|
|
77
|
+
var amount = { type: "number", filterable: true, sortable: true };
|
|
78
|
+
var when = { type: "datetime", filterable: true, sortable: true };
|
|
79
|
+
var day = { type: "date", filterable: true, sortable: true };
|
|
80
|
+
var text = (name, label, column) => ({ name, label, type: "text", column, filterable: true, sortable: false });
|
|
81
|
+
var choice = (name, label, column, values) => ({
|
|
82
|
+
name,
|
|
83
|
+
label,
|
|
84
|
+
type: "enum",
|
|
85
|
+
enumValues: values,
|
|
86
|
+
column,
|
|
87
|
+
filterable: true,
|
|
88
|
+
sortable: true,
|
|
89
|
+
options: { choices: values.map((value) => ({ value, label: LABELS[value] ?? value })) }
|
|
90
|
+
});
|
|
91
|
+
var person = {
|
|
92
|
+
...id,
|
|
93
|
+
name: "personId",
|
|
94
|
+
label: "Person",
|
|
95
|
+
column: "person_id",
|
|
96
|
+
fieldType: "relation",
|
|
97
|
+
options: { to: "person" }
|
|
98
|
+
};
|
|
99
|
+
var organisation = {
|
|
100
|
+
...id,
|
|
101
|
+
name: "organisationId",
|
|
102
|
+
label: "Organisation",
|
|
103
|
+
column: "organisation_id",
|
|
104
|
+
fieldType: "relation",
|
|
105
|
+
options: { to: "organisation" }
|
|
106
|
+
};
|
|
107
|
+
var totals = [
|
|
108
|
+
{ ...amount, name: "netTotal", label: "Net", column: "net_total" },
|
|
109
|
+
{ ...amount, name: "taxTotal", label: "Tax", column: "tax_total" },
|
|
110
|
+
{ ...amount, name: "total", label: "Total", column: "total" }
|
|
111
|
+
];
|
|
112
|
+
var stamps = [
|
|
113
|
+
{ ...when, name: "createdAt", label: "Created", column: "created_at" },
|
|
114
|
+
{ ...when, name: "updatedAt", label: "Updated", column: "updated_at" }
|
|
115
|
+
];
|
|
116
|
+
var quoteObject = defineObject({
|
|
117
|
+
name: "quote",
|
|
118
|
+
label: "Quote",
|
|
119
|
+
plural: "Quotes",
|
|
120
|
+
source: "rec_quote",
|
|
121
|
+
titleField: "number",
|
|
122
|
+
defaultSort: { field: "createdAt", direction: "desc" },
|
|
123
|
+
fields: [
|
|
124
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
125
|
+
text("number", "Number", "number"),
|
|
126
|
+
choice("state", "State", "state", QUOTE_STATES),
|
|
127
|
+
text("currency", "Currency", "currency"),
|
|
128
|
+
choice("taxMode", "Amounts", "tax_mode", TAX_MODES),
|
|
129
|
+
person,
|
|
130
|
+
organisation,
|
|
131
|
+
text("aboutObject", "About (object)", "about_object"),
|
|
132
|
+
{ ...id, name: "aboutId", label: "About", column: "about_id" },
|
|
133
|
+
{ ...day, name: "validUntil", label: "Valid until", column: "valid_until" },
|
|
134
|
+
choice("depositKind", "Deposit", "deposit_kind", ["none", "amount", "percent"]),
|
|
135
|
+
{ ...amount, name: "depositValue", label: "Deposit value", column: "deposit_value" },
|
|
136
|
+
...totals,
|
|
137
|
+
{ ...id, name: "replacesQuoteId", label: "Replaces", column: "replaces_quote_id" },
|
|
138
|
+
{ ...when, name: "sentAt", label: "Sent", column: "sent_at" },
|
|
139
|
+
{ ...when, name: "acceptedAt", label: "Accepted", column: "accepted_at" },
|
|
140
|
+
{ ...when, name: "declinedAt", label: "Declined", column: "declined_at" },
|
|
141
|
+
{ ...when, name: "withdrawnAt", label: "Withdrawn", column: "withdrawn_at" },
|
|
142
|
+
{ ...when, name: "expiredAt", label: "Expired", column: "expired_at" },
|
|
143
|
+
...stamps
|
|
144
|
+
]
|
|
145
|
+
});
|
|
146
|
+
var invoiceObject = defineObject({
|
|
147
|
+
name: "invoice",
|
|
148
|
+
label: "Invoice",
|
|
149
|
+
plural: "Invoices",
|
|
150
|
+
source: "rec_invoice",
|
|
151
|
+
titleField: "number",
|
|
152
|
+
defaultSort: { field: "createdAt", direction: "desc" },
|
|
153
|
+
fields: [
|
|
154
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
155
|
+
text("number", "Number", "number"),
|
|
156
|
+
choice("state", "State", "state", INVOICE_STATES),
|
|
157
|
+
choice("kind", "Kind", "kind", INVOICE_KINDS),
|
|
158
|
+
text("currency", "Currency", "currency"),
|
|
159
|
+
choice("taxMode", "Amounts", "tax_mode", TAX_MODES),
|
|
160
|
+
person,
|
|
161
|
+
organisation,
|
|
162
|
+
text("aboutObject", "About (object)", "about_object"),
|
|
163
|
+
{ ...id, name: "aboutId", label: "About", column: "about_id" },
|
|
164
|
+
{ ...id, name: "quoteId", label: "Quote", column: "quote_id" },
|
|
165
|
+
{ ...id, name: "orderId", label: "Order", column: "order_id" },
|
|
166
|
+
{
|
|
167
|
+
...amount,
|
|
168
|
+
name: "paymentTermsDays",
|
|
169
|
+
label: "Payment terms (days)",
|
|
170
|
+
column: "payment_terms_days"
|
|
171
|
+
},
|
|
172
|
+
{ ...day, name: "issuedOn", label: "Issued on", column: "issued_on" },
|
|
173
|
+
{ ...day, name: "dueOn", label: "Due", column: "due_on" },
|
|
174
|
+
{ ...when, name: "issuedAt", label: "Issued", column: "issued_at" },
|
|
175
|
+
{ ...when, name: "sentAt", label: "Sent", column: "sent_at" },
|
|
176
|
+
{
|
|
177
|
+
name: "allowPartPayments",
|
|
178
|
+
label: "Part payments online",
|
|
179
|
+
type: "boolean",
|
|
180
|
+
column: "allow_part_payments",
|
|
181
|
+
filterable: true,
|
|
182
|
+
sortable: false
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "remindersPaused",
|
|
186
|
+
label: "Reminders paused",
|
|
187
|
+
type: "boolean",
|
|
188
|
+
column: "reminders_paused",
|
|
189
|
+
filterable: true,
|
|
190
|
+
sortable: false
|
|
191
|
+
},
|
|
192
|
+
...totals,
|
|
193
|
+
...stamps
|
|
194
|
+
]
|
|
195
|
+
});
|
|
196
|
+
var creditNoteObject = defineObject({
|
|
197
|
+
name: "creditNote",
|
|
198
|
+
label: "Credit note",
|
|
199
|
+
plural: "Credit notes",
|
|
200
|
+
source: "rec_credit_note",
|
|
201
|
+
titleField: "number",
|
|
202
|
+
defaultSort: { field: "createdAt", direction: "desc" },
|
|
203
|
+
fields: [
|
|
204
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
205
|
+
text("number", "Number", "number"),
|
|
206
|
+
choice("state", "State", "state", CREDIT_NOTE_STATES),
|
|
207
|
+
{ ...id, name: "invoiceId", label: "Invoice", column: "invoice_id" },
|
|
208
|
+
text("currency", "Currency", "currency"),
|
|
209
|
+
choice("taxMode", "Amounts", "tax_mode", TAX_MODES),
|
|
210
|
+
person,
|
|
211
|
+
organisation,
|
|
212
|
+
choice("settle", "Settles by", "settle", ["reduce", "refund", "both"]),
|
|
213
|
+
{ ...day, name: "issuedOn", label: "Issued on", column: "issued_on" },
|
|
214
|
+
{ ...when, name: "issuedAt", label: "Issued", column: "issued_at" },
|
|
215
|
+
...totals,
|
|
216
|
+
...stamps
|
|
217
|
+
]
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// ../core/src/fields/location.ts
|
|
221
|
+
var LOCATION_STATES = ["open", "closed"];
|
|
222
|
+
var MAIN_LOCATION_FALLBACK = "Main location";
|
|
223
|
+
var MAIN_LOCATION_ID = "loc_00000000000000000000000001";
|
|
224
|
+
var locationObject = defineObject({
|
|
225
|
+
name: "location",
|
|
226
|
+
label: "Location",
|
|
227
|
+
plural: "Locations",
|
|
228
|
+
source: "rec_location",
|
|
229
|
+
titleField: "name",
|
|
230
|
+
defaultSort: { field: "name", direction: "asc" },
|
|
231
|
+
public: {
|
|
232
|
+
read: ["name", "shortName", "address", "timezone"],
|
|
233
|
+
when: { field: "listed", in: ["yes"] }
|
|
234
|
+
},
|
|
235
|
+
fields: [
|
|
236
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
237
|
+
{
|
|
238
|
+
name: "name",
|
|
239
|
+
label: "Name",
|
|
240
|
+
type: "text",
|
|
241
|
+
column: "name",
|
|
242
|
+
filterable: true,
|
|
243
|
+
sortable: true,
|
|
244
|
+
required: true
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: "shortName",
|
|
248
|
+
label: "Short name",
|
|
249
|
+
type: "text",
|
|
250
|
+
column: "short_name",
|
|
251
|
+
filterable: true,
|
|
252
|
+
sortable: true
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: "address",
|
|
256
|
+
label: "Address",
|
|
257
|
+
type: "text",
|
|
258
|
+
column: "address",
|
|
259
|
+
filterable: true,
|
|
260
|
+
sortable: false
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: "timezone",
|
|
264
|
+
label: "Time zone",
|
|
265
|
+
type: "text",
|
|
266
|
+
column: "timezone",
|
|
267
|
+
filterable: true,
|
|
268
|
+
sortable: true,
|
|
269
|
+
required: true
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: "public",
|
|
273
|
+
label: "Shown to the public",
|
|
274
|
+
type: "boolean",
|
|
275
|
+
column: "public",
|
|
276
|
+
filterable: true,
|
|
277
|
+
sortable: true
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: "dropInPrice",
|
|
281
|
+
label: "Drop-in price",
|
|
282
|
+
type: "number",
|
|
283
|
+
column: "drop_in_price",
|
|
284
|
+
filterable: true,
|
|
285
|
+
sortable: true
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: "state",
|
|
289
|
+
label: "State",
|
|
290
|
+
type: "enum",
|
|
291
|
+
enumValues: LOCATION_STATES,
|
|
292
|
+
column: "state",
|
|
293
|
+
filterable: true,
|
|
294
|
+
sortable: true
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
name: "notes",
|
|
298
|
+
label: "Notes",
|
|
299
|
+
type: "text",
|
|
300
|
+
column: "notes",
|
|
301
|
+
filterable: true,
|
|
302
|
+
sortable: false
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: "main",
|
|
306
|
+
label: "Main location",
|
|
307
|
+
type: "boolean",
|
|
308
|
+
column: "main",
|
|
309
|
+
filterable: true,
|
|
310
|
+
sortable: true,
|
|
311
|
+
readOnly: true
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
// Shown to the public and open: the condition of the public declaration (ADR 0916).
|
|
315
|
+
name: "listed",
|
|
316
|
+
label: "Listed",
|
|
317
|
+
type: "enum",
|
|
318
|
+
enumValues: ["yes", "no"],
|
|
319
|
+
fieldType: "select",
|
|
320
|
+
options: {
|
|
321
|
+
choices: [
|
|
322
|
+
{ value: "yes", label: "Yes" },
|
|
323
|
+
{ value: "no", label: "No" }
|
|
324
|
+
]
|
|
325
|
+
},
|
|
326
|
+
column: "listed",
|
|
327
|
+
filterable: true,
|
|
328
|
+
sortable: false,
|
|
329
|
+
readOnly: true
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: "createdAt",
|
|
333
|
+
label: "Created",
|
|
334
|
+
type: "datetime",
|
|
335
|
+
column: "created_at",
|
|
336
|
+
filterable: true,
|
|
337
|
+
sortable: true
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: "updatedAt",
|
|
341
|
+
label: "Updated",
|
|
342
|
+
type: "datetime",
|
|
343
|
+
column: "updated_at",
|
|
344
|
+
filterable: true,
|
|
345
|
+
sortable: true
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// ../core/src/fields/media.ts
|
|
351
|
+
var ITEM_TYPES = [...MEDIA_TYPES, ...MEDIA_FILE_TYPES, MEDIA_VIDEO_TYPE];
|
|
352
|
+
var mediaObject = defineObject({
|
|
353
|
+
name: "media",
|
|
354
|
+
label: "Media",
|
|
355
|
+
plural: "Media",
|
|
356
|
+
source: "rec_media",
|
|
357
|
+
titleField: "name",
|
|
358
|
+
defaultSort: { field: "createdAt", direction: "desc" },
|
|
359
|
+
fields: [
|
|
360
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
361
|
+
{ name: "name", label: "Name", type: "text", column: "name", filterable: true, sortable: true },
|
|
362
|
+
{
|
|
363
|
+
name: "kind",
|
|
364
|
+
label: "Kind",
|
|
365
|
+
type: "enum",
|
|
366
|
+
enumValues: MEDIA_KINDS,
|
|
367
|
+
column: "kind",
|
|
368
|
+
filterable: true,
|
|
369
|
+
sortable: true
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
name: "type",
|
|
373
|
+
label: "Type",
|
|
374
|
+
type: "enum",
|
|
375
|
+
enumValues: ITEM_TYPES,
|
|
376
|
+
column: "type",
|
|
377
|
+
filterable: true,
|
|
378
|
+
sortable: true
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
name: "bytes",
|
|
382
|
+
label: "Size",
|
|
383
|
+
type: "number",
|
|
384
|
+
column: "bytes",
|
|
385
|
+
filterable: true,
|
|
386
|
+
sortable: true
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
name: "width",
|
|
390
|
+
label: "Width",
|
|
391
|
+
type: "number",
|
|
392
|
+
column: "width",
|
|
393
|
+
filterable: true,
|
|
394
|
+
sortable: true
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
name: "height",
|
|
398
|
+
label: "Height",
|
|
399
|
+
type: "number",
|
|
400
|
+
column: "height",
|
|
401
|
+
filterable: true,
|
|
402
|
+
sortable: true
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
name: "state",
|
|
406
|
+
label: "State",
|
|
407
|
+
type: "enum",
|
|
408
|
+
enumValues: ["uploading", "processing", "ready", "failed"],
|
|
409
|
+
column: "state",
|
|
410
|
+
filterable: true,
|
|
411
|
+
sortable: true
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
name: "duration",
|
|
415
|
+
label: "Duration (seconds)",
|
|
416
|
+
type: "number",
|
|
417
|
+
column: "duration",
|
|
418
|
+
filterable: true,
|
|
419
|
+
sortable: true
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
name: "alt",
|
|
423
|
+
label: "Alt text",
|
|
424
|
+
type: "text",
|
|
425
|
+
column: "alt",
|
|
426
|
+
filterable: true,
|
|
427
|
+
sortable: false
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "createdAt",
|
|
431
|
+
label: "Uploaded",
|
|
432
|
+
type: "datetime",
|
|
433
|
+
column: "created_at",
|
|
434
|
+
filterable: true,
|
|
435
|
+
sortable: true
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
name: "createdBy",
|
|
439
|
+
label: "Uploaded by",
|
|
440
|
+
type: "id",
|
|
441
|
+
column: "created_by",
|
|
442
|
+
filterable: true,
|
|
443
|
+
sortable: false
|
|
444
|
+
}
|
|
445
|
+
]
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
// ../core/src/fields/subscription.ts
|
|
449
|
+
var SUBSCRIPTION_STATES = [
|
|
450
|
+
"incomplete",
|
|
451
|
+
"expired",
|
|
452
|
+
"trialing",
|
|
453
|
+
"active",
|
|
454
|
+
"past_due",
|
|
455
|
+
"unpaid",
|
|
456
|
+
"paused",
|
|
457
|
+
"ended"
|
|
458
|
+
];
|
|
459
|
+
var STATE_LABELS = {
|
|
460
|
+
incomplete: "Incomplete",
|
|
461
|
+
expired: "Expired",
|
|
462
|
+
trialing: "Trial",
|
|
463
|
+
active: "Active",
|
|
464
|
+
past_due: "Past due",
|
|
465
|
+
unpaid: "Unpaid",
|
|
466
|
+
paused: "Paused",
|
|
467
|
+
ended: "Ended"
|
|
468
|
+
};
|
|
469
|
+
var LIVE = ["incomplete", "trialing", "active", "past_due", "unpaid", "paused"];
|
|
470
|
+
var others = (state) => LIVE.filter((s) => s !== state);
|
|
471
|
+
var SUBSCRIPTION_MACHINE = {
|
|
472
|
+
field: "state",
|
|
473
|
+
initial: "incomplete",
|
|
474
|
+
moves: [
|
|
475
|
+
{ from: others("trialing"), to: "trialing", by: ["host"] },
|
|
476
|
+
{ from: others("active"), to: "active", by: ["host"] },
|
|
477
|
+
{ from: others("past_due"), to: "past_due", by: ["host"] },
|
|
478
|
+
{ from: others("unpaid"), to: "unpaid", by: ["host"] },
|
|
479
|
+
{ from: others("paused"), to: "paused", by: ["host"] },
|
|
480
|
+
// The first payment never succeeded within the provider's 23 hours.
|
|
481
|
+
{ from: "incomplete", to: "expired", by: ["host"], final: true },
|
|
482
|
+
{ from: [...LIVE], to: "ended", by: ["host"], final: true }
|
|
483
|
+
]
|
|
484
|
+
};
|
|
485
|
+
var id2 = { type: "id", filterable: true, sortable: false };
|
|
486
|
+
var amount2 = { type: "number", filterable: true, sortable: true };
|
|
487
|
+
var when2 = { type: "datetime", filterable: true, sortable: true };
|
|
488
|
+
var text2 = (name, label, column) => ({ name, label, type: "text", column, filterable: true, sortable: false });
|
|
489
|
+
var subscriptionObject = defineObject({
|
|
490
|
+
name: "subscription",
|
|
491
|
+
label: "Subscription",
|
|
492
|
+
plural: "Subscriptions",
|
|
493
|
+
source: "rec_subscription",
|
|
494
|
+
titleField: "planTitle",
|
|
495
|
+
defaultSort: { field: "createdAt", direction: "desc" },
|
|
496
|
+
states: SUBSCRIPTION_MACHINE,
|
|
497
|
+
customer: {
|
|
498
|
+
field: "payerPersonId",
|
|
499
|
+
read: [
|
|
500
|
+
"holderPersonId",
|
|
501
|
+
"planObject",
|
|
502
|
+
"planId",
|
|
503
|
+
"planTitle",
|
|
504
|
+
"amount",
|
|
505
|
+
"currency",
|
|
506
|
+
"interval",
|
|
507
|
+
"taxed",
|
|
508
|
+
"state",
|
|
509
|
+
"trialEnd",
|
|
510
|
+
"currentPeriodStart",
|
|
511
|
+
"currentPeriodEnd",
|
|
512
|
+
"cancelAtPeriodEnd",
|
|
513
|
+
"cancelAt",
|
|
514
|
+
"canceledAt",
|
|
515
|
+
"endedAt",
|
|
516
|
+
"actionUrl",
|
|
517
|
+
"createdAt",
|
|
518
|
+
// The change it shows (stage 32b, ADRs 0530, 0531): the payer's own plan change or pause.
|
|
519
|
+
"changeId",
|
|
520
|
+
"changeKind",
|
|
521
|
+
"changeState",
|
|
522
|
+
"changeToPlanId",
|
|
523
|
+
"changeToPlanTitle",
|
|
524
|
+
"changeToAmount",
|
|
525
|
+
"pauseFrom",
|
|
526
|
+
"pauseUntil",
|
|
527
|
+
"changeEffectiveAt",
|
|
528
|
+
"changeRequestedAt",
|
|
529
|
+
"changeCallOutcome",
|
|
530
|
+
"changeActionUrl",
|
|
531
|
+
"changeEndOutcome"
|
|
532
|
+
],
|
|
533
|
+
write: []
|
|
534
|
+
},
|
|
535
|
+
fields: [
|
|
536
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
537
|
+
{
|
|
538
|
+
...id2,
|
|
539
|
+
name: "payerPersonId",
|
|
540
|
+
label: "Payer",
|
|
541
|
+
column: "payer_person_id",
|
|
542
|
+
fieldType: "relation",
|
|
543
|
+
options: { to: "person" }
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
...id2,
|
|
547
|
+
name: "holderPersonId",
|
|
548
|
+
label: "Holder",
|
|
549
|
+
column: "holder_person_id",
|
|
550
|
+
fieldType: "relation",
|
|
551
|
+
options: { to: "person" }
|
|
552
|
+
},
|
|
553
|
+
text2("email", "Email", "email"),
|
|
554
|
+
{
|
|
555
|
+
name: "placedAs",
|
|
556
|
+
label: "Started by",
|
|
557
|
+
type: "enum",
|
|
558
|
+
enumValues: ["customer", "public", "staff"],
|
|
559
|
+
column: "placed_as",
|
|
560
|
+
filterable: true,
|
|
561
|
+
sortable: false
|
|
562
|
+
},
|
|
563
|
+
text2("planObject", "Plan's object", "plan_object"),
|
|
564
|
+
{ ...id2, name: "planId", label: "Plan", column: "plan_id" },
|
|
565
|
+
text2("planTitle", "Plan", "plan_title"),
|
|
566
|
+
{ ...amount2, name: "amount", label: "Price per period", column: "amount" },
|
|
567
|
+
text2("currency", "Currency", "currency"),
|
|
568
|
+
{
|
|
569
|
+
name: "interval",
|
|
570
|
+
label: "Every",
|
|
571
|
+
type: "enum",
|
|
572
|
+
enumValues: ["week", "month", "year"],
|
|
573
|
+
column: "interval",
|
|
574
|
+
filterable: true,
|
|
575
|
+
sortable: false
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
name: "taxed",
|
|
579
|
+
label: "Taxed",
|
|
580
|
+
type: "boolean",
|
|
581
|
+
column: "taxed",
|
|
582
|
+
filterable: true,
|
|
583
|
+
sortable: false
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: "state",
|
|
587
|
+
label: "State",
|
|
588
|
+
type: "enum",
|
|
589
|
+
enumValues: SUBSCRIPTION_STATES,
|
|
590
|
+
column: "state",
|
|
591
|
+
filterable: true,
|
|
592
|
+
sortable: true,
|
|
593
|
+
options: {
|
|
594
|
+
choices: SUBSCRIPTION_STATES.map((value) => ({ value, label: STATE_LABELS[value] }))
|
|
595
|
+
}
|
|
596
|
+
},
|
|
597
|
+
text2("provider", "Provider", "provider"),
|
|
598
|
+
text2("providerRef", "Provider's reference", "provider_ref"),
|
|
599
|
+
{ ...when2, name: "trialEnd", label: "Trial ends", column: "trial_end" },
|
|
600
|
+
{ ...when2, name: "currentPeriodStart", label: "Period from", column: "current_period_start" },
|
|
601
|
+
{ ...when2, name: "currentPeriodEnd", label: "Period to", column: "current_period_end" },
|
|
602
|
+
{
|
|
603
|
+
name: "cancelAtPeriodEnd",
|
|
604
|
+
label: "Ends at period end",
|
|
605
|
+
type: "boolean",
|
|
606
|
+
column: "cancel_at_period_end",
|
|
607
|
+
filterable: true,
|
|
608
|
+
sortable: false
|
|
609
|
+
},
|
|
610
|
+
// A date set at the provider another way (its dashboard): the host's resume cannot undo it.
|
|
611
|
+
{ ...when2, name: "cancelAt", label: "Ends on", column: "cancel_at" },
|
|
612
|
+
{ ...when2, name: "canceledAt", label: "Cancelled on", column: "canceled_at" },
|
|
613
|
+
{ ...when2, name: "endedAt", label: "Ended on", column: "ended_at" },
|
|
614
|
+
text2("endReason", "Why it ended", "end_reason"),
|
|
615
|
+
text2("actionUrl", "Confirm payment at", "action_url"),
|
|
616
|
+
{ ...when2, name: "failingSince", label: "Failing since", column: "failing_since" },
|
|
617
|
+
{ ...when2, name: "createdAt", label: "Started", column: "created_at" },
|
|
618
|
+
// Stage 32b (migration 0630): the plan change or pause it shows, asked for and not yet over,
|
|
619
|
+
// or the pause it is in. Written by the host only (core_subscription_change).
|
|
620
|
+
text2("changeId", "Change", "change_id"),
|
|
621
|
+
{
|
|
622
|
+
name: "changeKind",
|
|
623
|
+
label: "Change",
|
|
624
|
+
type: "enum",
|
|
625
|
+
enumValues: ["upgrade", "downgrade", "pause"],
|
|
626
|
+
column: "change_kind",
|
|
627
|
+
filterable: true,
|
|
628
|
+
sortable: false
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
name: "changeState",
|
|
632
|
+
label: "Change state",
|
|
633
|
+
type: "enum",
|
|
634
|
+
enumValues: ["requested", "waiting", "applied", "lapsed", "withdrawn"],
|
|
635
|
+
column: "change_state",
|
|
636
|
+
filterable: true,
|
|
637
|
+
sortable: false
|
|
638
|
+
},
|
|
639
|
+
{ ...id2, name: "changeToPlanId", label: "Changing to", column: "change_to_plan_id" },
|
|
640
|
+
text2("changeToPlanTitle", "Changing to", "change_to_plan_title"),
|
|
641
|
+
{ ...amount2, name: "changeToAmount", label: "New price", column: "change_to_amount" },
|
|
642
|
+
{ ...when2, name: "pauseFrom", label: "Paused from", column: "pause_from" },
|
|
643
|
+
{ ...when2, name: "pauseUntil", label: "Paused until", column: "pause_until" },
|
|
644
|
+
{ ...when2, name: "changeEffectiveAt", label: "Change from", column: "change_effective_at" },
|
|
645
|
+
{ ...when2, name: "changeRequestedAt", label: "Change asked", column: "change_requested_at" },
|
|
646
|
+
{
|
|
647
|
+
name: "changeCallOutcome",
|
|
648
|
+
label: "Provider's answer",
|
|
649
|
+
type: "enum",
|
|
650
|
+
enumValues: ["sent", "pending", "unknown", "refused"],
|
|
651
|
+
column: "change_call_outcome",
|
|
652
|
+
filterable: true,
|
|
653
|
+
sortable: false
|
|
654
|
+
},
|
|
655
|
+
text2("changeActionUrl", "Confirm the change's payment at", "change_action_url"),
|
|
656
|
+
{
|
|
657
|
+
name: "changeEndOutcome",
|
|
658
|
+
label: "Ending it: provider's answer",
|
|
659
|
+
type: "enum",
|
|
660
|
+
enumValues: ["sent", "pending", "unknown", "refused"],
|
|
661
|
+
column: "change_end_outcome",
|
|
662
|
+
filterable: true,
|
|
663
|
+
sortable: false
|
|
664
|
+
},
|
|
665
|
+
{ ...when2, name: "updatedAt", label: "Updated", column: "updated_at" }
|
|
666
|
+
]
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
// ../core/src/fields/order.ts
|
|
670
|
+
var ORDER_STATES = [
|
|
671
|
+
"pending",
|
|
672
|
+
"part_paid",
|
|
673
|
+
"paid",
|
|
674
|
+
"cancelled",
|
|
675
|
+
"expired",
|
|
676
|
+
"refunded"
|
|
677
|
+
];
|
|
678
|
+
var STATE_LABELS2 = {
|
|
679
|
+
pending: "Pending",
|
|
680
|
+
part_paid: "Part paid",
|
|
681
|
+
paid: "Paid",
|
|
682
|
+
cancelled: "Cancelled",
|
|
683
|
+
expired: "Expired",
|
|
684
|
+
refunded: "Refunded"
|
|
685
|
+
};
|
|
686
|
+
var ORDER_MACHINE = {
|
|
687
|
+
field: "state",
|
|
688
|
+
initial: "pending",
|
|
689
|
+
moves: [
|
|
690
|
+
// Only a verified payment, or one the host applied (ADR 0694), marks an order paid.
|
|
691
|
+
{ from: ["pending", "part_paid", "expired"], to: "paid", by: ["host"] },
|
|
692
|
+
// A late deposit staff honour (ADR 0429) makes an expired order part paid; a recorded payment
|
|
693
|
+
// entered in error and reversed (ADR 0694) leaves a paid one part paid, its balance owed.
|
|
694
|
+
{ from: ["pending", "expired", "paid"], to: "part_paid", by: ["host"] },
|
|
695
|
+
// An invoice's order whose recorded payments were all reversed is unpaid again (stage 35,
|
|
696
|
+
// ADR 0733): the host's move, in the reversal's batch. What was granted stays.
|
|
697
|
+
{ from: ["paid", "part_paid"], to: "pending", by: ["host"] },
|
|
698
|
+
// A buyer may give up an order they have paid nothing on. Once money is on it, staff cancel.
|
|
699
|
+
// The host too (ADR 0560): a drop-in booking that leaves its held place another way (its
|
|
700
|
+
// class cancelled) cancels its unpaid order in the same batch.
|
|
701
|
+
{ from: "pending", to: "cancelled", by: ["staff", "customer", "host"], final: true },
|
|
702
|
+
{ from: "part_paid", to: "cancelled", by: ["staff"], final: true },
|
|
703
|
+
// Not final: a late payment staff choose to honour makes it paid.
|
|
704
|
+
{ from: "pending", to: "expired", by: ["host"] },
|
|
705
|
+
{ from: "paid", to: "refunded", by: ["host"], final: true }
|
|
706
|
+
]
|
|
707
|
+
};
|
|
708
|
+
var id3 = { type: "id", filterable: true, sortable: false };
|
|
709
|
+
var amount3 = { type: "number", filterable: true, sortable: true };
|
|
710
|
+
var when3 = { type: "datetime", filterable: true, sortable: true };
|
|
711
|
+
var orderObject = defineObject({
|
|
712
|
+
name: "order",
|
|
713
|
+
label: "Order",
|
|
714
|
+
plural: "Orders",
|
|
715
|
+
source: "rec_order",
|
|
716
|
+
defaultSort: { field: "createdAt", direction: "desc" },
|
|
717
|
+
states: ORDER_MACHINE,
|
|
718
|
+
customer: {
|
|
719
|
+
field: "personId",
|
|
720
|
+
read: [
|
|
721
|
+
"state",
|
|
722
|
+
"currency",
|
|
723
|
+
"total",
|
|
724
|
+
"paid",
|
|
725
|
+
"balance",
|
|
726
|
+
"refunded",
|
|
727
|
+
"pay",
|
|
728
|
+
"deposit",
|
|
729
|
+
"balanceDueAt",
|
|
730
|
+
"expiresAt",
|
|
731
|
+
"paidAt",
|
|
732
|
+
"createdAt",
|
|
733
|
+
"taxAmount",
|
|
734
|
+
"taxRefunded",
|
|
735
|
+
"taxCountry",
|
|
736
|
+
"subscriptionId",
|
|
737
|
+
"periodStart",
|
|
738
|
+
"periodEnd",
|
|
739
|
+
"discount"
|
|
740
|
+
],
|
|
741
|
+
write: []
|
|
742
|
+
},
|
|
743
|
+
fields: [
|
|
744
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
745
|
+
{
|
|
746
|
+
...id3,
|
|
747
|
+
name: "personId",
|
|
748
|
+
label: "Person",
|
|
749
|
+
column: "person_id",
|
|
750
|
+
// What the customer declaration needs to know: this is whose order it is.
|
|
751
|
+
fieldType: "relation",
|
|
752
|
+
options: { to: "person" }
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
name: "email",
|
|
756
|
+
label: "Email",
|
|
757
|
+
type: "text",
|
|
758
|
+
column: "email",
|
|
759
|
+
filterable: true,
|
|
760
|
+
sortable: false
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
name: "state",
|
|
764
|
+
label: "State",
|
|
765
|
+
type: "enum",
|
|
766
|
+
enumValues: ORDER_STATES,
|
|
767
|
+
column: "state",
|
|
768
|
+
filterable: true,
|
|
769
|
+
sortable: true,
|
|
770
|
+
options: {
|
|
771
|
+
choices: ORDER_STATES.map((value) => ({ value, label: STATE_LABELS2[value] }))
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
name: "currency",
|
|
776
|
+
label: "Currency",
|
|
777
|
+
type: "text",
|
|
778
|
+
column: "currency",
|
|
779
|
+
filterable: true,
|
|
780
|
+
sortable: false
|
|
781
|
+
},
|
|
782
|
+
{ ...amount3, name: "total", label: "Total", column: "total" },
|
|
783
|
+
{ ...amount3, name: "paid", label: "Paid", column: "paid" },
|
|
784
|
+
{ ...amount3, name: "balance", label: "Balance", column: "balance" },
|
|
785
|
+
{ ...amount3, name: "refunded", label: "Refunded", column: "refunded" },
|
|
786
|
+
{
|
|
787
|
+
name: "pay",
|
|
788
|
+
label: "Paying",
|
|
789
|
+
type: "enum",
|
|
790
|
+
enumValues: ["full", "deposit"],
|
|
791
|
+
column: "pay",
|
|
792
|
+
filterable: true,
|
|
793
|
+
sortable: false
|
|
794
|
+
},
|
|
795
|
+
{ ...amount3, name: "deposit", label: "Deposit", column: "deposit" },
|
|
796
|
+
{ ...when3, name: "balanceDueAt", label: "Balance due", column: "balance_due_at" },
|
|
797
|
+
{ ...when3, name: "expiresAt", label: "Expires", column: "expires_at" },
|
|
798
|
+
{
|
|
799
|
+
name: "placedAs",
|
|
800
|
+
label: "Placed by",
|
|
801
|
+
type: "enum",
|
|
802
|
+
enumValues: ["customer", "public", "staff"],
|
|
803
|
+
column: "placed_as",
|
|
804
|
+
filterable: true,
|
|
805
|
+
sortable: false
|
|
806
|
+
},
|
|
807
|
+
{ ...when3, name: "paidAt", label: "Paid on", column: "paid_at" },
|
|
808
|
+
{ ...when3, name: "cancelledAt", label: "Cancelled on", column: "cancelled_at" },
|
|
809
|
+
{ ...when3, name: "refundedAt", label: "Refunded on", column: "refunded_at" },
|
|
810
|
+
{ ...when3, name: "createdAt", label: "Created", column: "created_at" },
|
|
811
|
+
{ ...when3, name: "updatedAt", label: "Updated", column: "updated_at" },
|
|
812
|
+
// Tax at checkout (ADR 0479): the provider's figures, inside the amounts above.
|
|
813
|
+
{ ...amount3, name: "taxAmount", label: "Tax", column: "tax_amount" },
|
|
814
|
+
{ ...amount3, name: "taxRefunded", label: "Tax refunded", column: "tax_refunded" },
|
|
815
|
+
{
|
|
816
|
+
name: "taxCountry",
|
|
817
|
+
label: "Tax country",
|
|
818
|
+
type: "text",
|
|
819
|
+
column: "tax_country",
|
|
820
|
+
filterable: true,
|
|
821
|
+
sortable: false
|
|
822
|
+
},
|
|
823
|
+
{ ...amount3, name: "net", label: "Net of tax", column: "net" },
|
|
824
|
+
// A subscription period's order (ADR 0486).
|
|
825
|
+
{ ...id3, name: "subscriptionId", label: "Subscription", column: "subscription_id" },
|
|
826
|
+
{ ...when3, name: "periodStart", label: "Period from", column: "period_start" },
|
|
827
|
+
{ ...when3, name: "periodEnd", label: "Period to", column: "period_end" },
|
|
828
|
+
// Staff only: a period paid other than as agreed, recorded for what was paid.
|
|
829
|
+
{
|
|
830
|
+
name: "periodFlag",
|
|
831
|
+
label: "Paid other than agreed",
|
|
832
|
+
type: "enum",
|
|
833
|
+
enumValues: ["paid_less", "paid_more", "not_as_agreed"],
|
|
834
|
+
column: "period_flag",
|
|
835
|
+
filterable: true,
|
|
836
|
+
sortable: false
|
|
837
|
+
},
|
|
838
|
+
// Adjustments (stage 34, ADR 0690): money off, already taken out of the total.
|
|
839
|
+
{ ...amount3, name: "discount", label: "Discount", column: "discount" }
|
|
840
|
+
]
|
|
841
|
+
});
|
|
842
|
+
var orderLineObject = defineObject({
|
|
843
|
+
name: "orderLine",
|
|
844
|
+
label: "Order line",
|
|
845
|
+
plural: "Order lines",
|
|
846
|
+
source: "rec_order_line",
|
|
847
|
+
defaultSort: { field: "position", direction: "asc" },
|
|
848
|
+
customer: {
|
|
849
|
+
field: "personId",
|
|
850
|
+
read: [
|
|
851
|
+
"orderId",
|
|
852
|
+
"position",
|
|
853
|
+
"object",
|
|
854
|
+
"recordId",
|
|
855
|
+
"title",
|
|
856
|
+
"quantity",
|
|
857
|
+
"unitPrice",
|
|
858
|
+
"total",
|
|
859
|
+
"taxAmount",
|
|
860
|
+
"discount",
|
|
861
|
+
"netTotal"
|
|
862
|
+
],
|
|
863
|
+
write: []
|
|
864
|
+
},
|
|
865
|
+
fields: [
|
|
866
|
+
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
867
|
+
{ ...id3, name: "orderId", label: "Order", column: "order_id" },
|
|
868
|
+
{
|
|
869
|
+
...id3,
|
|
870
|
+
name: "personId",
|
|
871
|
+
label: "Person",
|
|
872
|
+
column: "person_id",
|
|
873
|
+
fieldType: "relation",
|
|
874
|
+
options: { to: "person" }
|
|
875
|
+
},
|
|
876
|
+
{ ...amount3, name: "position", label: "Position", column: "position" },
|
|
877
|
+
{
|
|
878
|
+
name: "object",
|
|
879
|
+
label: "What is bought",
|
|
880
|
+
type: "text",
|
|
881
|
+
column: "object_type",
|
|
882
|
+
filterable: true,
|
|
883
|
+
sortable: false
|
|
884
|
+
},
|
|
885
|
+
{ ...id3, name: "recordId", label: "Record", column: "record_id" },
|
|
886
|
+
{
|
|
887
|
+
name: "title",
|
|
888
|
+
label: "Title",
|
|
889
|
+
type: "text",
|
|
890
|
+
column: "title",
|
|
891
|
+
filterable: true,
|
|
892
|
+
sortable: false
|
|
893
|
+
},
|
|
894
|
+
{ ...amount3, name: "quantity", label: "Quantity", column: "quantity" },
|
|
895
|
+
{ ...amount3, name: "unitPrice", label: "Unit price", column: "unit_price" },
|
|
896
|
+
{ ...amount3, name: "total", label: "Line total", column: "line_total" },
|
|
897
|
+
{ ...when3, name: "createdAt", label: "Created", column: "created_at" },
|
|
898
|
+
{ ...amount3, name: "taxAmount", label: "Tax", column: "tax_amount" },
|
|
899
|
+
{
|
|
900
|
+
name: "taxCode",
|
|
901
|
+
label: "Tax code",
|
|
902
|
+
type: "text",
|
|
903
|
+
column: "tax_code",
|
|
904
|
+
filterable: true,
|
|
905
|
+
sortable: false
|
|
906
|
+
},
|
|
907
|
+
// Adjustments (stage 34, ADR 0690): the line's share of them, and what it costs after them.
|
|
908
|
+
{ ...amount3, name: "discount", label: "Discount", column: "line_discount" },
|
|
909
|
+
{ ...amount3, name: "netTotal", label: "Line total after discounts", column: "line_net" }
|
|
910
|
+
]
|
|
911
|
+
});
|
|
912
|
+
var BASE_OBJECTS = {
|
|
913
|
+
order: orderObject,
|
|
914
|
+
orderLine: orderLineObject,
|
|
915
|
+
// Stage 28 (ADR 0444): the media library.
|
|
916
|
+
media: mediaObject,
|
|
917
|
+
// Stage 32a (ADR 0485): a subscription the payment provider runs.
|
|
918
|
+
subscription: subscriptionObject,
|
|
919
|
+
// Stage 35 (ADR 0730): quotes, invoices and credit notes.
|
|
920
|
+
quote: quoteObject,
|
|
921
|
+
invoice: invoiceObject,
|
|
922
|
+
creditNote: creditNoteObject,
|
|
923
|
+
// Stage 64 (ADR 0910): a place the business works from.
|
|
924
|
+
location: locationObject
|
|
925
|
+
};
|
|
926
|
+
var BASE_TABLES = {
|
|
927
|
+
order: "core_order",
|
|
928
|
+
orderLine: "core_order_line",
|
|
929
|
+
media: "core_media",
|
|
930
|
+
subscription: "core_subscription",
|
|
931
|
+
quote: "core_quote",
|
|
932
|
+
invoice: "core_invoice",
|
|
933
|
+
creditNote: "core_credit_note",
|
|
934
|
+
location: "core_location"
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
export {
|
|
938
|
+
defineObject,
|
|
939
|
+
getField,
|
|
940
|
+
timelineFields,
|
|
941
|
+
QUOTE_STATES,
|
|
942
|
+
INVOICE_STATES,
|
|
943
|
+
INVOICE_KINDS,
|
|
944
|
+
CREDIT_NOTE_STATES,
|
|
945
|
+
TAX_MODES,
|
|
946
|
+
quoteObject,
|
|
947
|
+
invoiceObject,
|
|
948
|
+
creditNoteObject,
|
|
949
|
+
LOCATION_STATES,
|
|
950
|
+
MAIN_LOCATION_FALLBACK,
|
|
951
|
+
MAIN_LOCATION_ID,
|
|
952
|
+
locationObject,
|
|
953
|
+
mediaObject,
|
|
954
|
+
SUBSCRIPTION_STATES,
|
|
955
|
+
subscriptionObject,
|
|
956
|
+
ORDER_STATES,
|
|
957
|
+
ORDER_MACHINE,
|
|
958
|
+
orderObject,
|
|
959
|
+
orderLineObject,
|
|
960
|
+
BASE_OBJECTS,
|
|
961
|
+
BASE_TABLES
|
|
962
|
+
};
|