@composable-os/cli 0.1.0-beta.11 → 0.1.0-beta.14
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-UHYLCLEY.js → accounts-GOCNY6WI.js} +17 -13
- package/dist/app-OSPZHKOI.js +43 -0
- package/dist/app-upload-LH4PXKI4.js +198 -0
- package/dist/{blocks-5IFU25J6.js → blocks-6DZIP47W.js} +207 -25
- package/dist/{chunk-XIDLW3EP.js → chunk-2B6YUYZV.js} +23499 -11766
- package/dist/{run-7P4RQALH.js → chunk-2CCHB37H.js} +9 -146
- package/dist/{chunk-DU6OIFOU.js → chunk-3OGDWKJ3.js} +530 -434
- package/dist/{chunk-DHS2CV2M.js → chunk-5D7BDF4Y.js} +15 -13
- package/dist/{chunk-MBIKVRAC.js → chunk-5YDYQM6V.js} +830 -47
- package/dist/{chunk-ZAWES2UD.js → chunk-6CM3WZG5.js} +13 -2483
- package/dist/{chunk-7D4GKZOX.js → chunk-CIBJGB5H.js} +422 -75
- package/dist/chunk-EPDTPGZJ.js +330 -0
- package/dist/{chunk-LAAL4YGR.js → chunk-HAYF4G5V.js} +66 -23
- package/dist/chunk-HCG6T53D.js +61904 -0
- package/dist/{chunk-K34UKWEI.js → chunk-JX4IFWNT.js} +64 -32
- package/dist/{chunk-6XTU2MTP.js → chunk-KFHKNXGH.js} +632 -418
- package/dist/chunk-KMFMD52Z.js +13276 -0
- package/dist/{chunk-E4WCYTCT.js → chunk-LX2TTLVY.js} +174 -55
- package/dist/{chunk-PDD2ETVF.js → chunk-O37YUZ52.js} +172 -16
- package/dist/{chunk-GYTEW66E.js → chunk-O3R4FS2J.js} +1 -1
- package/dist/{chunk-E64SG24J.js → chunk-Q6Y45DY6.js} +25 -2
- package/dist/chunk-RGKJKC5T.js +876 -0
- package/dist/{chunk-YFTLIEWU.js → chunk-RSEWEFAV.js} +12 -2
- package/dist/{chunk-2ABSVMGB.js → chunk-SMJZIK2O.js} +1 -1
- package/dist/{chunk-LO6WGU5Y.js → chunk-U72NEGCT.js} +8089 -3464
- package/dist/{chunk-P6UWZ6QQ.js → chunk-Z4IKF23A.js} +11 -7
- package/dist/{chunk-2IVEVPMY.js → chunk-Z7OVQ6BC.js} +105 -61
- package/dist/{chunk-6UWRT4VM.js → chunk-ZJSFX4RD.js} +175 -3
- package/dist/{cli-5UNY5G5L.js → cli-OKQHHSOE.js} +17 -25
- package/dist/{cli-UYZMVQMR.js → cli-VYSD2S4Z.js} +227 -81
- package/dist/cli.js +5 -5
- package/dist/{client-repo-SE4EKG6W.js → client-repo-MPCPTXLF.js} +7 -5
- package/dist/create.js +5 -5
- package/dist/{fields-FTWWMD7N.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-U4KZLLSJ.js → order-RKLGT74L.js} +2 -2
- package/dist/{person-UHLVBVLR.js → person-YOZTFV4Q.js} +11 -10
- package/dist/plan-on-sale-H4F26YIN.js +26 -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 +1 -2
- package/dist/platform/sdk/checklists.ts +118 -0
- package/dist/platform/sdk/contract.ts +489 -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 +1236 -65
- 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 +344 -0
- package/dist/platform/sdk/slug.ts +7 -2
- package/dist/platform/sdk/staffed.ts +474 -0
- package/dist/platform/sdk/states.ts +68 -26
- 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-ZCGFMEZF.js → run-QOFRRSZV.js} +41 -60
- package/dist/{run-PO3W5BFA.js → run-TJAEWR5U.js} +21 -51
- package/dist/{src-I3IJ4NKC.js → src-52VERUPK.js} +306 -4
- package/dist/src-PHRELWN5.js +40 -0
- package/dist/{visibility-TVXZ67FD.js → visibility-SZCINPP4.js} +21 -4
- package/package.json +2 -2
- package/dist/chunk-2TWV3SVB.js +0 -349
- package/dist/chunk-2XC5JLBO.js +0 -1931
- package/dist/chunk-324WJXNP.js +0 -320
- package/dist/chunk-6ELZRNUU.js +0 -116
- package/dist/chunk-6WGFA2IV.js +0 -643
- package/dist/chunk-7CQGMVDO.js +0 -63
- package/dist/chunk-7OGCMQXG.js +0 -284
- package/dist/chunk-FJIZGS5Q.js +0 -698
- package/dist/chunk-UB4I2QKR.js +0 -31575
- package/dist/chunk-WHKJGF36.js +0 -2418
- package/dist/chunk-YNUZRTPH.js +0 -182
- package/dist/chunk-ZZFWMVJO.js +0 -704
- package/dist/grants-LOW6TSWD.js +0 -32
- package/dist/invoke-6KVT6WJI.js +0 -41
- package/dist/moves-E2HKYCTK.js +0 -41
- package/dist/plan-on-sale-TJPFCNL7.js +0 -26
- package/dist/src-CRO35DYY.js +0 -46
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
isCoreObject,
|
|
6
6
|
listObjects,
|
|
7
7
|
setExtensionObjects
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RSEWEFAV.js";
|
|
9
9
|
import {
|
|
10
10
|
BASE_TABLES
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CIBJGB5H.js";
|
|
12
12
|
import {
|
|
13
13
|
EXTENSION_ID_RE,
|
|
14
14
|
FIELD_NAME_RE,
|
|
@@ -24,10 +24,16 @@ import {
|
|
|
24
24
|
external_exports,
|
|
25
25
|
formulaTypeOf,
|
|
26
26
|
isDocumentType,
|
|
27
|
+
isRestrictedField,
|
|
27
28
|
onStep,
|
|
29
|
+
sellableFinance,
|
|
28
30
|
spendsOnList,
|
|
29
31
|
validateDocument
|
|
30
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-U72NEGCT.js";
|
|
33
|
+
import {
|
|
34
|
+
ValidationError,
|
|
35
|
+
setDeclaredUniqueKeys
|
|
36
|
+
} from "./chunk-RGKJKC5T.js";
|
|
31
37
|
|
|
32
38
|
// ../../node_modules/.pnpm/kysely@0.29.8/node_modules/kysely/dist/util/object-utils.js
|
|
33
39
|
function isUndefined(obj) {
|
|
@@ -9014,350 +9020,14 @@ function viewColumnName(extension, target, local) {
|
|
|
9014
9020
|
return target.startsWith(`${extension}.`) ? column : ident(`${extension}__${column}`);
|
|
9015
9021
|
}
|
|
9016
9022
|
|
|
9017
|
-
// ../core/src/errors.ts
|
|
9018
|
-
var OperationError = class extends Error {
|
|
9019
|
-
constructor(code, message, details) {
|
|
9020
|
-
super(message);
|
|
9021
|
-
this.code = code;
|
|
9022
|
-
this.details = details;
|
|
9023
|
-
}
|
|
9024
|
-
code;
|
|
9025
|
-
details;
|
|
9026
|
-
name = "OperationError";
|
|
9027
|
-
toJSON() {
|
|
9028
|
-
return {
|
|
9029
|
-
code: this.code,
|
|
9030
|
-
message: this.message,
|
|
9031
|
-
...this.details === void 0 ? {} : { details: this.details }
|
|
9032
|
-
};
|
|
9033
|
-
}
|
|
9034
|
-
};
|
|
9035
|
-
var UnknownOperationError = class extends OperationError {
|
|
9036
|
-
name = "UnknownOperationError";
|
|
9037
|
-
constructor(name) {
|
|
9038
|
-
super("unknown_operation", `No operation named "${name}"`);
|
|
9039
|
-
}
|
|
9040
|
-
};
|
|
9041
|
-
var ValidationError = class extends OperationError {
|
|
9042
|
-
name = "ValidationError";
|
|
9043
|
-
constructor(message, details) {
|
|
9044
|
-
super("invalid_input", message, details);
|
|
9045
|
-
}
|
|
9046
|
-
};
|
|
9047
|
-
var ForbiddenError = class extends OperationError {
|
|
9048
|
-
name = "ForbiddenError";
|
|
9049
|
-
constructor(message, details) {
|
|
9050
|
-
super("forbidden", message, details);
|
|
9051
|
-
}
|
|
9052
|
-
};
|
|
9053
|
-
var GateDeniedError = class extends OperationError {
|
|
9054
|
-
name = "GateDeniedError";
|
|
9055
|
-
constructor(message, details) {
|
|
9056
|
-
super("denied", message, details);
|
|
9057
|
-
}
|
|
9058
|
-
};
|
|
9059
|
-
var PendingApprovalError = class extends OperationError {
|
|
9060
|
-
name = "PendingApprovalError";
|
|
9061
|
-
pending;
|
|
9062
|
-
constructor(pending) {
|
|
9063
|
-
super("pending_approval", pending.message, pending);
|
|
9064
|
-
this.pending = pending;
|
|
9065
|
-
}
|
|
9066
|
-
};
|
|
9067
|
-
var RunsOnApprovalError = class extends OperationError {
|
|
9068
|
-
constructor(uses) {
|
|
9069
|
-
super(
|
|
9070
|
-
"runs_on_approval",
|
|
9071
|
-
`This uses ${uses}, which a dry run does not touch: it runs only when it is approved`,
|
|
9072
|
-
{ uses }
|
|
9073
|
-
);
|
|
9074
|
-
this.uses = uses;
|
|
9075
|
-
}
|
|
9076
|
-
uses;
|
|
9077
|
-
name = "RunsOnApprovalError";
|
|
9078
|
-
};
|
|
9079
|
-
var TRY_LATER = "Too many places are being held for payment just now: try again shortly";
|
|
9080
|
-
var RateLimitedError = class extends OperationError {
|
|
9081
|
-
name = "RateLimitedError";
|
|
9082
|
-
constructor(message, details) {
|
|
9083
|
-
super("rate_limited", message, details);
|
|
9084
|
-
}
|
|
9085
|
-
};
|
|
9086
|
-
var PlanLimitError = class extends OperationError {
|
|
9087
|
-
name = "PlanLimitError";
|
|
9088
|
-
constructor(message, details) {
|
|
9089
|
-
super("plan_limit", message, details);
|
|
9090
|
-
}
|
|
9091
|
-
};
|
|
9092
|
-
var NotFoundError = class extends OperationError {
|
|
9093
|
-
name = "NotFoundError";
|
|
9094
|
-
constructor(object, id) {
|
|
9095
|
-
super("not_found", `No ${object} with id ${id}`, { object, id });
|
|
9096
|
-
}
|
|
9097
|
-
};
|
|
9098
|
-
var ConflictError = class extends OperationError {
|
|
9099
|
-
name = "ConflictError";
|
|
9100
|
-
constructor(message, details) {
|
|
9101
|
-
super("conflict", message, details);
|
|
9102
|
-
}
|
|
9103
|
-
};
|
|
9104
|
-
var NeedsOwnApprovalError = class extends ConflictError {
|
|
9105
|
-
name = "NeedsOwnApprovalError";
|
|
9106
|
-
constructor(operation, calls) {
|
|
9107
|
-
super(
|
|
9108
|
-
`${operation} calls ${calls}, which needs its own approval, so it cannot be applied as one change: nothing of it was applied. Ask for ${calls} on its own, or reject this.`,
|
|
9109
|
-
{ needsOwnApproval: calls, operation }
|
|
9110
|
-
);
|
|
9111
|
-
}
|
|
9112
|
-
};
|
|
9113
|
-
var ConfigError = class extends OperationError {
|
|
9114
|
-
name = "ConfigError";
|
|
9115
|
-
constructor(message) {
|
|
9116
|
-
super("config", message);
|
|
9117
|
-
}
|
|
9118
|
-
};
|
|
9119
|
-
var declaredUniqueKeys = /* @__PURE__ */ new Set();
|
|
9120
|
-
function setDeclaredUniqueKeys(keys) {
|
|
9121
|
-
declaredUniqueKeys = keys;
|
|
9122
|
-
}
|
|
9123
|
-
function toOperationError(error) {
|
|
9124
|
-
if (error instanceof OperationError) return error;
|
|
9125
|
-
if (error instanceof Error && error.name === "AiAllowanceError") {
|
|
9126
|
-
return new PlanLimitError(error.message, { reason: "platform_ai" });
|
|
9127
|
-
}
|
|
9128
|
-
const capacity = capacityRefusal(error);
|
|
9129
|
-
if (capacity) return capacity;
|
|
9130
|
-
const allowance = allowanceRefusal(error);
|
|
9131
|
-
if (allowance) return allowance;
|
|
9132
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
9133
|
-
if (message.includes("core_order_stale")) {
|
|
9134
|
-
return new ConflictError("The order changed while this was being applied. Try again.", {
|
|
9135
|
-
reason: "order_stale"
|
|
9136
|
-
});
|
|
9137
|
-
}
|
|
9138
|
-
if (message.includes("core_subscription_stale")) {
|
|
9139
|
-
return new ConflictError("The subscription changed while this was being applied. Try again.", {
|
|
9140
|
-
reason: "subscription_stale"
|
|
9141
|
-
});
|
|
9142
|
-
}
|
|
9143
|
-
if (message.includes("core_subscription_trial_taken")) {
|
|
9144
|
-
return new ConflictError(
|
|
9145
|
-
"A checkout with this free trial was opened at the same moment. Start again to get it.",
|
|
9146
|
-
{ rule: "trial_held" }
|
|
9147
|
-
);
|
|
9148
|
-
}
|
|
9149
|
-
if (message.includes("UNIQUE constraint failed: core_sellable_once")) {
|
|
9150
|
-
return new ConflictError(
|
|
9151
|
-
"This is one per person, and another order for it was started at the same moment",
|
|
9152
|
-
{ rule: "once_per_person", reason: "held" }
|
|
9153
|
-
);
|
|
9154
|
-
}
|
|
9155
|
-
if (message.includes("UNIQUE constraint failed: core_subscription_grant")) {
|
|
9156
|
-
return new ConflictError(
|
|
9157
|
-
"This subscription's grant was made by another event at the same moment. Try again.",
|
|
9158
|
-
{ reason: "subscription_grant" }
|
|
9159
|
-
);
|
|
9160
|
-
}
|
|
9161
|
-
if (message.includes("core_subscription_offer_held")) {
|
|
9162
|
-
return new ConflictError(
|
|
9163
|
-
"A checkout for this offer was opened at the same moment, or the offer was taken or withdrawn. Start again.",
|
|
9164
|
-
{ rule: "offer_held" }
|
|
9165
|
-
);
|
|
9166
|
-
}
|
|
9167
|
-
if (message.includes("core_subscription_offer_stale")) {
|
|
9168
|
-
return new ConflictError(
|
|
9169
|
-
"The offer changed while this was being done, so nothing was changed. Try again.",
|
|
9170
|
-
{ rule: "offer_changed" }
|
|
9171
|
-
);
|
|
9172
|
-
}
|
|
9173
|
-
if (message.includes("UNIQUE constraint failed: core_subscription_offer")) {
|
|
9174
|
-
return new ConflictError(
|
|
9175
|
-
"Another import wrote one of these offers at the same moment. Run the import again.",
|
|
9176
|
-
{ rule: "offer_key" }
|
|
9177
|
-
);
|
|
9178
|
-
}
|
|
9179
|
-
if (message.includes(
|
|
9180
|
-
"UNIQUE constraint failed: core_transition_history.object_type, core_transition_history.record_id"
|
|
9181
|
-
)) {
|
|
9182
|
-
return new ConflictError(
|
|
9183
|
-
"The record was moved by another change while this one was being made, so nothing was changed. Read it again: it may already be where you wanted it.",
|
|
9184
|
-
{ reason: "moved_meanwhile" }
|
|
9185
|
-
);
|
|
9186
|
-
}
|
|
9187
|
-
if (message.includes("UNIQUE constraint failed: core_publish_version")) {
|
|
9188
|
-
return new ConflictError(
|
|
9189
|
-
"Another version of this record was published at the same moment, so this one was not. Read its versions again before publishing.",
|
|
9190
|
-
{ reason: "published_meanwhile" }
|
|
9191
|
-
);
|
|
9192
|
-
}
|
|
9193
|
-
if (message.includes("core_recurrence_stale")) {
|
|
9194
|
-
return new ConflictError(
|
|
9195
|
-
"The schedule or a booking changed while this was being done, so nothing was changed. Try again.",
|
|
9196
|
-
{ rule: "recurring_stale" }
|
|
9197
|
-
);
|
|
9198
|
-
}
|
|
9199
|
-
if (message.includes("core_claim_live")) {
|
|
9200
|
-
return new ConflictError(
|
|
9201
|
-
"This record took a place while it was being deleted, so it was not. Move it out first.",
|
|
9202
|
-
{ rule: "capacity", reason: "claim_live" }
|
|
9203
|
-
);
|
|
9204
|
-
}
|
|
9205
|
-
if (message.includes("core_moved_meanwhile")) {
|
|
9206
|
-
return new ConflictError(
|
|
9207
|
-
"What this is for changed while it was being made (it may have been cancelled), so nothing was changed. Look again.",
|
|
9208
|
-
{ rule: "state_closed", reason: "moved_meanwhile" }
|
|
9209
|
-
);
|
|
9210
|
-
}
|
|
9211
|
-
if (message.includes("core_holds_capped")) {
|
|
9212
|
-
return new RateLimitedError(TRY_LATER, { rule: "try_later" });
|
|
9213
|
-
}
|
|
9214
|
-
if (message.includes("core_waitlist_not_full")) {
|
|
9215
|
-
return new ConflictError("A place came free meanwhile: claim it instead of waiting.", {
|
|
9216
|
-
rule: "waitlist",
|
|
9217
|
-
reason: "not_full"
|
|
9218
|
-
});
|
|
9219
|
-
}
|
|
9220
|
-
if (message.includes("core_person_link_not_live")) {
|
|
9221
|
-
return new OperationError("not_found", "Not found", { object: "person" });
|
|
9222
|
-
}
|
|
9223
|
-
if (message.includes("core_person_link_reverse")) {
|
|
9224
|
-
return new ConflictError(
|
|
9225
|
-
"The other way round is already linked: a child cannot also be their guardian's guardian.",
|
|
9226
|
-
{ rule: "person_link_reverse" }
|
|
9227
|
-
);
|
|
9228
|
-
}
|
|
9229
|
-
if (message.includes("UNIQUE constraint failed: core_person_link")) {
|
|
9230
|
-
return new ConflictError("These two are already linked.", { rule: "person_link" });
|
|
9231
|
-
}
|
|
9232
|
-
if (message.includes("UNIQUE constraint failed: core_recurrence_occurrence")) {
|
|
9233
|
-
return new ConflictError(
|
|
9234
|
-
"Another run made these records at the same moment. Nothing was changed.",
|
|
9235
|
-
{
|
|
9236
|
-
rule: "recurring_occurrence"
|
|
9237
|
-
}
|
|
9238
|
-
);
|
|
9239
|
-
}
|
|
9240
|
-
const unique = /UNIQUE constraint failed: ([\w.]+(?:, [\w.]+)*)/.exec(message);
|
|
9241
|
-
if (unique?.[1] && declaredUniqueKeys.has(unique[1])) {
|
|
9242
|
-
return new ConflictError(
|
|
9243
|
-
"A record like this one was made at the same moment, so this one was not",
|
|
9244
|
-
{
|
|
9245
|
-
rule: "unique",
|
|
9246
|
-
constraint: unique[1]
|
|
9247
|
-
}
|
|
9248
|
-
);
|
|
9249
|
-
}
|
|
9250
|
-
if (unique) {
|
|
9251
|
-
return new ConflictError("A record with that value already exists", {
|
|
9252
|
-
constraint: unique[1]
|
|
9253
|
-
});
|
|
9254
|
-
}
|
|
9255
|
-
if (/FOREIGN KEY constraint failed/.test(message)) {
|
|
9256
|
-
return new ValidationError("A referenced record does not exist");
|
|
9257
|
-
}
|
|
9258
|
-
if (/CHECK constraint failed/.test(message)) {
|
|
9259
|
-
return new ValidationError("A value is not allowed", { reason: message });
|
|
9260
|
-
}
|
|
9261
|
-
return new OperationError("internal", "Internal error", { reason: message });
|
|
9262
|
-
}
|
|
9263
|
-
var ALLOWANCE_REFUSED = /core_allowance_refused (\{[^{}]*\})/;
|
|
9264
|
-
var ALLOWANCE_MESSAGES = {
|
|
9265
|
-
no_uses_left: "No uses left in this period",
|
|
9266
|
-
spent_meanwhile: "Another booking took the last use at the same moment. Try again",
|
|
9267
|
-
not_theirs: "That pass or membership is not this person's",
|
|
9268
|
-
not_live: "That pass or membership cannot be used now (paused, ended or void)",
|
|
9269
|
-
not_yet_valid: "That pass or membership is not valid yet at this time",
|
|
9270
|
-
ended: "That pass or membership has ended by this time",
|
|
9271
|
-
no_holder: "Nothing this person holds can pay for this",
|
|
9272
|
-
not_covered: "That pass or membership does not cover this"
|
|
9273
|
-
};
|
|
9274
|
-
function allowanceMessage(details) {
|
|
9275
|
-
const base = ALLOWANCE_MESSAGES[details.reason] ?? "The allowance refused this";
|
|
9276
|
-
return details.reason === "no_uses_left" && details.uses !== void 0 ? `${base}: ${details.used ?? details.uses} of ${details.uses} spent` : base;
|
|
9277
|
-
}
|
|
9278
|
-
function allowanceRefusal(error) {
|
|
9279
|
-
if (error instanceof OperationError) return null;
|
|
9280
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
9281
|
-
const match = ALLOWANCE_REFUSED.exec(message);
|
|
9282
|
-
if (match) {
|
|
9283
|
-
let payload;
|
|
9284
|
-
try {
|
|
9285
|
-
payload = JSON.parse(match[1]);
|
|
9286
|
-
} catch {
|
|
9287
|
-
return new ValidationError("The allowance refused this", { rule: "allowance" });
|
|
9288
|
-
}
|
|
9289
|
-
const details = {
|
|
9290
|
-
rule: "allowance",
|
|
9291
|
-
reason: String(payload.reason),
|
|
9292
|
-
...typeof payload.object === "string" ? { object: payload.object } : {},
|
|
9293
|
-
...typeof payload.record === "string" ? { record: payload.record } : {},
|
|
9294
|
-
...typeof payload.period === "string" ? { period: payload.period } : {},
|
|
9295
|
-
...typeof payload.uses === "number" ? { uses: payload.uses } : {},
|
|
9296
|
-
...typeof payload.used === "number" ? { used: payload.used } : {},
|
|
9297
|
-
...typeof payload.at === "string" ? { at: payload.at } : {}
|
|
9298
|
-
};
|
|
9299
|
-
if (details.reason === "no_uses_left") {
|
|
9300
|
-
return new ConflictError(
|
|
9301
|
-
"Another booking took the last use at the same moment, so nothing was changed. Try again.",
|
|
9302
|
-
{ ...details, reason: "spent_meanwhile" }
|
|
9303
|
-
);
|
|
9304
|
-
}
|
|
9305
|
-
return new ValidationError(allowanceMessage(details), { ...details });
|
|
9306
|
-
}
|
|
9307
|
-
if (message.includes("UNIQUE constraint failed: core_allowance_use.spender_type")) {
|
|
9308
|
-
return new ConflictError(
|
|
9309
|
-
"This record spent a use at the same moment in another change, so nothing was changed.",
|
|
9310
|
-
{ rule: "allowance", reason: "spent_meanwhile" }
|
|
9311
|
-
);
|
|
9312
|
-
}
|
|
9313
|
-
return null;
|
|
9314
|
-
}
|
|
9315
|
-
var CAPACITY_REFUSED = /core_capacity_refused (\{[^{}]*\})/;
|
|
9316
|
-
function capacityRefusal(error) {
|
|
9317
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
9318
|
-
const match = CAPACITY_REFUSED.exec(message);
|
|
9319
|
-
if (match) {
|
|
9320
|
-
let payload;
|
|
9321
|
-
try {
|
|
9322
|
-
payload = JSON.parse(match[1]);
|
|
9323
|
-
} catch {
|
|
9324
|
-
return new ValidationError("Not enough places", { rule: "capacity" });
|
|
9325
|
-
}
|
|
9326
|
-
if (payload.asked > 0) {
|
|
9327
|
-
const details2 = {
|
|
9328
|
-
rule: "capacity",
|
|
9329
|
-
object: payload.object,
|
|
9330
|
-
record: payload.record,
|
|
9331
|
-
asked: payload.asked,
|
|
9332
|
-
available: payload.available
|
|
9333
|
-
};
|
|
9334
|
-
return new ValidationError(
|
|
9335
|
-
`Not enough places: asked for ${payload.asked}, ${payload.available} left`,
|
|
9336
|
-
details2
|
|
9337
|
-
);
|
|
9338
|
-
}
|
|
9339
|
-
const details = {
|
|
9340
|
-
rule: "capacity",
|
|
9341
|
-
object: payload.object,
|
|
9342
|
-
record: payload.record,
|
|
9343
|
-
places: payload.places,
|
|
9344
|
-
held: payload.held,
|
|
9345
|
-
taken: payload.taken
|
|
9346
|
-
};
|
|
9347
|
-
return new ValidationError(
|
|
9348
|
-
`Places cannot be fewer than are claimed: ${payload.held} held and ${payload.taken} taken`,
|
|
9349
|
-
details
|
|
9350
|
-
);
|
|
9351
|
-
}
|
|
9352
|
-
if (message.includes("core_capacity_within_places")) {
|
|
9353
|
-
return new ValidationError("Not enough places", { rule: "capacity" });
|
|
9354
|
-
}
|
|
9355
|
-
return null;
|
|
9356
|
-
}
|
|
9357
|
-
|
|
9358
9023
|
// ../core/src/fields/field-types.ts
|
|
9359
9024
|
var DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
9360
|
-
var DATETIME_RE = /^\d{4}-\d{2}-\d{2}T\d
|
|
9025
|
+
var DATETIME_RE = /^\d{4}-\d{2}-\d{2}T([01]\d|2[0-3]):[0-5]\d(:[0-5]\d(\.\d{1,9})?)?(Z|[+-]([01]\d|2[0-3]):[0-5]\d)$/;
|
|
9026
|
+
function isDatetime(value) {
|
|
9027
|
+
if (!DATETIME_RE.test(value) || !Number.isFinite(Date.parse(value))) return false;
|
|
9028
|
+
const [y, m, d] = value.slice(0, 10).split("-").map(Number);
|
|
9029
|
+
return m >= 1 && m <= 12 && d >= 1 && new Date(Date.UTC(y, m - 1, d)).getUTCDate() === d;
|
|
9030
|
+
}
|
|
9361
9031
|
var nullable = (schema) => schema.nullable();
|
|
9362
9032
|
var text = (max) => external_exports.string().max(max);
|
|
9363
9033
|
var identity = (value) => value === void 0 ? null : value;
|
|
@@ -9501,7 +9171,7 @@ var FIELD_TYPE_REGISTRY = {
|
|
|
9501
9171
|
filterType: () => "datetime",
|
|
9502
9172
|
multi: () => false,
|
|
9503
9173
|
sortable: () => true,
|
|
9504
|
-
schema: () => nullable(external_exports.string().
|
|
9174
|
+
schema: () => nullable(external_exports.string().refine(isDatetime, "Expected an ISO-8601 timestamp")),
|
|
9505
9175
|
toStorage: identity,
|
|
9506
9176
|
fromStorage: identity,
|
|
9507
9177
|
csv: {
|
|
@@ -9601,6 +9271,18 @@ var FIELD_TYPE_REGISTRY = {
|
|
|
9601
9271
|
"text",
|
|
9602
9272
|
external_exports.string().max(120).regex(SLUG_RE, "Lowercase letters and digits in words joined by hyphens")
|
|
9603
9273
|
),
|
|
9274
|
+
// A checklist template, by id (stage 45 step 4b, ADR 0650): an active one, checked on write.
|
|
9275
|
+
checklist: {
|
|
9276
|
+
storage: "TEXT",
|
|
9277
|
+
filterType: () => "id",
|
|
9278
|
+
multi: () => false,
|
|
9279
|
+
sortable: () => false,
|
|
9280
|
+
schema: () => nullable(external_exports.string().min(1).max(64)),
|
|
9281
|
+
toStorage: identity,
|
|
9282
|
+
fromStorage: identity,
|
|
9283
|
+
csv: csvText,
|
|
9284
|
+
widget: { display: "checklist", edit: "checklist" }
|
|
9285
|
+
},
|
|
9604
9286
|
formula: {
|
|
9605
9287
|
storage: null,
|
|
9606
9288
|
// Replaced by the formula's result type when the registry is built.
|
|
@@ -9712,6 +9394,11 @@ function formulaEnvironment(state, object, extension) {
|
|
|
9712
9394
|
env.createdAt = { type: "datetime", sql: "t.created_at" };
|
|
9713
9395
|
env.updatedAt = { type: "datetime", sql: "t.updated_at" };
|
|
9714
9396
|
const owner = splitObjectName(object)?.extension;
|
|
9397
|
+
const own = state.objects.find((o) => o.name === object);
|
|
9398
|
+
if (own?.definition.publishable && owner === extension) {
|
|
9399
|
+
env.publishedAt = { type: "datetime", sql: "pub.published_at" };
|
|
9400
|
+
env.publishedVersion = { type: "number", sql: "pub.version" };
|
|
9401
|
+
}
|
|
9715
9402
|
addFields(
|
|
9716
9403
|
env,
|
|
9717
9404
|
active.filter((f) => f.extensionId === owner),
|
|
@@ -9806,6 +9493,11 @@ function buildViews(state) {
|
|
|
9806
9493
|
columns.push(...capacity.columns);
|
|
9807
9494
|
joins.push(...capacity.joins);
|
|
9808
9495
|
}
|
|
9496
|
+
if (object.definition.stock) {
|
|
9497
|
+
const stock = stockView(object.name);
|
|
9498
|
+
columns.push(...stock.columns);
|
|
9499
|
+
joins.push(...stock.joins);
|
|
9500
|
+
}
|
|
9809
9501
|
if (object.definition.publishable) {
|
|
9810
9502
|
const published = publishedView(object.name);
|
|
9811
9503
|
columns.push(...published.columns);
|
|
@@ -9821,7 +9513,7 @@ function buildViews(state) {
|
|
|
9821
9513
|
`CREATE VIEW ${view} AS SELECT ${columns.join(", ")} FROM ${ident(object.tableName)} t${joins.length ? ` ${joins.join(" ")}` : ""} WHERE t.deleted_at IS NULL`
|
|
9822
9514
|
);
|
|
9823
9515
|
if (object.definition.publishable) {
|
|
9824
|
-
build.creates.push(liveViewSql(object, own
|
|
9516
|
+
build.creates.push(liveViewSql(object, own));
|
|
9825
9517
|
}
|
|
9826
9518
|
}
|
|
9827
9519
|
for (const object of state.objects) {
|
|
@@ -9829,11 +9521,12 @@ function buildViews(state) {
|
|
|
9829
9521
|
}
|
|
9830
9522
|
return build;
|
|
9831
9523
|
}
|
|
9832
|
-
function liveViewSql(object, own
|
|
9524
|
+
function liveViewSql(object, own) {
|
|
9833
9525
|
const publishable = object.definition.publishable;
|
|
9834
9526
|
const content = new Set(publishable.content);
|
|
9835
9527
|
const columns = ["t.id", "t.created_at", "pub.published_at AS updated_at", "t.created_by"];
|
|
9836
9528
|
for (const field of own) {
|
|
9529
|
+
if (isRestrictedField(field.definition)) continue;
|
|
9837
9530
|
const as = viewColumnName(object.extensionId, object.name, field.localName);
|
|
9838
9531
|
if (field.type === "formula" || !field.columnName) {
|
|
9839
9532
|
columns.push(`NULL AS ${as}`);
|
|
@@ -9856,11 +9549,16 @@ function liveViewSql(object, own, capacity) {
|
|
|
9856
9549
|
const joins = [
|
|
9857
9550
|
`JOIN core_publish_version pub ON pub.object_type = ${sqlString(object.name)} AND pub.record_id = t.id AND pub.current = 1`
|
|
9858
9551
|
];
|
|
9859
|
-
if (capacity) {
|
|
9552
|
+
if (object.definition.capacity) {
|
|
9860
9553
|
const view = capacityView(object.name);
|
|
9861
9554
|
columns.push(...view.columns);
|
|
9862
9555
|
joins.push(...view.joins);
|
|
9863
9556
|
}
|
|
9557
|
+
if (object.definition.stock) {
|
|
9558
|
+
const view = stockView(object.name);
|
|
9559
|
+
columns.push(...view.columns);
|
|
9560
|
+
joins.push(...view.joins);
|
|
9561
|
+
}
|
|
9864
9562
|
columns.push(
|
|
9865
9563
|
`pub.version AS ${PUBLISHED_COLUMNS.publishedVersion}`,
|
|
9866
9564
|
`pub.published_at AS ${PUBLISHED_COLUMNS.publishedAt}`,
|
|
@@ -9890,6 +9588,17 @@ function capacityView(object) {
|
|
|
9890
9588
|
]
|
|
9891
9589
|
};
|
|
9892
9590
|
}
|
|
9591
|
+
function stockView(object) {
|
|
9592
|
+
const name = `'${object.replaceAll("'", "''")}'`;
|
|
9593
|
+
return {
|
|
9594
|
+
joins: [`LEFT JOIN core_capacity stk ON stk.object_type = ${name} AND stk.record_id = t.id`],
|
|
9595
|
+
columns: [
|
|
9596
|
+
`coalesce(stk.places, 0) - coalesce(stk.taken, 0) AS ${STOCK_COLUMNS.onHand}`,
|
|
9597
|
+
`coalesce(stk.held, 0) AS ${STOCK_COLUMNS.held}`,
|
|
9598
|
+
`max(coalesce(stk.places, 0) - coalesce(stk.taken, 0) - coalesce(stk.held, 0), 0) AS ${STOCK_COLUMNS.available}`
|
|
9599
|
+
]
|
|
9600
|
+
};
|
|
9601
|
+
}
|
|
9893
9602
|
function allowanceView(object) {
|
|
9894
9603
|
const name = `'${object.replaceAll("'", "''")}'`;
|
|
9895
9604
|
return {
|
|
@@ -10039,6 +9748,43 @@ var CAPACITY_FIELDS = [
|
|
|
10039
9748
|
description: "Places left (the record's and its pool's, whichever is fewer). Empty: unlimited."
|
|
10040
9749
|
}
|
|
10041
9750
|
];
|
|
9751
|
+
var STOCK_COLUMNS = {
|
|
9752
|
+
onHand: "_stk_on_hand",
|
|
9753
|
+
held: "_stk_held",
|
|
9754
|
+
available: "_stk_available"
|
|
9755
|
+
};
|
|
9756
|
+
var STOCK_FIELDS = [
|
|
9757
|
+
{
|
|
9758
|
+
name: "onHand",
|
|
9759
|
+
label: "On hand",
|
|
9760
|
+
type: "number",
|
|
9761
|
+
column: STOCK_COLUMNS.onHand,
|
|
9762
|
+
filterable: true,
|
|
9763
|
+
sortable: true,
|
|
9764
|
+
readOnly: true,
|
|
9765
|
+
description: "How many there are, sold ones gone. Changed only by stock movements."
|
|
9766
|
+
},
|
|
9767
|
+
{
|
|
9768
|
+
name: "held",
|
|
9769
|
+
label: "Held",
|
|
9770
|
+
type: "number",
|
|
9771
|
+
column: STOCK_COLUMNS.held,
|
|
9772
|
+
filterable: true,
|
|
9773
|
+
sortable: true,
|
|
9774
|
+
readOnly: true,
|
|
9775
|
+
description: "How many orders being paid for hold."
|
|
9776
|
+
},
|
|
9777
|
+
{
|
|
9778
|
+
name: "available",
|
|
9779
|
+
label: "Available",
|
|
9780
|
+
type: "number",
|
|
9781
|
+
column: STOCK_COLUMNS.available,
|
|
9782
|
+
filterable: true,
|
|
9783
|
+
sortable: true,
|
|
9784
|
+
readOnly: true,
|
|
9785
|
+
description: "On hand less held: how many can be sold now."
|
|
9786
|
+
}
|
|
9787
|
+
];
|
|
10042
9788
|
var ALLOWANCE_COLUMNS = { used: "_alw_used", left: "_alw_left" };
|
|
10043
9789
|
var ALLOWANCE_FIELDS = [
|
|
10044
9790
|
{
|
|
@@ -10096,7 +9842,8 @@ function allowanceDefinition(object) {
|
|
|
10096
9842
|
local: { ...sp.local ?? {} },
|
|
10097
9843
|
...sp.movedFrom ? { movedFrom: { ...sp.movedFrom } } : {},
|
|
10098
9844
|
paidBy: [...sp.paidBy ?? []],
|
|
10099
|
-
...sp.waived ? { waived: sp.waived } : {}
|
|
9845
|
+
...sp.waived ? { waived: sp.waived } : {},
|
|
9846
|
+
...sp.released ? { released: sp.released } : {}
|
|
10100
9847
|
};
|
|
10101
9848
|
}
|
|
10102
9849
|
function capacityDefinition(object, own) {
|
|
@@ -10112,6 +9859,39 @@ function capacityDefinition(object, own) {
|
|
|
10112
9859
|
releaseOnRefund: declared.releaseOnRefund ?? true
|
|
10113
9860
|
};
|
|
10114
9861
|
}
|
|
9862
|
+
function stockDefinition(object, own) {
|
|
9863
|
+
const declared = object.definition.stock;
|
|
9864
|
+
if (!declared) return void 0;
|
|
9865
|
+
const nameOf = (local) => own.find((f) => f.localName === local)?.name ?? local;
|
|
9866
|
+
return {
|
|
9867
|
+
...declared.reorderAt ? { reorderAt: nameOf(declared.reorderAt) } : {},
|
|
9868
|
+
...declared.reorderQty ? { reorderQty: nameOf(declared.reorderQty) } : {},
|
|
9869
|
+
show: declared.show ?? "availability",
|
|
9870
|
+
...declared.lowAt !== void 0 ? { lowAt: declared.lowAt } : {},
|
|
9871
|
+
...declared.notify ? { notify: declared.notify } : {}
|
|
9872
|
+
};
|
|
9873
|
+
}
|
|
9874
|
+
function stockMovesDefinition(object, own) {
|
|
9875
|
+
const declared = object.definition.stockMoves;
|
|
9876
|
+
if (!declared) return void 0;
|
|
9877
|
+
const fieldOf = (local) => own.find((f) => f.localName === local);
|
|
9878
|
+
const on = fieldOf(declared.on);
|
|
9879
|
+
const through = declared.through ? fieldOf(declared.through) : void 0;
|
|
9880
|
+
if (!on?.definition.to || declared.through && !through?.definition.to) return void 0;
|
|
9881
|
+
const nameOf = (local) => local === void 0 ? void 0 : fieldOf(local)?.name ?? local;
|
|
9882
|
+
const kind = declared.kind ?? (declared.move === "add" ? "received" : declared.move === "set" ? "counted" : "written_off");
|
|
9883
|
+
return {
|
|
9884
|
+
move: declared.move,
|
|
9885
|
+
on: on.name,
|
|
9886
|
+
object: on.definition.to,
|
|
9887
|
+
quantity: nameOf(declared.quantity),
|
|
9888
|
+
when: declared.when,
|
|
9889
|
+
...through ? { through: through.name, throughObject: through.definition.to } : {},
|
|
9890
|
+
kind,
|
|
9891
|
+
...declared.unitCost ? { unitCost: nameOf(declared.unitCost) } : {},
|
|
9892
|
+
...declared.note ? { note: nameOf(declared.note) } : {}
|
|
9893
|
+
};
|
|
9894
|
+
}
|
|
10115
9895
|
function claimsDefinition(object, own) {
|
|
10116
9896
|
const declared = object.definition.claims;
|
|
10117
9897
|
if (!declared) return {};
|
|
@@ -10138,6 +9918,101 @@ function claimsDefinition(object, own) {
|
|
|
10138
9918
|
}
|
|
10139
9919
|
};
|
|
10140
9920
|
}
|
|
9921
|
+
function intakeDefinition(object, own) {
|
|
9922
|
+
const declared = object.definition.intake;
|
|
9923
|
+
if (!declared) return {};
|
|
9924
|
+
if (declared.role !== "submission") return { intake: declared };
|
|
9925
|
+
const formObject = own.find((f) => f.localName === declared.form)?.definition.to ?? "";
|
|
9926
|
+
return { intake: { ...declared, formObject } };
|
|
9927
|
+
}
|
|
9928
|
+
function staffedDefinition(object, own) {
|
|
9929
|
+
const declared = object.definition.staffed;
|
|
9930
|
+
if (!declared) return {};
|
|
9931
|
+
const holder = declared.who.account ? own.find((f) => f.localName === declared.who.field)?.definition.to : void 0;
|
|
9932
|
+
const timesFromObject = declared.timesFrom ? own.find((f) => f.localName === declared.timesFrom)?.definition.to : void 0;
|
|
9933
|
+
return {
|
|
9934
|
+
staffed: {
|
|
9935
|
+
...declared,
|
|
9936
|
+
who: {
|
|
9937
|
+
field: declared.who.field,
|
|
9938
|
+
...declared.who.account ? { account: declared.who.account, object: holder } : {}
|
|
9939
|
+
},
|
|
9940
|
+
live: [...declared.live],
|
|
9941
|
+
...declared.open ? {
|
|
9942
|
+
open: {
|
|
9943
|
+
...declared.open,
|
|
9944
|
+
...declared.open.closedBy ? {
|
|
9945
|
+
closedBy: {
|
|
9946
|
+
...declared.open.closedBy,
|
|
9947
|
+
object: `${object.extensionId}.${declared.open.closedBy.object}`
|
|
9948
|
+
}
|
|
9949
|
+
} : {}
|
|
9950
|
+
}
|
|
9951
|
+
} : {},
|
|
9952
|
+
...declared.evidence ? {
|
|
9953
|
+
evidence: {
|
|
9954
|
+
...declared.evidence,
|
|
9955
|
+
object: `${object.extensionId}.${declared.evidence.object}`
|
|
9956
|
+
}
|
|
9957
|
+
} : {},
|
|
9958
|
+
...timesFromObject ? { timesFromObject } : {}
|
|
9959
|
+
}
|
|
9960
|
+
};
|
|
9961
|
+
}
|
|
9962
|
+
function workedOnDefinition(object, own) {
|
|
9963
|
+
const declared = object.definition.workedOn;
|
|
9964
|
+
if (!declared) return {};
|
|
9965
|
+
const partOfObject = declared.partOf ? own.find((f) => f.localName === declared.partOf)?.definition.to : void 0;
|
|
9966
|
+
return {
|
|
9967
|
+
workedOn: {
|
|
9968
|
+
...declared,
|
|
9969
|
+
live: [...declared.live],
|
|
9970
|
+
...partOfObject ? { partOfObject } : {}
|
|
9971
|
+
}
|
|
9972
|
+
};
|
|
9973
|
+
}
|
|
9974
|
+
function occupiesDefinition(object, own) {
|
|
9975
|
+
const declared = object.definition.occupies;
|
|
9976
|
+
if (!declared) return {};
|
|
9977
|
+
const target = (local) => own.find((f) => f.localName === local)?.definition.to;
|
|
9978
|
+
const margin = (m) => {
|
|
9979
|
+
if (!m) return void 0;
|
|
9980
|
+
const [first, second] = m.field.split(".");
|
|
9981
|
+
return second === void 0 ? { field: first } : { field: second, via: first, viaObject: target(first) };
|
|
9982
|
+
};
|
|
9983
|
+
const before = margin(declared.before);
|
|
9984
|
+
const after = margin(declared.after);
|
|
9985
|
+
const title = margin(declared.title === void 0 ? void 0 : { field: declared.title });
|
|
9986
|
+
return {
|
|
9987
|
+
occupies: {
|
|
9988
|
+
thing: declared.thing,
|
|
9989
|
+
thingObject: target(declared.thing) ?? "",
|
|
9990
|
+
starts: declared.starts,
|
|
9991
|
+
ends: declared.ends,
|
|
9992
|
+
live: [...declared.live],
|
|
9993
|
+
...before ? { before } : {},
|
|
9994
|
+
...after ? { after } : {},
|
|
9995
|
+
...declared.only ? { only: declared.only } : {},
|
|
9996
|
+
...declared.provisional ? { provisional: [...declared.provisional] } : {},
|
|
9997
|
+
...title ? { title } : {}
|
|
9998
|
+
}
|
|
9999
|
+
};
|
|
10000
|
+
}
|
|
10001
|
+
function checklistsDefinition(object, own) {
|
|
10002
|
+
const declared = object.definition.checklists;
|
|
10003
|
+
if (!declared) return {};
|
|
10004
|
+
const [first, second] = declared.template.split(".");
|
|
10005
|
+
const viaObject2 = second !== void 0 ? own.find((f) => f.localName === first)?.definition.to : void 0;
|
|
10006
|
+
return {
|
|
10007
|
+
checklists: {
|
|
10008
|
+
template: second !== void 0 ? { field: second, via: first, viaObject: viaObject2 } : { field: first },
|
|
10009
|
+
who: declared.who,
|
|
10010
|
+
opens: declared.opens,
|
|
10011
|
+
closes: declared.closes,
|
|
10012
|
+
live: [...declared.live]
|
|
10013
|
+
}
|
|
10014
|
+
};
|
|
10015
|
+
}
|
|
10141
10016
|
function recurringDefinition(object) {
|
|
10142
10017
|
const declared = object.definition.recurring;
|
|
10143
10018
|
if (!declared) return {};
|
|
@@ -10166,7 +10041,8 @@ function recurringDefinition(object) {
|
|
|
10166
10041
|
object: named(declared.horizonAtLeast.object),
|
|
10167
10042
|
field: declared.horizonAtLeast.field
|
|
10168
10043
|
}
|
|
10169
|
-
} : {}
|
|
10044
|
+
} : {},
|
|
10045
|
+
...declared.horizonSetting ? { horizonSetting: { extension: object.extensionId, name: declared.horizonSetting } } : {}
|
|
10170
10046
|
}
|
|
10171
10047
|
};
|
|
10172
10048
|
}
|
|
@@ -10179,6 +10055,7 @@ function sellableDefinition(object, own) {
|
|
|
10179
10055
|
const currency = declared.currency ?? priceField?.definition.currency;
|
|
10180
10056
|
const { amount, balanceDue } = declared.deposit ?? {};
|
|
10181
10057
|
const grants = declared.grants;
|
|
10058
|
+
const finance = sellableFinance(declared.finance);
|
|
10182
10059
|
return {
|
|
10183
10060
|
price: nameOf(declared.price),
|
|
10184
10061
|
...currency ? { currency } : {},
|
|
@@ -10199,6 +10076,8 @@ function sellableDefinition(object, own) {
|
|
|
10199
10076
|
}
|
|
10200
10077
|
} : {},
|
|
10201
10078
|
...declared.onePerPerson ? { onePerPerson: nameOf(declared.onePerPerson) } : {},
|
|
10079
|
+
// Paths (`event.startsAt`) stay as declared, as moves' do; a field of the object is named.
|
|
10080
|
+
finance: finance.at?.includes(".") === false ? { ...finance, at: nameOf(finance.at) } : finance,
|
|
10202
10081
|
// Paths (`class.classType.dropInPrice`) stay as declared: the host's path reader names each
|
|
10203
10082
|
// part as the declaring extension's (ADR 0505); a field of the object is named here.
|
|
10204
10083
|
...declared.moves ? {
|
|
@@ -10243,6 +10122,7 @@ function sellableDefinition(object, own) {
|
|
|
10243
10122
|
maxDays: opt(declared.recurring.pause.maxDays)
|
|
10244
10123
|
}
|
|
10245
10124
|
} : {},
|
|
10125
|
+
...declared.recurring.coolingOff ? { coolingOff: { setting: declared.recurring.coolingOff.setting } } : {},
|
|
10246
10126
|
...declared.recurring.grants ? {
|
|
10247
10127
|
grants: {
|
|
10248
10128
|
...declared.recurring.grants,
|
|
@@ -10252,6 +10132,20 @@ function sellableDefinition(object, own) {
|
|
|
10252
10132
|
}
|
|
10253
10133
|
} : {}
|
|
10254
10134
|
}
|
|
10135
|
+
} : {},
|
|
10136
|
+
// A path (`item.whereSold`) stays as declared, as moves' do; a field of the object is named.
|
|
10137
|
+
...declared.goods ? {
|
|
10138
|
+
goods: declared.goods.soldIn ? {
|
|
10139
|
+
soldIn: declared.goods.soldIn.includes(".") ? declared.goods.soldIn : nameOf(declared.goods.soldIn)
|
|
10140
|
+
} : {}
|
|
10141
|
+
} : {},
|
|
10142
|
+
...declared.delivery ? {
|
|
10143
|
+
delivery: {
|
|
10144
|
+
kind: nameOf(declared.delivery.kind),
|
|
10145
|
+
freeOver: opt(declared.delivery.freeOver),
|
|
10146
|
+
countries: opt(declared.delivery.countries),
|
|
10147
|
+
active: opt(declared.delivery.active)
|
|
10148
|
+
}
|
|
10255
10149
|
} : {}
|
|
10256
10150
|
};
|
|
10257
10151
|
}
|
|
@@ -10341,7 +10235,17 @@ var SYSTEM_FIELDS = [
|
|
|
10341
10235
|
];
|
|
10342
10236
|
function buildRegistry(state) {
|
|
10343
10237
|
const map = /* @__PURE__ */ new Map();
|
|
10344
|
-
const active = state.fields.filter(
|
|
10238
|
+
const active = state.fields.filter(
|
|
10239
|
+
(f) => f.status === "active" && !isRestrictedField(f.definition)
|
|
10240
|
+
);
|
|
10241
|
+
const restrictedOf = (object) => state.fields.filter(
|
|
10242
|
+
(f) => f.status === "active" && f.object === object.name && f.extensionId === object.extensionId && isRestrictedField(f.definition)
|
|
10243
|
+
).map((f) => ({
|
|
10244
|
+
name: f.name,
|
|
10245
|
+
label: f.definition.label,
|
|
10246
|
+
permission: f.definition.restricted,
|
|
10247
|
+
fieldType: f.type === "longText" ? "longText" : "text"
|
|
10248
|
+
}));
|
|
10345
10249
|
for (const [name, core] of Object.entries(CORE_OBJECTS)) {
|
|
10346
10250
|
const extra = active.filter((f) => f.object === name).flatMap((f) => [registryField(f, name), ...documentPathFields(f, name)]);
|
|
10347
10251
|
if (extra.length) map.set(name, { ...core, fields: [...core.fields, ...extra] });
|
|
@@ -10358,14 +10262,27 @@ function buildRegistry(state) {
|
|
|
10358
10262
|
);
|
|
10359
10263
|
const capacity = capacityDefinition(object, own);
|
|
10360
10264
|
const sellable = sellableDefinition(object, own);
|
|
10265
|
+
const stock = stockDefinition(object, own);
|
|
10266
|
+
const stockMoves = stockMovesDefinition(object, own);
|
|
10361
10267
|
const allowance = allowanceDefinition(object);
|
|
10268
|
+
const discount = object.definition.discount ? {
|
|
10269
|
+
...object.definition.discount,
|
|
10270
|
+
...object.definition.discount.codes ? {
|
|
10271
|
+
codes: {
|
|
10272
|
+
...object.definition.discount.codes,
|
|
10273
|
+
object: `${object.extensionId}.${object.definition.discount.codes.object}`
|
|
10274
|
+
}
|
|
10275
|
+
} : {}
|
|
10276
|
+
} : void 0;
|
|
10362
10277
|
const publishable = object.definition.publishable;
|
|
10278
|
+
const restricted = restrictedOf(object);
|
|
10363
10279
|
const fields = [
|
|
10364
10280
|
...SYSTEM_FIELDS,
|
|
10365
10281
|
...own.map((f) => registryField(f, object.name)),
|
|
10366
10282
|
...foreign.map((f) => registryField(f, object.name)),
|
|
10367
10283
|
...[...own, ...foreign].flatMap((f) => documentPathFields(f, object.name)),
|
|
10368
10284
|
...capacity ? CAPACITY_FIELDS : [],
|
|
10285
|
+
...stock ? STOCK_FIELDS : [],
|
|
10369
10286
|
...allowance?.kind === "holder" ? ALLOWANCE_FIELDS : [],
|
|
10370
10287
|
...publishable ? PUBLISHED_FIELDS : []
|
|
10371
10288
|
];
|
|
@@ -10385,11 +10302,29 @@ function buildRegistry(state) {
|
|
|
10385
10302
|
...object.definition.stages ? { stages: object.definition.stages } : {},
|
|
10386
10303
|
...capacity ? { capacity } : {},
|
|
10387
10304
|
...sellable ? { sellable } : {},
|
|
10305
|
+
...stock ? { stock } : {},
|
|
10306
|
+
...stockMoves ? { stockMoves } : {},
|
|
10388
10307
|
...allowance ? { allowance } : {},
|
|
10308
|
+
...discount ? { discount } : {},
|
|
10309
|
+
...object.definition.agreements ? { agreements: object.definition.agreements } : {},
|
|
10310
|
+
...object.definition.healthNotes ? { healthNotes: object.definition.healthNotes } : {},
|
|
10311
|
+
...restricted.length ? { restricted } : {},
|
|
10389
10312
|
...object.definition.states ? { states: object.definition.states } : {},
|
|
10313
|
+
...object.definition.signals?.length ? { signals: object.definition.signals } : {},
|
|
10390
10314
|
...claimsDefinition(object, own),
|
|
10391
10315
|
...object.definition.unique?.length ? { unique: object.definition.unique } : {},
|
|
10392
10316
|
...recurringDefinition(object),
|
|
10317
|
+
...staffedDefinition(object, own),
|
|
10318
|
+
...workedOnDefinition(object, own),
|
|
10319
|
+
...occupiesDefinition(object, own),
|
|
10320
|
+
...object.definition.calendarEntry ? {
|
|
10321
|
+
calendarEntry: {
|
|
10322
|
+
...object.definition.calendarEntry,
|
|
10323
|
+
live: [...object.definition.calendarEntry.live]
|
|
10324
|
+
}
|
|
10325
|
+
} : {},
|
|
10326
|
+
...intakeDefinition(object, own),
|
|
10327
|
+
...checklistsDefinition(object, own),
|
|
10393
10328
|
...object.definition.owner ? { ownerField: object.definition.owner } : {},
|
|
10394
10329
|
...object.definition.customer ? { customer: object.definition.customer } : {},
|
|
10395
10330
|
...object.definition.public ? { public: object.definition.public } : {},
|
|
@@ -10400,7 +10335,18 @@ function buildRegistry(state) {
|
|
|
10400
10335
|
publishable: {
|
|
10401
10336
|
content: [...publishable.content],
|
|
10402
10337
|
...publishable.slug ? { slug: publishable.slug } : {},
|
|
10403
|
-
...publishable.date ? { date: publishable.date } : {}
|
|
10338
|
+
...publishable.date ? { date: publishable.date } : {},
|
|
10339
|
+
...publishable.publishIn ? { publishIn: [...publishable.publishIn] } : {},
|
|
10340
|
+
...publishable.acknowledge ? {
|
|
10341
|
+
acknowledge: {
|
|
10342
|
+
who: publishable.acknowledge.who,
|
|
10343
|
+
manage: publishable.acknowledge.manage,
|
|
10344
|
+
...publishable.acknowledge.managed ? { managed: [...publishable.acknowledge.managed] } : {},
|
|
10345
|
+
...publishable.acknowledge.owner ? { owner: publishable.acknowledge.owner } : {},
|
|
10346
|
+
...publishable.acknowledge.notices ? { notices: publishable.acknowledge.notices } : {}
|
|
10347
|
+
}
|
|
10348
|
+
} : {},
|
|
10349
|
+
...publishable.staffRead ? { staffRead: true } : {}
|
|
10404
10350
|
}
|
|
10405
10351
|
} : {},
|
|
10406
10352
|
...object.definition.navigationOrder !== void 0 ? { navigationOrder: object.definition.navigationOrder } : {},
|
|
@@ -10431,7 +10377,7 @@ async function refreshSchemaRegistry(db) {
|
|
|
10431
10377
|
const objects = buildRegistry(state);
|
|
10432
10378
|
const storage = /* @__PURE__ */ new Map();
|
|
10433
10379
|
for (const f of state.fields) {
|
|
10434
|
-
if (f.status !== "active") continue;
|
|
10380
|
+
if (f.status !== "active" || isRestrictedField(f.definition)) continue;
|
|
10435
10381
|
const owner = state.objects.find((o) => o.name === f.object);
|
|
10436
10382
|
storage.set(`${f.object}|${f.name}`, {
|
|
10437
10383
|
extension: f.extensionId,
|
|
@@ -10538,7 +10484,14 @@ var originSchema = external_exports.object({
|
|
|
10538
10484
|
/** The extension whose code made the call (actor `extension`). */
|
|
10539
10485
|
extensionId: external_exports.string().optional(),
|
|
10540
10486
|
/** The agent that made the call (job_…, ADR 0344). Its session is `job:<id>`. */
|
|
10541
|
-
jobId: external_exports.string().optional()
|
|
10487
|
+
jobId: external_exports.string().optional(),
|
|
10488
|
+
/**
|
|
10489
|
+
* A staff call over a device session (ADR 0455), not a browser's: the company's app on a phone
|
|
10490
|
+
* (a role client or the owner's client, on the device's one staff session, ADR 0451) or the
|
|
10491
|
+
* command line's import door. Set by the HTTP surface from the session, never from the request;
|
|
10492
|
+
* recorded in the audit row. A setup change is never made or approved from it (stage 60, ADR 0872).
|
|
10493
|
+
*/
|
|
10494
|
+
staffDevice: external_exports.boolean().optional()
|
|
10542
10495
|
});
|
|
10543
10496
|
var ROLES = ["admin", "member", "viewer"];
|
|
10544
10497
|
var PERMISSIONS = [
|
|
@@ -10554,11 +10507,48 @@ var PERMISSIONS = [
|
|
|
10554
10507
|
"orders:refund",
|
|
10555
10508
|
"records:publish",
|
|
10556
10509
|
"subscriptions:manage",
|
|
10557
|
-
"people:link"
|
|
10510
|
+
"people:link",
|
|
10511
|
+
"agreements:manage",
|
|
10512
|
+
"agreements:paper",
|
|
10513
|
+
"agreements:health",
|
|
10514
|
+
"agreements:desk",
|
|
10515
|
+
"checklists:write",
|
|
10516
|
+
"invoices:write",
|
|
10517
|
+
"invoices:send",
|
|
10518
|
+
"invoices:credit",
|
|
10519
|
+
"invoices:payments",
|
|
10520
|
+
"accounting:manage",
|
|
10521
|
+
"inbox:read",
|
|
10522
|
+
"inbox:work",
|
|
10523
|
+
"inbox:manage",
|
|
10524
|
+
"notes:clients",
|
|
10525
|
+
"notes:sensitive",
|
|
10526
|
+
"notes:manage",
|
|
10527
|
+
"journeys:read",
|
|
10528
|
+
"journeys:manage",
|
|
10529
|
+
"journeys:publish",
|
|
10530
|
+
"orders:discount",
|
|
10531
|
+
"orders:payments",
|
|
10532
|
+
"people:cards",
|
|
10533
|
+
"stock:adjust",
|
|
10534
|
+
"finance:read",
|
|
10535
|
+
"finance:close",
|
|
10536
|
+
"bookingSystem:manage",
|
|
10537
|
+
"practitioners:manage"
|
|
10538
|
+
];
|
|
10539
|
+
var CORE_PERMISSION_NAMESPACES = [
|
|
10540
|
+
...new Set(PERMISSIONS.map((p) => p.split(":")[0]))
|
|
10558
10541
|
];
|
|
10559
10542
|
var ROLE_PERMISSIONS = {
|
|
10560
|
-
viewer: ["records:read"],
|
|
10561
|
-
member: [
|
|
10543
|
+
viewer: ["records:read", "inbox:read"],
|
|
10544
|
+
member: [
|
|
10545
|
+
"records:read",
|
|
10546
|
+
"records:write",
|
|
10547
|
+
"journeys:read",
|
|
10548
|
+
"people:cards",
|
|
10549
|
+
"inbox:read",
|
|
10550
|
+
"inbox:work"
|
|
10551
|
+
],
|
|
10562
10552
|
admin: PERMISSIONS
|
|
10563
10553
|
};
|
|
10564
10554
|
function roleHasPermission(role, permission) {
|
|
@@ -10568,8 +10558,39 @@ var GRANTABLE_PERMISSIONS = [
|
|
|
10568
10558
|
"records:publish",
|
|
10569
10559
|
"orders:refund",
|
|
10570
10560
|
"subscriptions:manage",
|
|
10571
|
-
"people:link"
|
|
10561
|
+
"people:link",
|
|
10562
|
+
"agreements:manage",
|
|
10563
|
+
"agreements:paper",
|
|
10564
|
+
"agreements:health",
|
|
10565
|
+
"agreements:desk",
|
|
10566
|
+
"checklists:write",
|
|
10567
|
+
"invoices:write",
|
|
10568
|
+
"invoices:send",
|
|
10569
|
+
"invoices:credit",
|
|
10570
|
+
"invoices:payments",
|
|
10571
|
+
"accounting:manage",
|
|
10572
|
+
"notes:clients",
|
|
10573
|
+
"notes:sensitive",
|
|
10574
|
+
"notes:manage",
|
|
10575
|
+
"journeys:manage",
|
|
10576
|
+
"journeys:publish",
|
|
10577
|
+
"orders:discount",
|
|
10578
|
+
"orders:payments",
|
|
10579
|
+
"people:cards",
|
|
10580
|
+
"stock:adjust",
|
|
10581
|
+
"finance:read",
|
|
10582
|
+
"finance:close",
|
|
10583
|
+
"bookingSystem:manage",
|
|
10584
|
+
"practitioners:manage"
|
|
10585
|
+
];
|
|
10586
|
+
var RESTRICTED_CORE_PERMISSIONS = [
|
|
10587
|
+
"notes:clients",
|
|
10588
|
+
"notes:sensitive",
|
|
10589
|
+
"notes:manage",
|
|
10590
|
+
"orders:payments",
|
|
10591
|
+
"invoices:payments"
|
|
10572
10592
|
];
|
|
10593
|
+
var FIXED_ROLE_CORE_GRANTS = ["people:cards", "agreements:desk"];
|
|
10573
10594
|
function holdsPermission(user, grants, permission) {
|
|
10574
10595
|
return roleHasPermission(user.role, permission) || GRANTABLE_PERMISSIONS.includes(permission) && (grants ?? []).includes(permission);
|
|
10575
10596
|
}
|
|
@@ -10577,10 +10598,15 @@ var MCP_SCOPES = ["read", "write", "admin"];
|
|
|
10577
10598
|
function grantableScopes(role) {
|
|
10578
10599
|
return role === "admin" ? [...MCP_SCOPES] : ["read", "write"];
|
|
10579
10600
|
}
|
|
10601
|
+
function placedAs(principal) {
|
|
10602
|
+
if (principal.kind === "device") throw new Error("An enrolled device places no order");
|
|
10603
|
+
if (principal.kind === "practitioner") throw new Error("A practitioner places no order");
|
|
10604
|
+
return principal.kind;
|
|
10605
|
+
}
|
|
10580
10606
|
function staffPrincipal(user) {
|
|
10581
10607
|
return Object.freeze({ kind: "staff", userId: user.id, role: user.role });
|
|
10582
10608
|
}
|
|
10583
|
-
var OUTSIDE_ACTORS = ["customer", "public"];
|
|
10609
|
+
var OUTSIDE_ACTORS = ["customer", "public", "device", "practitioner"];
|
|
10584
10610
|
var ALL_ACTORS = [...ACTORS, ...OUTSIDE_ACTORS];
|
|
10585
10611
|
|
|
10586
10612
|
// ../core/src/records/columns.ts
|
|
@@ -10640,15 +10666,17 @@ async function familyOf(reader) {
|
|
|
10640
10666
|
const principal = reader.principal;
|
|
10641
10667
|
if (principal.kind !== "customer") return { self: null, dependants: [], guardians: [] };
|
|
10642
10668
|
const me = principal.personId;
|
|
10643
|
-
const own
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10669
|
+
const [own, dependants, guardians] = await Promise.all([
|
|
10670
|
+
sql`SELECT display_name AS name FROM core_person WHERE id = ${me} AND deleted_at IS NULL`.execute(
|
|
10671
|
+
reader.db
|
|
10672
|
+
),
|
|
10673
|
+
sql`SELECT p.id AS id, p.display_name AS name FROM core_person p WHERE p.id IN (${dependantsSql(me)}) ORDER BY p.display_name, p.id`.execute(
|
|
10674
|
+
reader.db
|
|
10675
|
+
),
|
|
10676
|
+
sql`SELECT p.id AS id, p.display_name AS name FROM core_person_link l JOIN core_person p ON p.id = l.guardian_id AND p.deleted_at IS NULL JOIN core_person me ON me.id = l.dependant_id AND me.deleted_at IS NULL WHERE l.dependant_id = ${me} AND l.kind = ${GUARDIAN_LINK} AND l.ended_at IS NULL ORDER BY p.display_name, p.id`.execute(
|
|
10677
|
+
reader.db
|
|
10678
|
+
)
|
|
10679
|
+
]);
|
|
10652
10680
|
const shown = (rows) => rows.map((row) => ({ personId: String(row.id), name: String(row.name) }));
|
|
10653
10681
|
return {
|
|
10654
10682
|
self: { personId: me, name: String(own.rows[0]?.name ?? "") },
|
|
@@ -10656,6 +10684,20 @@ async function familyOf(reader) {
|
|
|
10656
10684
|
guardians: shown(guardians.rows)
|
|
10657
10685
|
};
|
|
10658
10686
|
}
|
|
10687
|
+
async function dependantFirstNames(reader) {
|
|
10688
|
+
const principal = reader.principal;
|
|
10689
|
+
if (principal.kind !== "customer") return /* @__PURE__ */ new Map();
|
|
10690
|
+
const { rows } = await sql`SELECT p.id AS id, p.given_name AS given, p.display_name AS name FROM core_person p WHERE p.id IN (${dependantsSql(principal.personId)})`.execute(
|
|
10691
|
+
reader.db
|
|
10692
|
+
);
|
|
10693
|
+
return new Map(
|
|
10694
|
+
rows.map((row) => {
|
|
10695
|
+
const given = (row.given ?? "").trim();
|
|
10696
|
+
const display = (row.name ?? "").trim();
|
|
10697
|
+
return [String(row.id), given || display.split(/\s+/)[0] || display || "Child"];
|
|
10698
|
+
})
|
|
10699
|
+
);
|
|
10700
|
+
}
|
|
10659
10701
|
async function recordsMadeFor(db, guardianId, dependantId) {
|
|
10660
10702
|
const out = [];
|
|
10661
10703
|
for (const object of listObjects()) {
|
|
@@ -10682,11 +10724,73 @@ async function sharedEmailWarning(db, guardianId, dependantId) {
|
|
|
10682
10724
|
if (!rows.length) return null;
|
|
10683
10725
|
return `The child's record has an email that is also the parent's or another account's (${rows.map((r) => r.shared).join(", ")}). Signing in with it would open that account as the child's: give the child their own address or none.`;
|
|
10684
10726
|
}
|
|
10727
|
+
async function hasLiveGuardian(db, personId) {
|
|
10728
|
+
const { rows } = await sql`SELECT 1 AS one FROM core_person_link l JOIN core_person g ON g.id = l.guardian_id AND g.deleted_at IS NULL WHERE l.dependant_id = ${personId} AND l.kind = ${GUARDIAN_LINK} AND l.ended_at IS NULL LIMIT 1`.execute(
|
|
10729
|
+
db
|
|
10730
|
+
);
|
|
10731
|
+
return rows.length > 0;
|
|
10732
|
+
}
|
|
10733
|
+
var ADDRESSES_PER_STATEMENT = 90;
|
|
10734
|
+
function mailboxSql(column) {
|
|
10735
|
+
const e = sql.ref(column);
|
|
10736
|
+
const local = sql`CASE WHEN instr(${e}, '+') > 1 AND instr(${e}, '+') < instr(${e}, '@') THEN substr(${e}, 1, instr(${e}, '+') - 1) ELSE substr(${e}, 1, instr(${e}, '@') - 1) END`;
|
|
10737
|
+
const tagless = sql`CASE WHEN instr(${e}, '+') > 1 AND instr(${e}, '+') < instr(${e}, '@') THEN substr(${e}, 1, instr(${e}, '+') - 1) || substr(${e}, instr(${e}, '@')) ELSE ${e} END`;
|
|
10738
|
+
return sql`(CASE WHEN substr(${e}, instr(${e}, '@') + 1) IN ('gmail.com', 'googlemail.com') THEN replace(${local}, '.', '') || '@gmail.com' ELSE ${tagless} END)`;
|
|
10739
|
+
}
|
|
10740
|
+
async function peopleAtAddresses(db, mailboxes) {
|
|
10741
|
+
const out = /* @__PURE__ */ new Map();
|
|
10742
|
+
const all = [...new Set(mailboxes)];
|
|
10743
|
+
const form = mailboxSql("e.email");
|
|
10744
|
+
for (let i = 0; i < all.length; i += ADDRESSES_PER_STATEMENT) {
|
|
10745
|
+
const chunk = all.slice(i, i + ADDRESSES_PER_STATEMENT);
|
|
10746
|
+
const { rows } = await sql`SELECT ${form} AS folded, p.id AS id, ${childSql()} AS child FROM core_person_emails e JOIN core_person p ON p.id = e.person_id AND p.deleted_at IS NULL WHERE e.live = 1 AND ${form} IN (${sql.join(chunk)})`.execute(
|
|
10747
|
+
db
|
|
10748
|
+
);
|
|
10749
|
+
collectHolders(out, rows);
|
|
10750
|
+
}
|
|
10751
|
+
return out;
|
|
10752
|
+
}
|
|
10753
|
+
async function peopleAtNumbers(db, numbers) {
|
|
10754
|
+
const out = /* @__PURE__ */ new Map();
|
|
10755
|
+
const all = [...new Set(numbers)];
|
|
10756
|
+
for (let i = 0; i < all.length; i += ADDRESSES_PER_STATEMENT) {
|
|
10757
|
+
const chunk = all.slice(i, i + ADDRESSES_PER_STATEMENT);
|
|
10758
|
+
const { rows } = await sql`SELECT n.number_normalised AS folded, p.id AS id, ${childSql()} AS child FROM core_person_phones n JOIN core_person p ON p.id = n.person_id AND p.deleted_at IS NULL WHERE n.number_normalised IN (${sql.join(chunk)})`.execute(
|
|
10759
|
+
db
|
|
10760
|
+
);
|
|
10761
|
+
collectHolders(out, rows);
|
|
10762
|
+
}
|
|
10763
|
+
return out;
|
|
10764
|
+
}
|
|
10765
|
+
function childSql() {
|
|
10766
|
+
return sql`EXISTS (SELECT 1 FROM core_person_link l JOIN core_person g ON g.id = l.guardian_id AND g.deleted_at IS NULL WHERE l.dependant_id = p.id AND l.kind = ${GUARDIAN_LINK} AND l.ended_at IS NULL)`;
|
|
10767
|
+
}
|
|
10768
|
+
function collectHolders(out, rows) {
|
|
10769
|
+
for (const row of rows) {
|
|
10770
|
+
const holders = out.get(row.folded) ?? [];
|
|
10771
|
+
if (!holders.some((h) => h.id === row.id)) {
|
|
10772
|
+
holders.push({ id: row.id, child: Number(row.child) === 1 });
|
|
10773
|
+
}
|
|
10774
|
+
out.set(row.folded, holders);
|
|
10775
|
+
}
|
|
10776
|
+
}
|
|
10777
|
+
async function livePersonAfterMerges(db, personId) {
|
|
10778
|
+
let id = personId;
|
|
10779
|
+
for (let hop = 0; hop < 5; hop += 1) {
|
|
10780
|
+
const { rows } = await sql`SELECT deleted_at, merged_into_id FROM core_person WHERE id = ${id}`.execute(db);
|
|
10781
|
+
const row = rows[0];
|
|
10782
|
+
if (!row) return null;
|
|
10783
|
+
if (row.deleted_at === null) return id;
|
|
10784
|
+
if (!row.merged_into_id) return null;
|
|
10785
|
+
id = row.merged_into_id;
|
|
10786
|
+
}
|
|
10787
|
+
return null;
|
|
10788
|
+
}
|
|
10685
10789
|
|
|
10686
10790
|
// ../core/src/visibility/public.ts
|
|
10687
10791
|
function publicProblems(object) {
|
|
10688
10792
|
const problems = readProblems(object, "public");
|
|
10689
|
-
if (object.public && object.customer) {
|
|
10793
|
+
if (object.public && object.customer && !object.publishable) {
|
|
10690
10794
|
problems.unshift("an object declares customer or public, not both");
|
|
10691
10795
|
}
|
|
10692
10796
|
if (object.public && object.publishable) problems.push(...contentProblems(object));
|
|
@@ -10697,9 +10801,7 @@ function contentProblems(object) {
|
|
|
10697
10801
|
const publishable = object.publishable;
|
|
10698
10802
|
if (!declared || !publishable) return [];
|
|
10699
10803
|
const problems = [];
|
|
10700
|
-
if (!publishable.slug) {
|
|
10701
|
-
problems.push("a publishable object the public reads names its slug (publishable.slug)");
|
|
10702
|
-
} else if (!declared.read.includes(publishable.slug)) {
|
|
10804
|
+
if (publishable.slug && !declared.read.includes(publishable.slug)) {
|
|
10703
10805
|
problems.push(`public.read lists the slug "${publishable.slug}": it is how the public reads`);
|
|
10704
10806
|
}
|
|
10705
10807
|
const content = new Set(publishable.content);
|
|
@@ -10713,8 +10815,19 @@ function contentProblems(object) {
|
|
|
10713
10815
|
problems.push(`public.read lists "${name}", a path of a document that is not content`);
|
|
10714
10816
|
}
|
|
10715
10817
|
}
|
|
10716
|
-
if (object.
|
|
10717
|
-
problems.push("a publishable object the public reads declares no
|
|
10818
|
+
if (object.customerVia) {
|
|
10819
|
+
problems.push("a publishable object the public reads declares no customerVia");
|
|
10820
|
+
}
|
|
10821
|
+
if (object.customer) {
|
|
10822
|
+
if (publishable.slug) problems.push("a publishable object with an author has no slug");
|
|
10823
|
+
if (declared.read.includes(object.customer.field)) {
|
|
10824
|
+
problems.push(`public.read lists "${object.customer.field}", the author`);
|
|
10825
|
+
}
|
|
10826
|
+
for (const name of declared.read) {
|
|
10827
|
+
if (object.customer.write.includes(name) && !content.has(name)) {
|
|
10828
|
+
problems.push(`public.read lists "${name}", which the author writes and is not content`);
|
|
10829
|
+
}
|
|
10830
|
+
}
|
|
10718
10831
|
}
|
|
10719
10832
|
return problems;
|
|
10720
10833
|
}
|
|
@@ -10749,13 +10862,23 @@ function readProblems(object, key) {
|
|
|
10749
10862
|
if (typeof condition === "string") problems.push(condition);
|
|
10750
10863
|
return problems;
|
|
10751
10864
|
}
|
|
10752
|
-
function resolveCondition(object, declared, key = "public") {
|
|
10865
|
+
function resolveCondition(object, declared, key = "public", depth = 0) {
|
|
10753
10866
|
const { when } = declared;
|
|
10754
10867
|
if (!when) return null;
|
|
10868
|
+
const list = Array.isArray(when) ? when : [when];
|
|
10869
|
+
const resolved = [];
|
|
10870
|
+
for (const condition of list) {
|
|
10871
|
+
const one = resolveOne(object, condition, key, depth);
|
|
10872
|
+
if (typeof one === "string") return one;
|
|
10873
|
+
resolved.push(one);
|
|
10874
|
+
}
|
|
10875
|
+
return resolved;
|
|
10876
|
+
}
|
|
10877
|
+
function resolveOne(object, when, key, depth) {
|
|
10755
10878
|
const fieldOf = (o, name) => o.fields.find((f) => f.name === name);
|
|
10756
10879
|
if (when.via === void 0) {
|
|
10757
|
-
const own = fieldOf(object, when.field);
|
|
10758
|
-
if (
|
|
10880
|
+
const own = when.field === void 0 ? void 0 : fieldOf(object, when.field);
|
|
10881
|
+
if (own?.fieldType !== "select" || !own.column || !when.in) {
|
|
10759
10882
|
return `${key}.when.field "${when.field}" must be a select field`;
|
|
10760
10883
|
}
|
|
10761
10884
|
return { column: own.column, values: [...when.in] };
|
|
@@ -10763,11 +10886,27 @@ function resolveCondition(object, declared, key = "public") {
|
|
|
10763
10886
|
const via = fieldOf(object, when.via);
|
|
10764
10887
|
const to = via?.options?.to;
|
|
10765
10888
|
const target = to ? getObject(to) : void 0;
|
|
10766
|
-
if (
|
|
10889
|
+
if (via?.fieldType !== "relation" || via.options?.many || !via.column || !target) {
|
|
10767
10890
|
return `${key}.when.via "${when.via}" must be a relation to one record`;
|
|
10768
10891
|
}
|
|
10769
|
-
|
|
10770
|
-
|
|
10892
|
+
if (when.field === void 0 && when.in === void 0) {
|
|
10893
|
+
if (key !== "public") return `${key}.when.via "${when.via}" alone is the public's`;
|
|
10894
|
+
const declared = target.public;
|
|
10895
|
+
if (!declared) return `public.when.via "${when.via}" alone: ${target.name} declares no public`;
|
|
10896
|
+
if (depth > 0) return `public.when.via "${when.via}" alone: one step only, no chains`;
|
|
10897
|
+
const conditions = resolveCondition(target, declared, "public", depth + 1);
|
|
10898
|
+
if (typeof conditions === "string") return conditions;
|
|
10899
|
+
return {
|
|
10900
|
+
column: via.column,
|
|
10901
|
+
values: [],
|
|
10902
|
+
public: {
|
|
10903
|
+
source: target.publishable ? liveViewOf(target.name) : target.source,
|
|
10904
|
+
conditions: conditions ?? []
|
|
10905
|
+
}
|
|
10906
|
+
};
|
|
10907
|
+
}
|
|
10908
|
+
const tested = when.field === void 0 ? void 0 : fieldOf(target, when.field);
|
|
10909
|
+
if (tested?.fieldType !== "select" || !tested.column || !when.in) {
|
|
10771
10910
|
return `${key}.when.field "${when.field}" must be a select field of ${target.name}`;
|
|
10772
10911
|
}
|
|
10773
10912
|
return {
|
|
@@ -10824,6 +10963,7 @@ function customerProblems(object) {
|
|
|
10824
10963
|
if (!declared) return [];
|
|
10825
10964
|
const problems = [];
|
|
10826
10965
|
const field = (name) => object.fields.find((f) => f.name === name);
|
|
10966
|
+
const restricted = new Set((object.restricted ?? []).map((f) => f.name));
|
|
10827
10967
|
const owner = field(declared.field);
|
|
10828
10968
|
if (!owner?.column) {
|
|
10829
10969
|
problems.push(`customer.field "${declared.field}" is not a single-valued field`);
|
|
@@ -10839,6 +10979,7 @@ function customerProblems(object) {
|
|
|
10839
10979
|
]) {
|
|
10840
10980
|
if (new Set(names).size !== names.length) problems.push(`customer.${key} lists a field twice`);
|
|
10841
10981
|
for (const name of names) {
|
|
10982
|
+
if (restricted.has(name)) continue;
|
|
10842
10983
|
const f = field(name);
|
|
10843
10984
|
if (!f) problems.push(`customer.${key} lists "${name}", which is not a field`);
|
|
10844
10985
|
else if (!viewColumnOf(f))
|
|
@@ -10918,10 +11059,56 @@ function unknownObject(name) {
|
|
|
10918
11059
|
return new ValidationError(`Unknown object "${name}"`, { object: name });
|
|
10919
11060
|
}
|
|
10920
11061
|
|
|
11062
|
+
// ../core/src/visibility/notes.ts
|
|
11063
|
+
var NOTE_LEVELS = [
|
|
11064
|
+
"staff",
|
|
11065
|
+
"coaches",
|
|
11066
|
+
"sensitive"
|
|
11067
|
+
];
|
|
11068
|
+
function noteRights(viewer) {
|
|
11069
|
+
const { principal } = viewer;
|
|
11070
|
+
if (principal.kind !== "staff") return null;
|
|
11071
|
+
if (viewer.actor !== "human") return null;
|
|
11072
|
+
const holds = (permission) => holdsPermission({ role: principal.role }, viewer.permissionGrants, permission);
|
|
11073
|
+
return {
|
|
11074
|
+
userId: principal.userId,
|
|
11075
|
+
clients: holds("notes:clients"),
|
|
11076
|
+
sensitive: holds("notes:sensitive"),
|
|
11077
|
+
manage: holds("notes:manage")
|
|
11078
|
+
};
|
|
11079
|
+
}
|
|
11080
|
+
function readsEveryNote(rights, level) {
|
|
11081
|
+
if (level === "staff") return true;
|
|
11082
|
+
if (!rights) return false;
|
|
11083
|
+
return level === "coaches" ? rights.clients : rights.sensitive;
|
|
11084
|
+
}
|
|
11085
|
+
function noteScopeWhere(viewer, alias) {
|
|
11086
|
+
const rights = noteRights(viewer);
|
|
11087
|
+
const level = sql.ref(`${alias}.level`);
|
|
11088
|
+
if (!rights) return sql`${level} = 'staff'`;
|
|
11089
|
+
if (rights.clients && rights.sensitive) return null;
|
|
11090
|
+
const me = rights.userId;
|
|
11091
|
+
const authored = sql`(${sql.ref(`${alias}.author_user_id`)} = ${me} AND EXISTS (SELECT 1 FROM core_user nu WHERE nu.id = ${me} AND nu.deactivated_at IS NULL))`;
|
|
11092
|
+
const caredFor = sql`EXISTS (SELECT 1 FROM core_activity_links nl JOIN core_person_carer nc ON nc.person_id = nl.record_id AND nc.user_id = ${me} AND nc.ended_at IS NULL JOIN core_person np ON np.id = nc.person_id AND np.deleted_at IS NULL WHERE nl.activity_id = ${sql.ref(`${alias}.id`)} AND nl.object_type = 'person')`;
|
|
11093
|
+
const coaches = rights.clients ? sql`1 = 1` : sql`(${authored} OR ${caredFor})`;
|
|
11094
|
+
const sensitive = rights.sensitive ? sql`1 = 1` : authored;
|
|
11095
|
+
return sql`(${level} = 'staff' OR (${level} = 'coaches' AND ${coaches}) OR (${level} = 'sensitive' AND ${sensitive}))`;
|
|
11096
|
+
}
|
|
11097
|
+
function hiddenNoteIds(viewer) {
|
|
11098
|
+
const scope = noteScopeWhere(viewer, "hn");
|
|
11099
|
+
if (!scope) return sql`(SELECT NULL WHERE 0)`;
|
|
11100
|
+
return sql`(SELECT hn.id FROM core_activity hn WHERE hn.level != 'staff' AND NOT ${scope})`;
|
|
11101
|
+
}
|
|
11102
|
+
function noteLevelGuard(id, level) {
|
|
11103
|
+
return sql`INSERT INTO core_note_guard (expected, actual) SELECT 1, count(*) FROM core_activity WHERE id = ${id} AND level = ${level}`;
|
|
11104
|
+
}
|
|
11105
|
+
|
|
10921
11106
|
// ../core/src/visibility/via.ts
|
|
10922
11107
|
function customerViaProblems(object) {
|
|
10923
11108
|
const declared = object.customerVia;
|
|
10924
|
-
|
|
11109
|
+
return declared ? checkVia(object, declared).problems : [];
|
|
11110
|
+
}
|
|
11111
|
+
function checkVia(object, declared) {
|
|
10925
11112
|
const problems = [];
|
|
10926
11113
|
if (object.customer) {
|
|
10927
11114
|
problems.push("an object that declares a customer cannot also declare customerVia");
|
|
@@ -10938,7 +11125,7 @@ function customerViaProblems(object) {
|
|
|
10938
11125
|
}
|
|
10939
11126
|
const link = resolveLink(object, declared);
|
|
10940
11127
|
if (typeof link === "string") problems.push(link);
|
|
10941
|
-
return problems;
|
|
11128
|
+
return { problems, link: typeof link === "string" ? null : link };
|
|
10942
11129
|
}
|
|
10943
11130
|
function resolveLink(object, declared) {
|
|
10944
11131
|
const from = getObject(declared.from);
|
|
@@ -10969,8 +11156,8 @@ function resolveLink(object, declared) {
|
|
|
10969
11156
|
function customerViaScope(object, personId) {
|
|
10970
11157
|
const declared = object.customerVia;
|
|
10971
11158
|
if (!declared) return null;
|
|
10972
|
-
const problems =
|
|
10973
|
-
if (problems.length) {
|
|
11159
|
+
const { problems, link } = checkVia(object, declared);
|
|
11160
|
+
if (problems.length || !link) {
|
|
10974
11161
|
throw new Error(`${object.name}: invalid customerVia declaration: ${problems.join("; ")}`);
|
|
10975
11162
|
}
|
|
10976
11163
|
const shared = signedInScope(object) ?? publicScope(object);
|
|
@@ -10989,7 +11176,7 @@ function customerViaScope(object, personId) {
|
|
|
10989
11176
|
personId,
|
|
10990
11177
|
fields,
|
|
10991
11178
|
columns: [...columns].map(([column, shownOn]) => ({ column, shownOn })),
|
|
10992
|
-
link
|
|
11179
|
+
link,
|
|
10993
11180
|
public: shared,
|
|
10994
11181
|
declaration: declared
|
|
10995
11182
|
};
|
|
@@ -11021,6 +11208,8 @@ function scopeOf(principal, given, throughOwnRecords = true) {
|
|
|
11021
11208
|
return customerScope(object, principal.personId) ?? (throughOwnRecords ? customerViaScope(object, principal.personId) : null) ?? signedInScope(object) ?? publicScope(object) ?? NONE;
|
|
11022
11209
|
case "public":
|
|
11023
11210
|
return publicScope(object) ?? NONE;
|
|
11211
|
+
case "practitioner":
|
|
11212
|
+
return NONE;
|
|
11024
11213
|
default:
|
|
11025
11214
|
return NONE;
|
|
11026
11215
|
}
|
|
@@ -11121,8 +11310,14 @@ function previewSource(object, id) {
|
|
|
11121
11310
|
definition.source
|
|
11122
11311
|
);
|
|
11123
11312
|
}
|
|
11124
|
-
function conditionSql(
|
|
11125
|
-
if (!
|
|
11313
|
+
function conditionSql(conditions) {
|
|
11314
|
+
if (!conditions?.length) return sql`1 = 1`;
|
|
11315
|
+
return sql`(${sql.join(conditions.map(oneConditionSql), sql` AND `)})`;
|
|
11316
|
+
}
|
|
11317
|
+
function oneConditionSql(condition) {
|
|
11318
|
+
if (condition.public) {
|
|
11319
|
+
return sql`${sql.ref(condition.column)} IN (SELECT id FROM ${sql.table(condition.public.source)} WHERE ${conditionSql(condition.public.conditions)})`;
|
|
11320
|
+
}
|
|
11126
11321
|
const values = sql.join(condition.values.map((value) => sql`${value}`));
|
|
11127
11322
|
return condition.via ? sql`${sql.ref(condition.column)} IN (SELECT id FROM ${sql.table(condition.via.source)} WHERE ${sql.ref(condition.via.column)} IN (${values}))` : sql`${sql.ref(condition.column)} IN (${values})`;
|
|
11128
11323
|
}
|
|
@@ -11140,14 +11335,28 @@ function ownedSource(ctx, object, alias) {
|
|
|
11140
11335
|
throw unknownObject(object.name);
|
|
11141
11336
|
}
|
|
11142
11337
|
}
|
|
11338
|
+
function ownReadSource(ctx, object, alias) {
|
|
11339
|
+
const scope = scopeOf(ctx.principal, object);
|
|
11340
|
+
if (scope.kind !== "customer") throw unknownObject(object.name);
|
|
11341
|
+
return sql`(SELECT id, ${sql.ref(scope.column)} AS owner FROM ${sql.table(object.source)} WHERE ${ownersWhere(scope.column, scope.personId, scope.dependants)})`.as(
|
|
11342
|
+
alias
|
|
11343
|
+
);
|
|
11344
|
+
}
|
|
11143
11345
|
function visibleTable(ctx, object, alias) {
|
|
11144
11346
|
const definition = resolve(object);
|
|
11145
11347
|
const table = isCoreObject(definition.name) ? CORE_SOURCES[definition.name].table : Object.hasOwn(BASE_TABLES, definition.name) ? BASE_TABLES[definition.name] : objectTableOf(definition.name);
|
|
11146
11348
|
if (!table) throw new Error(`${definition.name} has no record table`);
|
|
11147
11349
|
const scope = scopeOf(ctx.principal, definition);
|
|
11148
11350
|
switch (scope.kind) {
|
|
11149
|
-
case "all":
|
|
11351
|
+
case "all": {
|
|
11352
|
+
const notes = definition.name === "activity" ? noteScopeWhere(ctx, "n") : null;
|
|
11353
|
+
if (notes) {
|
|
11354
|
+
return sql`(SELECT * FROM ${sql.table(ident(table))} n WHERE ${notes})`.as(
|
|
11355
|
+
alias ?? table
|
|
11356
|
+
);
|
|
11357
|
+
}
|
|
11150
11358
|
return sql`${sql.table(ident(table))}`.as(alias ?? table);
|
|
11359
|
+
}
|
|
11151
11360
|
default:
|
|
11152
11361
|
throw unknownObject(definition.name);
|
|
11153
11362
|
}
|
|
@@ -11206,66 +11415,70 @@ export {
|
|
|
11206
11415
|
parseTable,
|
|
11207
11416
|
sql,
|
|
11208
11417
|
CompiledQuery,
|
|
11209
|
-
OperationError,
|
|
11210
|
-
UnknownOperationError,
|
|
11211
|
-
ValidationError,
|
|
11212
|
-
ForbiddenError,
|
|
11213
|
-
GateDeniedError,
|
|
11214
|
-
PendingApprovalError,
|
|
11215
|
-
RunsOnApprovalError,
|
|
11216
|
-
RateLimitedError,
|
|
11217
|
-
PlanLimitError,
|
|
11218
|
-
NotFoundError,
|
|
11219
|
-
ConflictError,
|
|
11220
|
-
NeedsOwnApprovalError,
|
|
11221
|
-
ConfigError,
|
|
11222
|
-
toOperationError,
|
|
11223
|
-
allowanceMessage,
|
|
11224
11418
|
viewColumnOf,
|
|
11225
|
-
|
|
11226
|
-
|
|
11419
|
+
RISK_CLASSES,
|
|
11420
|
+
ACTORS,
|
|
11421
|
+
originSchema,
|
|
11422
|
+
ROLES,
|
|
11423
|
+
PERMISSIONS,
|
|
11424
|
+
CORE_PERMISSION_NAMESPACES,
|
|
11425
|
+
roleHasPermission,
|
|
11426
|
+
GRANTABLE_PERMISSIONS,
|
|
11427
|
+
RESTRICTED_CORE_PERMISSIONS,
|
|
11428
|
+
FIXED_ROLE_CORE_GRANTS,
|
|
11429
|
+
holdsPermission,
|
|
11430
|
+
MCP_SCOPES,
|
|
11431
|
+
grantableScopes,
|
|
11432
|
+
placedAs,
|
|
11433
|
+
staffPrincipal,
|
|
11434
|
+
ALL_ACTORS,
|
|
11227
11435
|
ident,
|
|
11228
11436
|
isCoreTarget,
|
|
11229
11437
|
splitObjectName,
|
|
11230
11438
|
objectTable,
|
|
11231
11439
|
objectView,
|
|
11440
|
+
viewOf,
|
|
11232
11441
|
sideTable,
|
|
11233
11442
|
columnName,
|
|
11234
11443
|
registryFieldName,
|
|
11444
|
+
FIELD_TYPE_REGISTRY,
|
|
11445
|
+
formulaFromStorage,
|
|
11235
11446
|
loadSchemaState,
|
|
11236
11447
|
coreFormulaFields,
|
|
11237
11448
|
buildViews,
|
|
11238
11449
|
liveViewOf,
|
|
11239
11450
|
PUBLISHED_FIELDS,
|
|
11240
11451
|
CAPACITY_FIELDS,
|
|
11452
|
+
STOCK_FIELDS,
|
|
11241
11453
|
ALLOWANCE_FIELDS,
|
|
11242
11454
|
fieldStorage,
|
|
11243
11455
|
objectTableOf,
|
|
11244
11456
|
refreshSchemaRegistry,
|
|
11245
11457
|
mergeOptions,
|
|
11246
|
-
RISK_CLASSES,
|
|
11247
|
-
ACTORS,
|
|
11248
|
-
originSchema,
|
|
11249
|
-
ROLES,
|
|
11250
|
-
PERMISSIONS,
|
|
11251
|
-
roleHasPermission,
|
|
11252
|
-
GRANTABLE_PERMISSIONS,
|
|
11253
|
-
holdsPermission,
|
|
11254
|
-
MCP_SCOPES,
|
|
11255
|
-
grantableScopes,
|
|
11256
|
-
staffPrincipal,
|
|
11257
|
-
ALL_ACTORS,
|
|
11258
11458
|
GUARDIAN_LINK,
|
|
11259
11459
|
guardianProblems,
|
|
11460
|
+
dependantsSql,
|
|
11260
11461
|
isLiveDependant,
|
|
11261
11462
|
linkGuardStatement,
|
|
11262
11463
|
familyOf,
|
|
11464
|
+
dependantFirstNames,
|
|
11263
11465
|
recordsMadeFor,
|
|
11264
11466
|
sharedEmailWarning,
|
|
11467
|
+
hasLiveGuardian,
|
|
11468
|
+
peopleAtAddresses,
|
|
11469
|
+
peopleAtNumbers,
|
|
11470
|
+
livePersonAfterMerges,
|
|
11265
11471
|
publicProblems,
|
|
11266
11472
|
signedInProblems,
|
|
11267
11473
|
customerProblems,
|
|
11474
|
+
customerScope,
|
|
11268
11475
|
unknownObject,
|
|
11476
|
+
NOTE_LEVELS,
|
|
11477
|
+
noteRights,
|
|
11478
|
+
readsEveryNote,
|
|
11479
|
+
noteScopeWhere,
|
|
11480
|
+
hiddenNoteIds,
|
|
11481
|
+
noteLevelGuard,
|
|
11269
11482
|
customerViaProblems,
|
|
11270
11483
|
scopeOf,
|
|
11271
11484
|
visibleObject,
|
|
@@ -11273,6 +11486,7 @@ export {
|
|
|
11273
11486
|
buyableSource,
|
|
11274
11487
|
previewSource,
|
|
11275
11488
|
ownedSource,
|
|
11489
|
+
ownReadSource,
|
|
11276
11490
|
visibleTable,
|
|
11277
11491
|
orgReader
|
|
11278
11492
|
};
|