@plitzi/sdk-shared 0.35.2 → 0.35.4
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @plitzi/sdk-shared
|
|
2
2
|
|
|
3
|
+
## 0.35.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- v0.35.4
|
|
8
|
+
|
|
9
|
+
## 0.35.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 0211dc4: A form speaks the site's language when it refuses a value.
|
|
14
|
+
|
|
15
|
+
- **Every rule of a `formControl` can say what it wants to say.** `requiredMessage`, `minLengthMessage`,
|
|
16
|
+
`maxLengthMessage` and `formatMessage` join `patternMessage` and `matchesMessage`; left empty, each falls back to
|
|
17
|
+
the English sentence it said before. `formatMessage` is said when the value does not have the shape the control's
|
|
18
|
+
type asks for — an address, for an `email` — one attribute for every type that has a shape. Offered in the builder under the rule they belong to.
|
|
19
|
+
- **A `form` can turn the browser's own checks off (`noValidate`, "Skip Browser Validation" in the builder).** Left on
|
|
20
|
+
— the default, as before — the browser answers first for a blank required field and a malformed address, in a
|
|
21
|
+
bubble no style reaches and in the browser's language, while every other rule answers under the control. Turned
|
|
22
|
+
on, the form's rules are the only ones, and all of them answer under the control.
|
|
23
|
+
- **An `email` control checks the address itself,** by the same definition the browser uses, so the format is still
|
|
24
|
+
asked for when the browser's checks are off.
|
|
25
|
+
|
|
3
26
|
## 0.35.2
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
|
@@ -24,7 +24,8 @@ var a = [
|
|
|
24
24
|
"spaceId",
|
|
25
25
|
"environment",
|
|
26
26
|
"trigger",
|
|
27
|
-
"runId"
|
|
27
|
+
"runId",
|
|
28
|
+
"now"
|
|
28
29
|
]), u = /^[a-z][a-zA-Z0-9]*\.[a-z][a-zA-Z0-9]*$/, d = (e) => typeof e == "object" && !!e && !Array.isArray(e), f = (e) => typeof e == "string" && e.trim() !== "", p = (e) => {
|
|
29
30
|
try {
|
|
30
31
|
let t = JSON.parse(e);
|
|
@@ -99,7 +99,54 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
99
99
|
}, s = "__PLITZI_RAW__", c = (e) => typeof e == "object" && !!e && e.__marker === "__PLITZI_RAW__", l = (e) => ({
|
|
100
100
|
__raw: e,
|
|
101
101
|
__marker: s
|
|
102
|
-
}), u = (e) => c(e) ? e.__raw : e, d =
|
|
102
|
+
}), u = (e) => c(e) ? e.__raw : e, d = [
|
|
103
|
+
"Sun",
|
|
104
|
+
"Mon",
|
|
105
|
+
"Tue",
|
|
106
|
+
"Wed",
|
|
107
|
+
"Thu",
|
|
108
|
+
"Fri",
|
|
109
|
+
"Sat"
|
|
110
|
+
], f = /* @__PURE__ */ new Map(), p = (e) => {
|
|
111
|
+
if (!f.has(e)) try {
|
|
112
|
+
f.set(e, new Intl.DateTimeFormat("en-US", {
|
|
113
|
+
timeZone: e,
|
|
114
|
+
hourCycle: "h23",
|
|
115
|
+
year: "numeric",
|
|
116
|
+
month: "numeric",
|
|
117
|
+
day: "numeric",
|
|
118
|
+
hour: "numeric",
|
|
119
|
+
minute: "numeric",
|
|
120
|
+
second: "numeric",
|
|
121
|
+
weekday: "short"
|
|
122
|
+
}));
|
|
123
|
+
} catch {
|
|
124
|
+
f.set(e, null);
|
|
125
|
+
}
|
|
126
|
+
return f.get(e) ?? null;
|
|
127
|
+
}, m = (e, t) => {
|
|
128
|
+
if (!t) return {
|
|
129
|
+
year: e.getFullYear(),
|
|
130
|
+
month: e.getMonth() + 1,
|
|
131
|
+
day: e.getDate(),
|
|
132
|
+
hours: e.getHours(),
|
|
133
|
+
minutes: e.getMinutes(),
|
|
134
|
+
seconds: e.getSeconds(),
|
|
135
|
+
weekday: e.getDay()
|
|
136
|
+
};
|
|
137
|
+
let n = p(t);
|
|
138
|
+
if (!n) return;
|
|
139
|
+
let r = n.formatToParts(e), i = (e) => r.find((t) => t.type === e)?.value ?? "";
|
|
140
|
+
return {
|
|
141
|
+
year: Number(i("year")),
|
|
142
|
+
month: Number(i("month")),
|
|
143
|
+
day: Number(i("day")),
|
|
144
|
+
hours: Number(i("hour")),
|
|
145
|
+
minutes: Number(i("minute")),
|
|
146
|
+
seconds: Number(i("second")),
|
|
147
|
+
weekday: d.indexOf(i("weekday"))
|
|
148
|
+
};
|
|
149
|
+
}, h = {
|
|
103
150
|
raw: (e) => l(e),
|
|
104
151
|
to_json: (e) => typeof e == "object" && e ? JSON.stringify(e) : r(e),
|
|
105
152
|
json_encode: (e) => typeof e == "object" && e ? JSON.stringify(e) : r(e),
|
|
@@ -262,13 +309,21 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
262
309
|
if (t.length === 0) return e;
|
|
263
310
|
let n = r(t[0]), i = e instanceof Date ? e : new Date(String(e));
|
|
264
311
|
if (Number.isNaN(i.getTime())) return "";
|
|
265
|
-
let a = (
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
312
|
+
let a = m(i, t.length > 1 ? r(t[1]) : "");
|
|
313
|
+
if (!a) return "";
|
|
314
|
+
let o = (e) => String(e).padStart(2, "0"), s = {
|
|
315
|
+
Y: String(a.year),
|
|
316
|
+
m: o(a.month),
|
|
317
|
+
n: String(a.month),
|
|
318
|
+
d: o(a.day),
|
|
319
|
+
j: String(a.day),
|
|
320
|
+
H: o(a.hours),
|
|
321
|
+
G: String(a.hours),
|
|
322
|
+
i: o(a.minutes),
|
|
323
|
+
s: o(a.seconds),
|
|
324
|
+
w: String(a.weekday),
|
|
325
|
+
N: String(a.weekday === 0 ? 7 : a.weekday),
|
|
326
|
+
U: String(Math.floor(i.getTime() / 1e3)),
|
|
272
327
|
l: [
|
|
273
328
|
"Sunday",
|
|
274
329
|
"Monday",
|
|
@@ -277,7 +332,7 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
277
332
|
"Thursday",
|
|
278
333
|
"Friday",
|
|
279
334
|
"Saturday"
|
|
280
|
-
][
|
|
335
|
+
][a.weekday],
|
|
281
336
|
F: [
|
|
282
337
|
"January",
|
|
283
338
|
"February",
|
|
@@ -291,7 +346,7 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
291
346
|
"October",
|
|
292
347
|
"November",
|
|
293
348
|
"December"
|
|
294
|
-
][
|
|
349
|
+
][a.month - 1],
|
|
295
350
|
M: [
|
|
296
351
|
"Jan",
|
|
297
352
|
"Feb",
|
|
@@ -305,10 +360,10 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
305
360
|
"Oct",
|
|
306
361
|
"Nov",
|
|
307
362
|
"Dec"
|
|
308
|
-
][
|
|
309
|
-
},
|
|
310
|
-
for (let e of n)
|
|
311
|
-
return
|
|
363
|
+
][a.month - 1]
|
|
364
|
+
}, c = "";
|
|
365
|
+
for (let e of n) c += Object.prototype.hasOwnProperty.call(s, e) ? s[e] : e;
|
|
366
|
+
return c;
|
|
312
367
|
},
|
|
313
368
|
base64_encode: (e) => typeof e == "string" ? i(e) : e,
|
|
314
369
|
base64_decode: (e) => typeof e == "string" ? a(e) : e,
|
|
@@ -369,4 +424,4 @@ var e = Symbol("twigArrowParams"), t = (e) => e == null || e === "", n = (e, t)
|
|
|
369
424
|
}
|
|
370
425
|
};
|
|
371
426
|
//#endregion
|
|
372
|
-
export { e as ARROW_PARAMS, s as RAW_MARKER,
|
|
427
|
+
export { e as ARROW_PARAMS, s as RAW_MARKER, h as filters, c as isRawMarker, u as unwrapRaw, l as wrapRaw };
|
|
@@ -313,6 +313,30 @@ export type ActionRunRecord = {
|
|
|
313
313
|
/** Present when the run ended badly. Already redacted of credential values. */
|
|
314
314
|
error?: string;
|
|
315
315
|
};
|
|
316
|
+
/**
|
|
317
|
+
* One message a flow asked to send.
|
|
318
|
+
*
|
|
319
|
+
* Plain text only. The body is whatever a flow rendered, and a flow renders what a visitor typed: HTML built from
|
|
320
|
+
* that is markup a stranger wrote, sent from the deployment's own domain.
|
|
321
|
+
*/
|
|
322
|
+
export type ActionEmailMessage = {
|
|
323
|
+
/** The space the run belongs to, so a deployment can cap and attribute what each one sends. */
|
|
324
|
+
spaceId: number;
|
|
325
|
+
to: string;
|
|
326
|
+
subject: string;
|
|
327
|
+
text: string;
|
|
328
|
+
replyTo?: string;
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Where the `email.send` task hands a message: the deployment's transport, and its policy.
|
|
332
|
+
*
|
|
333
|
+
* The sender, the sending domain, what happens to a bounce and how much one space may send are the deployment's, so
|
|
334
|
+
* none of them is a parameter a flow can set. Throwing fails the step — a cap reached, a provider refusing — and
|
|
335
|
+
* the run fails at it with that message.
|
|
336
|
+
*/
|
|
337
|
+
export type ActionEmailAdapter = {
|
|
338
|
+
send: (message: ActionEmailMessage) => Promise<void>;
|
|
339
|
+
};
|
|
316
340
|
/**
|
|
317
341
|
* One thing a CHECK found about an action, before anybody runs it.
|
|
318
342
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionEntry, ActionLimits, ActionRejectReason, ActionRejectRecord, ActionRunRecord, ActionRunStatus, ActionTaskDescriptor, ActionTriggerType } from './ActionTypes';
|
|
1
|
+
import { ActionEmailAdapter, ActionEntry, ActionLimits, ActionRejectReason, ActionRejectRecord, ActionRunRecord, ActionRunStatus, ActionTaskDescriptor, ActionTriggerType } from './ActionTypes';
|
|
2
2
|
import { Environment } from './CommonTypes';
|
|
3
3
|
import { ConnectorEntry } from './ConnectorTypes';
|
|
4
4
|
import { Schema } from './SchemaTypes';
|
|
@@ -504,6 +504,12 @@ export type SSRActionConfig = {
|
|
|
504
504
|
* SPACE declared as a credential — never this deployment's own, which no credential a space holds can name.
|
|
505
505
|
*/
|
|
506
506
|
dbDrivers?: unknown[];
|
|
507
|
+
/**
|
|
508
|
+
* How a flow's mail leaves this server. Omitted leaves the `email.send` task unregistered entirely.
|
|
509
|
+
*
|
|
510
|
+
* The sender, the sending domain and how much one space may send are the adapter's, never a flow's.
|
|
511
|
+
*/
|
|
512
|
+
email?: ActionEmailAdapter;
|
|
507
513
|
/**
|
|
508
514
|
* Called once per run that STARTED — completed, failed or aborted — for a deployment that keeps a record.
|
|
509
515
|
* Shaped as `ActionRunRecord` in `@plitzi/sdk-server/actions`.
|