@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
package/dist/chunk-Q4N55M2Z.js
DELETED
|
@@ -1,552 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
MEDIA_FILE_TYPES,
|
|
4
|
-
MEDIA_KINDS,
|
|
5
|
-
MEDIA_TYPES,
|
|
6
|
-
MEDIA_VIDEO_TYPE
|
|
7
|
-
} from "./chunk-CP6BXI6F.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/media.ts
|
|
38
|
-
var ITEM_TYPES = [...MEDIA_TYPES, ...MEDIA_FILE_TYPES, MEDIA_VIDEO_TYPE];
|
|
39
|
-
var mediaObject = defineObject({
|
|
40
|
-
name: "media",
|
|
41
|
-
label: "Media",
|
|
42
|
-
plural: "Media",
|
|
43
|
-
source: "rec_media",
|
|
44
|
-
titleField: "name",
|
|
45
|
-
defaultSort: { field: "createdAt", direction: "desc" },
|
|
46
|
-
fields: [
|
|
47
|
-
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
48
|
-
{ name: "name", label: "Name", type: "text", column: "name", filterable: true, sortable: true },
|
|
49
|
-
{
|
|
50
|
-
name: "kind",
|
|
51
|
-
label: "Kind",
|
|
52
|
-
type: "enum",
|
|
53
|
-
enumValues: MEDIA_KINDS,
|
|
54
|
-
column: "kind",
|
|
55
|
-
filterable: true,
|
|
56
|
-
sortable: true
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: "type",
|
|
60
|
-
label: "Type",
|
|
61
|
-
type: "enum",
|
|
62
|
-
enumValues: ITEM_TYPES,
|
|
63
|
-
column: "type",
|
|
64
|
-
filterable: true,
|
|
65
|
-
sortable: true
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: "bytes",
|
|
69
|
-
label: "Size",
|
|
70
|
-
type: "number",
|
|
71
|
-
column: "bytes",
|
|
72
|
-
filterable: true,
|
|
73
|
-
sortable: true
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: "width",
|
|
77
|
-
label: "Width",
|
|
78
|
-
type: "number",
|
|
79
|
-
column: "width",
|
|
80
|
-
filterable: true,
|
|
81
|
-
sortable: true
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: "height",
|
|
85
|
-
label: "Height",
|
|
86
|
-
type: "number",
|
|
87
|
-
column: "height",
|
|
88
|
-
filterable: true,
|
|
89
|
-
sortable: true
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: "state",
|
|
93
|
-
label: "State",
|
|
94
|
-
type: "enum",
|
|
95
|
-
enumValues: ["uploading", "processing", "ready", "failed"],
|
|
96
|
-
column: "state",
|
|
97
|
-
filterable: true,
|
|
98
|
-
sortable: true
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: "duration",
|
|
102
|
-
label: "Duration (seconds)",
|
|
103
|
-
type: "number",
|
|
104
|
-
column: "duration",
|
|
105
|
-
filterable: true,
|
|
106
|
-
sortable: true
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: "alt",
|
|
110
|
-
label: "Alt text",
|
|
111
|
-
type: "text",
|
|
112
|
-
column: "alt",
|
|
113
|
-
filterable: true,
|
|
114
|
-
sortable: false
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "createdAt",
|
|
118
|
-
label: "Uploaded",
|
|
119
|
-
type: "datetime",
|
|
120
|
-
column: "created_at",
|
|
121
|
-
filterable: true,
|
|
122
|
-
sortable: true
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "createdBy",
|
|
126
|
-
label: "Uploaded by",
|
|
127
|
-
type: "id",
|
|
128
|
-
column: "created_by",
|
|
129
|
-
filterable: true,
|
|
130
|
-
sortable: false
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// ../core/src/fields/subscription.ts
|
|
136
|
-
var SUBSCRIPTION_STATES = [
|
|
137
|
-
"incomplete",
|
|
138
|
-
"expired",
|
|
139
|
-
"trialing",
|
|
140
|
-
"active",
|
|
141
|
-
"past_due",
|
|
142
|
-
"unpaid",
|
|
143
|
-
"paused",
|
|
144
|
-
"ended"
|
|
145
|
-
];
|
|
146
|
-
var STATE_LABELS = {
|
|
147
|
-
incomplete: "Incomplete",
|
|
148
|
-
expired: "Expired",
|
|
149
|
-
trialing: "Trial",
|
|
150
|
-
active: "Active",
|
|
151
|
-
past_due: "Past due",
|
|
152
|
-
unpaid: "Unpaid",
|
|
153
|
-
paused: "Paused",
|
|
154
|
-
ended: "Ended"
|
|
155
|
-
};
|
|
156
|
-
var LIVE = ["incomplete", "trialing", "active", "past_due", "unpaid", "paused"];
|
|
157
|
-
var others = (state) => LIVE.filter((s) => s !== state);
|
|
158
|
-
var SUBSCRIPTION_MACHINE = {
|
|
159
|
-
field: "state",
|
|
160
|
-
initial: "incomplete",
|
|
161
|
-
moves: [
|
|
162
|
-
{ from: others("trialing"), to: "trialing", by: ["host"] },
|
|
163
|
-
{ from: others("active"), to: "active", by: ["host"] },
|
|
164
|
-
{ from: others("past_due"), to: "past_due", by: ["host"] },
|
|
165
|
-
{ from: others("unpaid"), to: "unpaid", by: ["host"] },
|
|
166
|
-
{ from: others("paused"), to: "paused", by: ["host"] },
|
|
167
|
-
// The first payment never succeeded within the provider's 23 hours.
|
|
168
|
-
{ from: "incomplete", to: "expired", by: ["host"], final: true },
|
|
169
|
-
{ from: [...LIVE], to: "ended", by: ["host"], final: true }
|
|
170
|
-
]
|
|
171
|
-
};
|
|
172
|
-
var id = { type: "id", filterable: true, sortable: false };
|
|
173
|
-
var amount = { type: "number", filterable: true, sortable: true };
|
|
174
|
-
var when = { type: "datetime", filterable: true, sortable: true };
|
|
175
|
-
var text = (name, label, column) => ({ name, label, type: "text", column, filterable: true, sortable: false });
|
|
176
|
-
var subscriptionObject = defineObject({
|
|
177
|
-
name: "subscription",
|
|
178
|
-
label: "Subscription",
|
|
179
|
-
plural: "Subscriptions",
|
|
180
|
-
source: "rec_subscription",
|
|
181
|
-
titleField: "planTitle",
|
|
182
|
-
defaultSort: { field: "createdAt", direction: "desc" },
|
|
183
|
-
states: SUBSCRIPTION_MACHINE,
|
|
184
|
-
customer: {
|
|
185
|
-
field: "payerPersonId",
|
|
186
|
-
read: [
|
|
187
|
-
"holderPersonId",
|
|
188
|
-
"planObject",
|
|
189
|
-
"planId",
|
|
190
|
-
"planTitle",
|
|
191
|
-
"amount",
|
|
192
|
-
"currency",
|
|
193
|
-
"interval",
|
|
194
|
-
"taxed",
|
|
195
|
-
"state",
|
|
196
|
-
"trialEnd",
|
|
197
|
-
"currentPeriodStart",
|
|
198
|
-
"currentPeriodEnd",
|
|
199
|
-
"cancelAtPeriodEnd",
|
|
200
|
-
"cancelAt",
|
|
201
|
-
"canceledAt",
|
|
202
|
-
"endedAt",
|
|
203
|
-
"actionUrl",
|
|
204
|
-
"createdAt"
|
|
205
|
-
],
|
|
206
|
-
write: []
|
|
207
|
-
},
|
|
208
|
-
fields: [
|
|
209
|
-
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
210
|
-
{
|
|
211
|
-
...id,
|
|
212
|
-
name: "payerPersonId",
|
|
213
|
-
label: "Payer",
|
|
214
|
-
column: "payer_person_id",
|
|
215
|
-
fieldType: "relation",
|
|
216
|
-
options: { to: "person" }
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
...id,
|
|
220
|
-
name: "holderPersonId",
|
|
221
|
-
label: "Holder",
|
|
222
|
-
column: "holder_person_id",
|
|
223
|
-
fieldType: "relation",
|
|
224
|
-
options: { to: "person" }
|
|
225
|
-
},
|
|
226
|
-
text("email", "Email", "email"),
|
|
227
|
-
{
|
|
228
|
-
name: "placedAs",
|
|
229
|
-
label: "Started by",
|
|
230
|
-
type: "enum",
|
|
231
|
-
enumValues: ["customer", "public", "staff"],
|
|
232
|
-
column: "placed_as",
|
|
233
|
-
filterable: true,
|
|
234
|
-
sortable: false
|
|
235
|
-
},
|
|
236
|
-
text("planObject", "Plan's object", "plan_object"),
|
|
237
|
-
{ ...id, name: "planId", label: "Plan", column: "plan_id" },
|
|
238
|
-
text("planTitle", "Plan", "plan_title"),
|
|
239
|
-
{ ...amount, name: "amount", label: "Price per period", column: "amount" },
|
|
240
|
-
text("currency", "Currency", "currency"),
|
|
241
|
-
{
|
|
242
|
-
name: "interval",
|
|
243
|
-
label: "Every",
|
|
244
|
-
type: "enum",
|
|
245
|
-
enumValues: ["week", "month", "year"],
|
|
246
|
-
column: "interval",
|
|
247
|
-
filterable: true,
|
|
248
|
-
sortable: false
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
name: "taxed",
|
|
252
|
-
label: "Taxed",
|
|
253
|
-
type: "boolean",
|
|
254
|
-
column: "taxed",
|
|
255
|
-
filterable: true,
|
|
256
|
-
sortable: false
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
name: "state",
|
|
260
|
-
label: "State",
|
|
261
|
-
type: "enum",
|
|
262
|
-
enumValues: SUBSCRIPTION_STATES,
|
|
263
|
-
column: "state",
|
|
264
|
-
filterable: true,
|
|
265
|
-
sortable: true,
|
|
266
|
-
options: {
|
|
267
|
-
choices: SUBSCRIPTION_STATES.map((value) => ({ value, label: STATE_LABELS[value] }))
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
text("provider", "Provider", "provider"),
|
|
271
|
-
text("providerRef", "Provider's reference", "provider_ref"),
|
|
272
|
-
{ ...when, name: "trialEnd", label: "Trial ends", column: "trial_end" },
|
|
273
|
-
{ ...when, name: "currentPeriodStart", label: "Period from", column: "current_period_start" },
|
|
274
|
-
{ ...when, name: "currentPeriodEnd", label: "Period to", column: "current_period_end" },
|
|
275
|
-
{
|
|
276
|
-
name: "cancelAtPeriodEnd",
|
|
277
|
-
label: "Ends at period end",
|
|
278
|
-
type: "boolean",
|
|
279
|
-
column: "cancel_at_period_end",
|
|
280
|
-
filterable: true,
|
|
281
|
-
sortable: false
|
|
282
|
-
},
|
|
283
|
-
// A date set at the provider another way (its dashboard): the host's resume cannot undo it.
|
|
284
|
-
{ ...when, name: "cancelAt", label: "Ends on", column: "cancel_at" },
|
|
285
|
-
{ ...when, name: "canceledAt", label: "Cancelled on", column: "canceled_at" },
|
|
286
|
-
{ ...when, name: "endedAt", label: "Ended on", column: "ended_at" },
|
|
287
|
-
text("endReason", "Why it ended", "end_reason"),
|
|
288
|
-
text("actionUrl", "Confirm payment at", "action_url"),
|
|
289
|
-
{ ...when, name: "failingSince", label: "Failing since", column: "failing_since" },
|
|
290
|
-
{ ...when, name: "createdAt", label: "Started", column: "created_at" },
|
|
291
|
-
{ ...when, name: "updatedAt", label: "Updated", column: "updated_at" }
|
|
292
|
-
]
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
// ../core/src/fields/order.ts
|
|
296
|
-
var ORDER_STATES = [
|
|
297
|
-
"pending",
|
|
298
|
-
"part_paid",
|
|
299
|
-
"paid",
|
|
300
|
-
"cancelled",
|
|
301
|
-
"expired",
|
|
302
|
-
"refunded"
|
|
303
|
-
];
|
|
304
|
-
var STATE_LABELS2 = {
|
|
305
|
-
pending: "Pending",
|
|
306
|
-
part_paid: "Part paid",
|
|
307
|
-
paid: "Paid",
|
|
308
|
-
cancelled: "Cancelled",
|
|
309
|
-
expired: "Expired",
|
|
310
|
-
refunded: "Refunded"
|
|
311
|
-
};
|
|
312
|
-
var ORDER_MACHINE = {
|
|
313
|
-
field: "state",
|
|
314
|
-
initial: "pending",
|
|
315
|
-
moves: [
|
|
316
|
-
// Only a verified payment marks an order paid, in part or in full.
|
|
317
|
-
{ from: ["pending", "part_paid", "expired"], to: "paid", by: ["host"] },
|
|
318
|
-
// A late deposit staff honour (ADR 0429) makes an expired order part paid.
|
|
319
|
-
{ from: ["pending", "expired"], to: "part_paid", by: ["host"] },
|
|
320
|
-
// A buyer may give up an order they have paid nothing on. Once money is on it, staff cancel.
|
|
321
|
-
{ from: "pending", to: "cancelled", by: ["staff", "customer"], final: true },
|
|
322
|
-
{ from: "part_paid", to: "cancelled", by: ["staff"], final: true },
|
|
323
|
-
// Not final: a late payment staff choose to honour makes it paid.
|
|
324
|
-
{ from: "pending", to: "expired", by: ["host"] },
|
|
325
|
-
{ from: "paid", to: "refunded", by: ["host"], final: true }
|
|
326
|
-
]
|
|
327
|
-
};
|
|
328
|
-
var id2 = { type: "id", filterable: true, sortable: false };
|
|
329
|
-
var amount2 = { type: "number", filterable: true, sortable: true };
|
|
330
|
-
var when2 = { type: "datetime", filterable: true, sortable: true };
|
|
331
|
-
var orderObject = defineObject({
|
|
332
|
-
name: "order",
|
|
333
|
-
label: "Order",
|
|
334
|
-
plural: "Orders",
|
|
335
|
-
source: "rec_order",
|
|
336
|
-
defaultSort: { field: "createdAt", direction: "desc" },
|
|
337
|
-
states: ORDER_MACHINE,
|
|
338
|
-
customer: {
|
|
339
|
-
field: "personId",
|
|
340
|
-
read: [
|
|
341
|
-
"state",
|
|
342
|
-
"currency",
|
|
343
|
-
"total",
|
|
344
|
-
"paid",
|
|
345
|
-
"balance",
|
|
346
|
-
"refunded",
|
|
347
|
-
"pay",
|
|
348
|
-
"deposit",
|
|
349
|
-
"balanceDueAt",
|
|
350
|
-
"expiresAt",
|
|
351
|
-
"paidAt",
|
|
352
|
-
"createdAt",
|
|
353
|
-
"taxAmount",
|
|
354
|
-
"taxRefunded",
|
|
355
|
-
"taxCountry",
|
|
356
|
-
"subscriptionId",
|
|
357
|
-
"periodStart",
|
|
358
|
-
"periodEnd"
|
|
359
|
-
],
|
|
360
|
-
write: []
|
|
361
|
-
},
|
|
362
|
-
fields: [
|
|
363
|
-
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
364
|
-
{
|
|
365
|
-
...id2,
|
|
366
|
-
name: "personId",
|
|
367
|
-
label: "Person",
|
|
368
|
-
column: "person_id",
|
|
369
|
-
// What the customer declaration needs to know: this is whose order it is.
|
|
370
|
-
fieldType: "relation",
|
|
371
|
-
options: { to: "person" }
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
name: "email",
|
|
375
|
-
label: "Email",
|
|
376
|
-
type: "text",
|
|
377
|
-
column: "email",
|
|
378
|
-
filterable: true,
|
|
379
|
-
sortable: false
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
name: "state",
|
|
383
|
-
label: "State",
|
|
384
|
-
type: "enum",
|
|
385
|
-
enumValues: ORDER_STATES,
|
|
386
|
-
column: "state",
|
|
387
|
-
filterable: true,
|
|
388
|
-
sortable: true,
|
|
389
|
-
options: {
|
|
390
|
-
choices: ORDER_STATES.map((value) => ({ value, label: STATE_LABELS2[value] }))
|
|
391
|
-
}
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
name: "currency",
|
|
395
|
-
label: "Currency",
|
|
396
|
-
type: "text",
|
|
397
|
-
column: "currency",
|
|
398
|
-
filterable: true,
|
|
399
|
-
sortable: false
|
|
400
|
-
},
|
|
401
|
-
{ ...amount2, name: "total", label: "Total", column: "total" },
|
|
402
|
-
{ ...amount2, name: "paid", label: "Paid", column: "paid" },
|
|
403
|
-
{ ...amount2, name: "balance", label: "Balance", column: "balance" },
|
|
404
|
-
{ ...amount2, name: "refunded", label: "Refunded", column: "refunded" },
|
|
405
|
-
{
|
|
406
|
-
name: "pay",
|
|
407
|
-
label: "Paying",
|
|
408
|
-
type: "enum",
|
|
409
|
-
enumValues: ["full", "deposit"],
|
|
410
|
-
column: "pay",
|
|
411
|
-
filterable: true,
|
|
412
|
-
sortable: false
|
|
413
|
-
},
|
|
414
|
-
{ ...amount2, name: "deposit", label: "Deposit", column: "deposit" },
|
|
415
|
-
{ ...when2, name: "balanceDueAt", label: "Balance due", column: "balance_due_at" },
|
|
416
|
-
{ ...when2, name: "expiresAt", label: "Expires", column: "expires_at" },
|
|
417
|
-
{
|
|
418
|
-
name: "placedAs",
|
|
419
|
-
label: "Placed by",
|
|
420
|
-
type: "enum",
|
|
421
|
-
enumValues: ["customer", "public", "staff"],
|
|
422
|
-
column: "placed_as",
|
|
423
|
-
filterable: true,
|
|
424
|
-
sortable: false
|
|
425
|
-
},
|
|
426
|
-
{ ...when2, name: "paidAt", label: "Paid on", column: "paid_at" },
|
|
427
|
-
{ ...when2, name: "cancelledAt", label: "Cancelled on", column: "cancelled_at" },
|
|
428
|
-
{ ...when2, name: "refundedAt", label: "Refunded on", column: "refunded_at" },
|
|
429
|
-
{ ...when2, name: "createdAt", label: "Created", column: "created_at" },
|
|
430
|
-
{ ...when2, name: "updatedAt", label: "Updated", column: "updated_at" },
|
|
431
|
-
// Tax at checkout (ADR 0479): the provider's figures, inside the amounts above.
|
|
432
|
-
{ ...amount2, name: "taxAmount", label: "Tax", column: "tax_amount" },
|
|
433
|
-
{ ...amount2, name: "taxRefunded", label: "Tax refunded", column: "tax_refunded" },
|
|
434
|
-
{
|
|
435
|
-
name: "taxCountry",
|
|
436
|
-
label: "Tax country",
|
|
437
|
-
type: "text",
|
|
438
|
-
column: "tax_country",
|
|
439
|
-
filterable: true,
|
|
440
|
-
sortable: false
|
|
441
|
-
},
|
|
442
|
-
{ ...amount2, name: "net", label: "Net of tax", column: "net" },
|
|
443
|
-
// A subscription period's order (ADR 0486).
|
|
444
|
-
{ ...id2, name: "subscriptionId", label: "Subscription", column: "subscription_id" },
|
|
445
|
-
{ ...when2, name: "periodStart", label: "Period from", column: "period_start" },
|
|
446
|
-
{ ...when2, name: "periodEnd", label: "Period to", column: "period_end" },
|
|
447
|
-
// Staff only: a period paid other than as agreed, recorded for what was paid.
|
|
448
|
-
{
|
|
449
|
-
name: "periodFlag",
|
|
450
|
-
label: "Paid other than agreed",
|
|
451
|
-
type: "enum",
|
|
452
|
-
enumValues: ["paid_less", "paid_more", "not_as_agreed"],
|
|
453
|
-
column: "period_flag",
|
|
454
|
-
filterable: true,
|
|
455
|
-
sortable: false
|
|
456
|
-
}
|
|
457
|
-
]
|
|
458
|
-
});
|
|
459
|
-
var orderLineObject = defineObject({
|
|
460
|
-
name: "orderLine",
|
|
461
|
-
label: "Order line",
|
|
462
|
-
plural: "Order lines",
|
|
463
|
-
source: "rec_order_line",
|
|
464
|
-
defaultSort: { field: "position", direction: "asc" },
|
|
465
|
-
customer: {
|
|
466
|
-
field: "personId",
|
|
467
|
-
read: [
|
|
468
|
-
"orderId",
|
|
469
|
-
"position",
|
|
470
|
-
"object",
|
|
471
|
-
"recordId",
|
|
472
|
-
"title",
|
|
473
|
-
"quantity",
|
|
474
|
-
"unitPrice",
|
|
475
|
-
"total",
|
|
476
|
-
"taxAmount"
|
|
477
|
-
],
|
|
478
|
-
write: []
|
|
479
|
-
},
|
|
480
|
-
fields: [
|
|
481
|
-
{ name: "id", label: "ID", type: "id", column: "id", filterable: true, sortable: true },
|
|
482
|
-
{ ...id2, name: "orderId", label: "Order", column: "order_id" },
|
|
483
|
-
{
|
|
484
|
-
...id2,
|
|
485
|
-
name: "personId",
|
|
486
|
-
label: "Person",
|
|
487
|
-
column: "person_id",
|
|
488
|
-
fieldType: "relation",
|
|
489
|
-
options: { to: "person" }
|
|
490
|
-
},
|
|
491
|
-
{ ...amount2, name: "position", label: "Position", column: "position" },
|
|
492
|
-
{
|
|
493
|
-
name: "object",
|
|
494
|
-
label: "What is bought",
|
|
495
|
-
type: "text",
|
|
496
|
-
column: "object_type",
|
|
497
|
-
filterable: true,
|
|
498
|
-
sortable: false
|
|
499
|
-
},
|
|
500
|
-
{ ...id2, name: "recordId", label: "Record", column: "record_id" },
|
|
501
|
-
{
|
|
502
|
-
name: "title",
|
|
503
|
-
label: "Title",
|
|
504
|
-
type: "text",
|
|
505
|
-
column: "title",
|
|
506
|
-
filterable: true,
|
|
507
|
-
sortable: false
|
|
508
|
-
},
|
|
509
|
-
{ ...amount2, name: "quantity", label: "Quantity", column: "quantity" },
|
|
510
|
-
{ ...amount2, name: "unitPrice", label: "Unit price", column: "unit_price" },
|
|
511
|
-
{ ...amount2, name: "total", label: "Line total", column: "line_total" },
|
|
512
|
-
{ ...when2, name: "createdAt", label: "Created", column: "created_at" },
|
|
513
|
-
{ ...amount2, name: "taxAmount", label: "Tax", column: "tax_amount" },
|
|
514
|
-
{
|
|
515
|
-
name: "taxCode",
|
|
516
|
-
label: "Tax code",
|
|
517
|
-
type: "text",
|
|
518
|
-
column: "tax_code",
|
|
519
|
-
filterable: true,
|
|
520
|
-
sortable: false
|
|
521
|
-
}
|
|
522
|
-
]
|
|
523
|
-
});
|
|
524
|
-
var BASE_OBJECTS = {
|
|
525
|
-
order: orderObject,
|
|
526
|
-
orderLine: orderLineObject,
|
|
527
|
-
// Stage 28 (ADR 0444): the media library.
|
|
528
|
-
media: mediaObject,
|
|
529
|
-
// Stage 32a (ADR 0485): a subscription the payment provider runs.
|
|
530
|
-
subscription: subscriptionObject
|
|
531
|
-
};
|
|
532
|
-
var BASE_TABLES = {
|
|
533
|
-
order: "core_order",
|
|
534
|
-
orderLine: "core_order_line",
|
|
535
|
-
media: "core_media",
|
|
536
|
-
subscription: "core_subscription"
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
export {
|
|
540
|
-
defineObject,
|
|
541
|
-
getField,
|
|
542
|
-
timelineFields,
|
|
543
|
-
mediaObject,
|
|
544
|
-
SUBSCRIPTION_STATES,
|
|
545
|
-
subscriptionObject,
|
|
546
|
-
ORDER_STATES,
|
|
547
|
-
ORDER_MACHINE,
|
|
548
|
-
orderObject,
|
|
549
|
-
orderLineObject,
|
|
550
|
-
BASE_OBJECTS,
|
|
551
|
-
BASE_TABLES
|
|
552
|
-
};
|