@plitzi/sdk-shared 0.38.16 → 0.38.17
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 +41 -0
- package/dist/actions/cron.mjs +5 -9
- package/dist/actions/validateDocument.mjs +24 -50
- package/dist/connectors/validateManifest.mjs +28 -73
- package/dist/dataSource/helpers/index.mjs +1 -2
- package/dist/dataSource/index.d.ts +1 -1
- package/dist/dataSource/index.mjs +6 -8
- package/dist/dataSource/utility/index.d.ts +1 -0
- package/dist/dataSource/utility/index.mjs +16 -15
- package/dist/devTools/utils/PlitziConsole.mjs +8 -12
- package/dist/elements/index.mjs +1 -2
- package/dist/flags/index.d.ts +2 -0
- package/dist/flags/index.mjs +2 -1
- package/dist/flags/useFlagResolution.mjs +6 -6
- package/dist/helpers/index.d.ts +8 -0
- package/dist/helpers/index.mjs +21 -13
- package/dist/helpers/keys.mjs +4 -8
- package/dist/helpers/twigWrapper/Evaluator/index.mjs +1 -2
- package/dist/helpers/twigWrapper/Parser/ExpressionParser.mjs +12 -26
- package/dist/helpers/twigWrapper/Parser/index.mjs +1 -2
- package/dist/helpers/twigWrapper/TemplateCache/index.mjs +1 -2
- package/dist/helpers/twigWrapper/charClass.mjs +2 -6
- package/dist/helpers/twigWrapper/filters/index.mjs +1 -2
- package/dist/helpers/twigWrapper/templateRoots.mjs +3 -8
- package/dist/hooks/useNetwork.mjs +1 -4
- package/dist/index.d.ts +5 -19
- package/dist/index.mjs +3 -99
- package/dist/network/graphql/builder/Mutations/index.d.ts +1 -0
- package/dist/network/graphql/builder/Mutations/index.mjs +148 -148
- package/dist/network/graphql/builder/Queries/index.mjs +4 -4
- package/dist/network/index.mjs +8 -8
- package/dist/plugins/{bundle.mjs → bundle/bundle.mjs} +1 -1
- package/dist/plugins/bundle/index.d.ts +2 -0
- package/dist/plugins/bundle/index.mjs +1 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.mjs +3 -0
- package/dist/project/index.d.ts +8 -0
- package/dist/project/index.mjs +5 -0
- package/dist/project/layout.mjs +4 -4
- package/dist/queries/queryCache.mjs +1 -7
- package/dist/realtime/client.mjs +3 -12
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.mjs +12 -7
- package/dist/server/actions/useActionsSync.mjs +1 -1
- package/dist/server/actions/useImagesSync.mjs +1 -1
- package/dist/server/actions/useRealtimeSync.mjs +1 -1
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.mjs +8 -4
- package/dist/server/rsc/refreshRsc.mjs +11 -11
- package/dist/server/rsc/useRscSync.mjs +1 -1
- package/dist/server/usePluginRoute.mjs +1 -1
- package/dist/state/runtimeStatePersist.mjs +9 -15
- package/dist/store/index.d.ts +1 -193
- package/dist/store/index.mjs +6 -9
- package/dist/store/renderSettings.mjs +1 -1
- package/dist/store/storeHooks.d.ts +193 -0
- package/dist/store/storeHooks.mjs +5 -0
- package/dist/store/tracing/tracingCollector.mjs +1 -5
- package/dist/style/fonts.mjs +17 -25
- package/dist/style/index.d.ts +4 -0
- package/dist/style/index.mjs +19 -15
- package/dist/style/stylePseudos.mjs +2 -5
- package/dist/style/styleTarget.mjs +6 -6
- package/dist/theme/ThemeProvider.mjs +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.mjs +4 -4
- package/dist/types/SchemaTypes.d.ts +2 -1
- package/dist/websockets/index.mjs +1 -2
- package/package.json +21 -1607
- package/vite.config.ts +20 -4
- package/dist/auth/authFailureLink.d.ts +0 -9
- package/dist/auth/authFailureLink.mjs +0 -20
- package/dist/dataSource/hooks/index.d.ts +0 -4
- package/dist/dataSource/hooks/index.mjs +0 -3
- package/dist/dataSource/hooks/useRegisterSource.d.ts +0 -9
- package/dist/dataSource/hooks/useRegisterSource.mjs +0 -40
- package/dist/dataSource/hooks/useResolvedVariables.d.ts +0 -12
- package/dist/dataSource/hooks/useResolvedVariables.mjs +0 -28
- package/dist/helpers/stripTypename.d.ts +0 -15
- package/dist/helpers/stripTypename.mjs +0 -41
- /package/dist/plugins/{bundle.d.ts → bundle/bundle.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @plitzi/sdk-shared
|
|
2
2
|
|
|
3
|
+
## 0.38.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4f8dc37: ## Packages
|
|
8
|
+
|
|
9
|
+
- **A library package is imported by its root and its folders, never by a file** (`@plitzi/sdk-shared`, `sdk-schema`,
|
|
10
|
+
`sdk-style`, `sdk-elements`, `sdk-interactions`, `sdk-auth`, `sdk-dev-tools`, `sdk-event-bridge`, `sdk-navigation`,
|
|
11
|
+
`sdk-plugins`, `sdk-variables`): each `exports` is now `"."` and `"./*"`, the latter a folder's `index`.
|
|
12
|
+
`@plitzi/sdk-shared/helpers/isRecord` becomes `import { isRecord } from '@plitzi/sdk-shared/helpers'`, and a default
|
|
13
|
+
export by the name its folder gives it — almost always its file's (`import usePlitzi from '…/hooks/usePlitzi'` →
|
|
14
|
+
`import { usePlitzi } from '@plitzi/sdk-shared/hooks'`). A file-level specifier now fails with `ERR_MODULE_NOT_FOUND`.
|
|
15
|
+
New entries where a folder barrel would have brought more than was asked for: `@plitzi/sdk-shared/project` and
|
|
16
|
+
`@plitzi/sdk-shared/plugins/bundle` (Node only), `@plitzi/sdk-interactions/declarations` (the global callbacks and
|
|
17
|
+
utility specs, without React), and `@plitzi/sdk-elements/elements/declarations`, which now also carries the
|
|
18
|
+
declarations' attribute types and the constants they are checked with. `RuleGroup` is exported by `@plitzi/sdk-shared`
|
|
19
|
+
with the document types that use it. `plitzi upgrade migrations` names every such import in a project, with the folder to
|
|
20
|
+
import it from instead.
|
|
21
|
+
- **`@plitzi/sdk-shared`'s root exports the document types, and only them** (`@plitzi/sdk-shared`): what the package
|
|
22
|
+
does is imported from its folder — `formatDate` from `@plitzi/sdk-shared/helpers`, `ThemeProvider` from
|
|
23
|
+
`@plitzi/sdk-shared/theme`, a GraphQL operation's types from `@plitzi/sdk-shared/network/graphql` — so a module that
|
|
24
|
+
imports a type from the root no longer loads every area of the package.
|
|
25
|
+
- **What one package alone used lives in that package** (`@plitzi/sdk-shared`, `@plitzi/sdk-elements`): the data
|
|
26
|
+
source hooks moved from `@plitzi/sdk-shared/dataSource/hooks` to `@plitzi/sdk-elements/dataSource`
|
|
27
|
+
(`useRegisterSource`, `useResolvedVariables`), and the Apollo links the builder's client is built with into the
|
|
28
|
+
builder.
|
|
29
|
+
- **The builder's panels are an entry of their own** (`@plitzi/sdk-style`, `@plitzi/sdk-variables`,
|
|
30
|
+
`@plitzi/sdk-elements`): the style inspector, the advanced style editor and `BuilderStyleContextProvider` are imported
|
|
31
|
+
from `@plitzi/sdk-style/builder`; the variables' lists and forms from `@plitzi/sdk-variables/builder`; the elements'
|
|
32
|
+
settings panels (`defaultElementsSettings`) from `@plitzi/sdk-elements/builder`. Each package's root keeps what a page
|
|
33
|
+
and a server use — `generateCache` no longer loads the inspector, on a server 227 modules down to 21.
|
|
34
|
+
|
|
35
|
+
## CLI
|
|
36
|
+
- **`plitzi upgrade`'s `renames` part is now `migrations`** (`@plitzi/cli`): what a version changed that a project's
|
|
37
|
+
own source must follow, one file per change in the CLI's `src/migrations/changes/` with the version it shipped in —
|
|
38
|
+
rewritten with `--write` when it has one right answer, said otherwise. The `--json` report carries `migrations` (each
|
|
39
|
+
with its `migration`, `since`, `file`, `line`, `what` and whether it was `written`) in place of `renames` and
|
|
40
|
+
`changes`. The changes of 0.38.0 (`canTemplate` → `canSnippet`, the `*Template` authoring names), 0.38.9 (a
|
|
41
|
+
`formControl` without `required` is optional) and 0.38.12 (`usePlitziServiceContext` → `usePlitzi`) are no longer
|
|
42
|
+
looked for: a project still on one of those versions makes them by hand.
|
|
43
|
+
|
|
3
44
|
## 0.38.16
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
package/dist/actions/cron.mjs
CHANGED
|
@@ -79,16 +79,12 @@ var e = [
|
|
|
79
79
|
for (let e = o; e <= c;) {
|
|
80
80
|
let t = new Date(e), n = a(t);
|
|
81
81
|
if (!n) return;
|
|
82
|
-
if (!s(i, n))
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
if (!s(i, n)) e += (1440 - n.hour * 60 - n.minute) * d;
|
|
83
|
+
else if (!p.has(n.hour)) e += (60 - n.minute) * d;
|
|
84
|
+
else {
|
|
85
|
+
if (u.has(n.minute)) return t;
|
|
86
|
+
e += d;
|
|
85
87
|
}
|
|
86
|
-
if (!p.has(n.hour)) {
|
|
87
|
-
e += (60 - n.minute) * d;
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (u.has(n.minute)) return t;
|
|
91
|
-
e += d;
|
|
92
88
|
}
|
|
93
89
|
}, m = (e, t, n, r, i = 1e3) => {
|
|
94
90
|
let a = 0, o = new Date(t.getTime() + d);
|
|
@@ -38,29 +38,19 @@ var s = [
|
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
}, h = (e, t, n) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Object.entries(e).forEach(([e, i]) => {
|
|
50
|
-
if (!r(i) || !p(i.type)) {
|
|
51
|
-
n.push({
|
|
52
|
-
path: `${t}.${e}`,
|
|
53
|
-
message: "must declare a type"
|
|
54
|
-
});
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
s.includes(i.type) || n.push({
|
|
58
|
-
path: `${t}.${e}.type`,
|
|
59
|
-
message: `unknown field type "${i.type}"`,
|
|
60
|
-
hint: `one of ${s.join(", ")}`
|
|
61
|
-
});
|
|
41
|
+
e !== void 0 && (r(e) ? Object.entries(e).forEach(([e, i]) => {
|
|
42
|
+
!r(i) || !p(i.type) ? n.push({
|
|
43
|
+
path: `${t}.${e}`,
|
|
44
|
+
message: "must declare a type"
|
|
45
|
+
}) : s.includes(i.type) || n.push({
|
|
46
|
+
path: `${t}.${e}.type`,
|
|
47
|
+
message: `unknown field type "${i.type}"`,
|
|
48
|
+
hint: `one of ${s.join(", ")}`
|
|
62
49
|
});
|
|
63
|
-
}
|
|
50
|
+
}) : n.push({
|
|
51
|
+
path: t,
|
|
52
|
+
message: "must be an object of field definitions"
|
|
53
|
+
}));
|
|
64
54
|
}, g = (n, s, d, f) => {
|
|
65
55
|
let g = `nodes.${n}`, _ = s.action;
|
|
66
56
|
if (!p(_) || !l.includes(_)) {
|
|
@@ -164,36 +154,20 @@ var s = [
|
|
|
164
154
|
});
|
|
165
155
|
}), o.forEach(([t, n]) => {
|
|
166
156
|
let o = `nodes.${t}`;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
if (n.type === "trigger") {
|
|
175
|
-
g(t, n, i, a);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
if (n.type !== "task") {
|
|
179
|
-
i.push({
|
|
180
|
-
path: `${o}.type`,
|
|
181
|
-
message: `"${String(n.type)}" steps run in the browser and cannot run on the server`,
|
|
182
|
-
hint: "a server action is made of task steps"
|
|
183
|
-
});
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
if (!p(n.action) || !f.test(n.action)) {
|
|
187
|
-
i.push({
|
|
188
|
-
path: `${o}.action`,
|
|
189
|
-
message: "must name a task as <namespace>.<action>",
|
|
190
|
-
hint: "for example flow.output or http.request"
|
|
191
|
-
});
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
p(n.afterNode) && !Object.hasOwn(e, n.afterNode) && i.push({
|
|
157
|
+
r(n) ? n.type === "trigger" ? g(t, n, i, a) : n.type === "task" ? !p(n.action) || !f.test(n.action) ? i.push({
|
|
158
|
+
path: `${o}.action`,
|
|
159
|
+
message: "must name a task as <namespace>.<action>",
|
|
160
|
+
hint: "for example flow.output or http.request"
|
|
161
|
+
}) : p(n.afterNode) && !Object.hasOwn(e, n.afterNode) && i.push({
|
|
195
162
|
path: `${o}.afterNode`,
|
|
196
163
|
message: `points at "${n.afterNode}", which is not a step here`
|
|
164
|
+
}) : i.push({
|
|
165
|
+
path: `${o}.type`,
|
|
166
|
+
message: `"${String(n.type)}" steps run in the browser and cannot run on the server`,
|
|
167
|
+
hint: "a server action is made of task steps"
|
|
168
|
+
}) : i.push({
|
|
169
|
+
path: o,
|
|
170
|
+
message: "must be an object"
|
|
197
171
|
});
|
|
198
172
|
}), o.forEach(([e]) => {
|
|
199
173
|
d.has(e) && i.push({
|
|
@@ -35,50 +35,30 @@ var i = [
|
|
|
35
35
|
});
|
|
36
36
|
}, p = (t, n, r, i) => {
|
|
37
37
|
if (n !== void 0) {
|
|
38
|
-
if (!e(n))
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
for (let [e, a] of Object.entries(n)) {
|
|
43
|
-
if (typeof a != "string") {
|
|
44
|
-
d(t, `${r}.${e}`, "Must be a string", "Values are Twig templates the server renders per request");
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
t.templates.push({
|
|
38
|
+
if (!e(n)) d(t, r, "Must be an object of string values", "Each entry is one name and its templated value");
|
|
39
|
+
else {
|
|
40
|
+
for (let [e, a] of Object.entries(n)) typeof a == "string" ? t.templates.push({
|
|
48
41
|
path: `${r}.${e}`,
|
|
49
42
|
value: a,
|
|
50
43
|
scope: i
|
|
51
|
-
});
|
|
44
|
+
}) : d(t, `${r}.${e}`, "Must be a string", "Values are Twig templates the server renders per request");
|
|
45
|
+
return n;
|
|
52
46
|
}
|
|
53
|
-
return n;
|
|
54
47
|
}
|
|
55
48
|
}, m = (e, t, r, i) => {
|
|
56
|
-
if (t === void 0) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
if (typeof t != "string" || !n.includes(t)) {
|
|
61
|
-
d(e, r, `"${c(t)}" is not an HTTP method`, `One of ${n.join(", ")}`);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
return t;
|
|
49
|
+
if (t === void 0) i && d(e, r, "A write endpoint must declare its method", `One of ${n.join(", ")}`);
|
|
50
|
+
else if (typeof t != "string" || !n.includes(t)) d(e, r, `"${c(t)}" is not an HTTP method`, `One of ${n.join(", ")}`);
|
|
51
|
+
else return t;
|
|
65
52
|
}, h = (e, t, n, r) => {
|
|
66
|
-
|
|
67
|
-
d(e, `${n}.path`, "An endpoint needs a path", "It is appended to baseUrl, e.g. \"/api/{{resource}}\"");
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
e.templates.push({
|
|
53
|
+
s(t.path) ? e.templates.push({
|
|
71
54
|
path: `${n}.path`,
|
|
72
55
|
value: t.path,
|
|
73
56
|
scope: r
|
|
74
|
-
});
|
|
57
|
+
}) : d(e, `${n}.path`, "An endpoint needs a path", "It is appended to baseUrl, e.g. \"/api/{{resource}}\"");
|
|
75
58
|
}, g = (e, t, n) => {
|
|
76
59
|
if (t !== void 0) {
|
|
77
|
-
if (typeof t != "string" || !i.includes(t)) {
|
|
78
|
-
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
return t;
|
|
60
|
+
if (typeof t != "string" || !i.includes(t)) d(e, n, `"${c(t)}" is not a paging style`, `One of ${i.join(", ")}`);
|
|
61
|
+
else return t;
|
|
82
62
|
}
|
|
83
63
|
}, _ = (n, r, i, a) => {
|
|
84
64
|
let o = `endpoints.read.${r}`;
|
|
@@ -103,60 +83,35 @@ var i = [
|
|
|
103
83
|
v !== void 0 && !_.includes(v) && f(n, `${o}.query`, `"${r}" pages by ${u} but never uses ${v}, so every page resolves to the first one`, `Put ${v} in the query (or the path) this endpoint sends`);
|
|
104
84
|
}, v = (t, n, r) => {
|
|
105
85
|
let i = `endpoints.write.${n}`;
|
|
106
|
-
|
|
107
|
-
d(t, i, "A write endpoint must be an object", "It declares at least a method and a path");
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
h(t, r, i, "write"), m(t, r.method, `${i}.method`, !0), p(t, r.query, `${i}.query`, "write"), p(t, r.headers, `${i}.headers`, "write"), r.bodyPath !== void 0 && typeof r.bodyPath != "string" && d(t, `${i}.bodyPath`, "Must be a string", "It names where to nest the values, e.g. \"data\"");
|
|
86
|
+
e(r) ? (h(t, r, i, "write"), m(t, r.method, `${i}.method`, !0), p(t, r.query, `${i}.query`, "write"), p(t, r.headers, `${i}.headers`, "write"), r.bodyPath !== void 0 && typeof r.bodyPath != "string" && d(t, `${i}.bodyPath`, "Must be a string", "It names where to nest the values, e.g. \"data\"")) : d(t, i, "A write endpoint must be an object", "It declares at least a method and a path");
|
|
111
87
|
}, y = (t, n, r) => {
|
|
112
|
-
if (!e(n))
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (!e(n.write)) {
|
|
120
|
-
d(t, "endpoints.write", "Must be an object of endpoints keyed by name", "Omit it for a read-only connector");
|
|
121
|
-
return;
|
|
88
|
+
if (!e(n)) d(t, "endpoints", "A connector must declare its endpoints", "At least one read endpoint, usually \"list\"");
|
|
89
|
+
else {
|
|
90
|
+
if (!e(n.read) || Object.keys(n.read).length === 0) d(t, "endpoints.read", "A connector needs at least one read endpoint", "Name it \"list\" — that is the one a provider element addresses when it names none");
|
|
91
|
+
else for (let [e, i] of Object.entries(n.read)) _(t, e, i, r);
|
|
92
|
+
if (n.write !== void 0) {
|
|
93
|
+
if (!e(n.write)) d(t, "endpoints.write", "Must be an object of endpoints keyed by name", "Omit it for a read-only connector");
|
|
94
|
+
else for (let [e, r] of Object.entries(n.write)) v(t, e, r);
|
|
122
95
|
}
|
|
123
|
-
for (let [e, r] of Object.entries(n.write)) v(t, e, r);
|
|
124
96
|
}
|
|
125
97
|
}, b = (t, n) => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (n.in !== "header" && n.in !== "query" && d(t, "auth.in", "Auth travels in a header or a query parameter", "One of header, query"), s(n.name) || d(t, "auth.name", "Auth needs the name it is sent under", "e.g. \"Authorization\" for a bearer token"), typeof n.value != "string") {
|
|
132
|
-
d(t, "auth.value", "Must be a string", "A template, e.g. \"Bearer {{credential.token}}\"");
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
t.templates.push({
|
|
136
|
-
path: "auth.value",
|
|
137
|
-
value: n.value,
|
|
138
|
-
scope: "request"
|
|
139
|
-
});
|
|
140
|
-
}
|
|
98
|
+
n !== void 0 && (e(n) ? (n.in !== "header" && n.in !== "query" && d(t, "auth.in", "Auth travels in a header or a query parameter", "One of header, query"), s(n.name) || d(t, "auth.name", "Auth needs the name it is sent under", "e.g. \"Authorization\" for a bearer token"), typeof n.value == "string" ? t.templates.push({
|
|
99
|
+
path: "auth.value",
|
|
100
|
+
value: n.value,
|
|
101
|
+
scope: "request"
|
|
102
|
+
}) : d(t, "auth.value", "Must be a string", "A template, e.g. \"Bearer {{credential.token}}\"")) : d(t, "auth", "Must be an object", "Shape: { in, name, value }"));
|
|
141
103
|
}, x = (e, t) => {
|
|
142
104
|
let n = p(e, t, "operators", "filter");
|
|
143
105
|
if (n) for (let [t, r] of Object.entries(n)) typeof r == "string" && !r.includes("=") && d(e, `operators.${t}`, `Operator "${t}" renders no "key=value" pair, so a filter using it is dropped`, "Write the full query entry, e.g. \"filters[{{field}}][$eq]={{value}}\"");
|
|
144
106
|
}, S = (t, n) => {
|
|
145
107
|
if (n !== void 0) {
|
|
146
|
-
if (!e(n)) {
|
|
147
|
-
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
for (let [e, r] of Object.entries(n)) (typeof r != "string" || !a.includes(r)) && d(t, `fields.${e}`, `"${c(r)}" is not a field type`, `One of ${a.join(", ")}`);
|
|
108
|
+
if (!e(n)) d(t, "fields", "Must be an object of field name → type", `Types: ${a.join(", ")}`);
|
|
109
|
+
else for (let [e, r] of Object.entries(n)) (typeof r != "string" || !a.includes(r)) && d(t, `fields.${e}`, `"${c(r)}" is not a field type`, `One of ${a.join(", ")}`);
|
|
151
110
|
}
|
|
152
111
|
}, C = (e, t) => {
|
|
153
112
|
let n = !1;
|
|
154
113
|
for (let t of e.templates) for (let i of l(t.value)) i.startsWith("credential.") && (n = !0), u(i, t.scope) || f(e, t.path, `{{${i}}} is not a value the engine binds here, so it renders empty`, `Tokens available in this position: ${r.filter((e) => e.scopes.includes(t.scope)).map((e) => e.value).join(", ")}`);
|
|
155
|
-
|
|
156
|
-
f(e, "credential", "This manifest reads {{credential.…}} but names no credential, so every request goes unauthenticated", "The connector still saves. Ask the space owner to create the credential and attach it — the secret is never part of the manifest.");
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
!n && s(t) && f(e, "credential", "A credential is attached but no template reads {{credential.…}}, so it is never sent", "Reference it where the provider expects it, e.g. auth.value = \"Bearer {{credential.token}}\"");
|
|
114
|
+
n && !s(t) ? f(e, "credential", "This manifest reads {{credential.…}} but names no credential, so every request goes unauthenticated", "The connector still saves. Ask the space owner to create the credential and attach it — the secret is never part of the manifest.") : !n && s(t) && f(e, "credential", "A credential is attached but no template reads {{credential.…}}, so it is never sent", "Reference it where the provider expects it, e.g. auth.value = \"Bearer {{credential.token}}\"");
|
|
160
115
|
}, w = (t) => {
|
|
161
116
|
let n = {
|
|
162
117
|
errors: [],
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { e as getSourceName };
|
|
1
|
+
export { default as getSourceName } from "./getSourceName.mjs";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './hooks';
|
|
2
1
|
export * from './helpers';
|
|
3
2
|
export { evaluateComputed, liveSources } from './computed';
|
|
4
3
|
export { GLOBAL_SOURCES, COMPUTED_GLOBALS } from './globalSources';
|
|
@@ -7,3 +6,4 @@ export { default as getBindingsDetails } from './getBindingsDetails';
|
|
|
7
6
|
export { default as resolveVariables } from './resolveVariables';
|
|
8
7
|
export type { VariableScope } from './resolveVariables';
|
|
9
8
|
export { default as utility, utilityOptions } from './utility';
|
|
9
|
+
export * from './globalSources';
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { COMPUTED_GLOBALS as e, GLOBAL_SOURCES as t } from "./globalSources.mjs";
|
|
2
|
-
import { evaluateComputed as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import c from "./hooks/useRegisterSource.mjs";
|
|
1
|
+
import { COMPUTED_GLOBALS as e, GLOBAL_SOURCES as t, GLOBAL_SOURCE_FIELDS as n } from "./globalSources.mjs";
|
|
2
|
+
import { evaluateComputed as r, liveSources as i } from "./computed.mjs";
|
|
3
|
+
import a, { utilityOptions as o } from "./utility/index.mjs";
|
|
4
|
+
import s from "./getBindingsDetails.mjs";
|
|
5
|
+
import c from "./helpers/getSourceName.mjs";
|
|
7
6
|
import l from "./resolveVariables.mjs";
|
|
8
|
-
|
|
9
|
-
export { e as COMPUTED_GLOBALS, t as GLOBAL_SOURCES, n as evaluateComputed, o as getBindingsDetails, s as getSourceName, r as liveSources, l as resolveVariables, c as useRegisterSource, u as useResolvedVariables, i as utility, a as utilityOptions };
|
|
7
|
+
export { e as COMPUTED_GLOBALS, t as GLOBAL_SOURCES, n as GLOBAL_SOURCE_FIELDS, r as evaluateComputed, s as getBindingsDetails, c as getSourceName, i as liveSources, l as resolveVariables, a as utility, o as utilityOptions };
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import e from "./arrayMap.mjs";
|
|
2
2
|
import t from "./capitalize.mjs";
|
|
3
3
|
import n from "./dateConverter.mjs";
|
|
4
|
-
import r from "./
|
|
5
|
-
import i from "./
|
|
6
|
-
import a from "./
|
|
7
|
-
import o from "./
|
|
8
|
-
import s from "./
|
|
9
|
-
import c from "./
|
|
4
|
+
import { isTrue as r } from "./truthiness.mjs";
|
|
5
|
+
import i from "./not.mjs";
|
|
6
|
+
import a from "./staticValue.mjs";
|
|
7
|
+
import o from "./stringToArray.mjs";
|
|
8
|
+
import s from "./styleSelector.mjs";
|
|
9
|
+
import c from "./styleVariant.mjs";
|
|
10
|
+
import l from "./twigTemplate.mjs";
|
|
10
11
|
//#region src/dataSource/utility/index.ts
|
|
11
|
-
var
|
|
12
|
-
twigTemplate:
|
|
12
|
+
var u = {
|
|
13
|
+
twigTemplate: l,
|
|
13
14
|
dateConverter: n,
|
|
14
|
-
staticValue:
|
|
15
|
+
staticValue: a,
|
|
15
16
|
capitalize: t,
|
|
16
17
|
arrayMap: e,
|
|
17
|
-
stringToArray:
|
|
18
|
-
not:
|
|
19
|
-
styleSelector:
|
|
20
|
-
styleVariant:
|
|
21
|
-
},
|
|
18
|
+
stringToArray: o,
|
|
19
|
+
not: i,
|
|
20
|
+
styleSelector: s,
|
|
21
|
+
styleVariant: c
|
|
22
|
+
}, d = Object.values(u).map(({ title: e, action: t }) => ({
|
|
22
23
|
label: e,
|
|
23
24
|
value: t
|
|
24
25
|
}));
|
|
25
26
|
//#endregion
|
|
26
|
-
export {
|
|
27
|
+
export { u as default, r as isTrue, d as utilityOptions };
|
|
@@ -56,17 +56,7 @@ var e = (e, t = 2) => String(e).padStart(t, "0"), t = (t) => `${e(t.getHours())}
|
|
|
56
56
|
this.#r.push(n), this.#r.length > this.recentLimit && this.#r.shift();
|
|
57
57
|
for (let e of this.#n) e(n);
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
this.pendingLogs.push({
|
|
61
|
-
logType: e,
|
|
62
|
-
category: t,
|
|
63
|
-
message: r,
|
|
64
|
-
params: i,
|
|
65
|
-
time: a
|
|
66
|
-
}), this.pendingLogs.length > this.pendingLimit && this.pendingLogs.shift();
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
this.listening ? this.logsListened.push({
|
|
59
|
+
this.callbackInternal ? (this.listening ? this.logsListened.push({
|
|
70
60
|
logType: e,
|
|
71
61
|
category: t,
|
|
72
62
|
message: r,
|
|
@@ -78,7 +68,13 @@ var e = (e, t = 2) => String(e).padStart(t, "0"), t = (t) => `${e(t.getHours())}
|
|
|
78
68
|
message: r,
|
|
79
69
|
params: i,
|
|
80
70
|
time: a
|
|
81
|
-
}), this.#a()), this.logsListened.length > this.logsListenedLimit && this.logsListened.shift()
|
|
71
|
+
}), this.#a()), this.logsListened.length > this.logsListenedLimit && this.logsListened.shift()) : (this.pendingLogs.push({
|
|
72
|
+
logType: e,
|
|
73
|
+
category: t,
|
|
74
|
+
message: r,
|
|
75
|
+
params: i,
|
|
76
|
+
time: a
|
|
77
|
+
}), this.pendingLogs.length > this.pendingLimit && this.pendingLogs.shift());
|
|
82
78
|
}
|
|
83
79
|
#a() {
|
|
84
80
|
this.#t || (this.#t = !0, queueMicrotask(() => {
|
package/dist/elements/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { e as ComponentContext };
|
|
1
|
+
export { default as ComponentContext } from "./ComponentContext.mjs";
|
package/dist/flags/index.d.ts
CHANGED
package/dist/flags/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FLAG_GATE_PATTERN as e, FLAG_NAME_PATTERN as t, isFlagName as n, isSchemaFlag as r } from "./schemaFlag.mjs";
|
|
2
2
|
import { flagsCookieName as i, forcedFlagsFromCookies as a, parseFlagList as o, serializeFlagList as s, withForcedFlag as c, writeForcedFlags as l } from "./flagsCookie.mjs";
|
|
3
3
|
import { FLAG_LAYERS as u, flagUserFromSSR as d, flagValues as f, hasConditions as p, passesFlagGate as m, resolveFlags as h, undeclaredFlagOverrides as g } from "./resolveFlags.mjs";
|
|
4
|
-
|
|
4
|
+
import _, { flagUserFrom as v } from "./useFlagResolution.mjs";
|
|
5
|
+
export { e as FLAG_GATE_PATTERN, u as FLAG_LAYERS, t as FLAG_NAME_PATTERN, v as flagUserFrom, d as flagUserFromSSR, f as flagValues, i as flagsCookieName, a as forcedFlagsFromCookies, p as hasConditions, n as isFlagName, r as isSchemaFlag, o as parseFlagList, m as passesFlagGate, h as resolveFlags, s as serializeFlagList, g as undeclaredFlagOverrides, _ as useFlagResolution, c as withForcedFlag, l as writeForcedFlags };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "../
|
|
3
|
-
import { useCommonStore as n } from "../store/
|
|
4
|
-
import
|
|
1
|
+
import { resolveFlags as e } from "./resolveFlags.mjs";
|
|
2
|
+
import t from "../hooks/useStableValue.mjs";
|
|
3
|
+
import { useCommonStore as n } from "../store/storeHooks.mjs";
|
|
4
|
+
import r from "../store/renderSettings.mjs";
|
|
5
5
|
import { useMemo as i } from "react";
|
|
6
6
|
//#region src/flags/useFlagResolution.ts
|
|
7
7
|
var a = ({ authenticated: e, user: t }) => {
|
|
@@ -13,7 +13,7 @@ var a = ({ authenticated: e, user: t }) => {
|
|
|
13
13
|
roles: n.roles
|
|
14
14
|
} : r;
|
|
15
15
|
}, o = (o) => {
|
|
16
|
-
let { environment: s } =
|
|
16
|
+
let { environment: s } = r(), [[c, l, u, d, f]] = n([
|
|
17
17
|
"schema.flags",
|
|
18
18
|
"navigation.routeParams",
|
|
19
19
|
"navigation.queryParams",
|
|
@@ -23,7 +23,7 @@ var a = ({ authenticated: e, user: t }) => {
|
|
|
23
23
|
authenticated: p,
|
|
24
24
|
user: m
|
|
25
25
|
}), [p, m]);
|
|
26
|
-
return
|
|
26
|
+
return t(i(() => e(c, {
|
|
27
27
|
environment: s,
|
|
28
28
|
hostname: d,
|
|
29
29
|
routeParams: l,
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -16,3 +16,11 @@ export * from './twigWrapper';
|
|
|
16
16
|
export * from './utils';
|
|
17
17
|
export * from './security';
|
|
18
18
|
export { fetchManifest, generateFacade, syntaxHighlight };
|
|
19
|
+
export * from './enclosingSpace';
|
|
20
|
+
export * from './canonicalJson';
|
|
21
|
+
export * from './spaceRoot';
|
|
22
|
+
export * from './sharedContext';
|
|
23
|
+
export * from './images';
|
|
24
|
+
export * from './keys';
|
|
25
|
+
export * from './scroll';
|
|
26
|
+
export * from './clipboard';
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -6,16 +6,24 @@ import { hasValidToken as o } from "./twigWrapper/tokens/hasValidToken.mjs";
|
|
|
6
6
|
import { MAX_PARAM_PASSES as s, resolveStepParam as c } from "./twigWrapper/processTwig/resolveStepParam.mjs";
|
|
7
7
|
import { inspectTemplate as l } from "./twigWrapper/inspectTemplate.mjs";
|
|
8
8
|
import { templatePaths as u, templateRootNames as d } from "./twigWrapper/templateRoots.mjs";
|
|
9
|
-
import f from "./
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
9
|
+
import { SCROLL_BEHAVIORS as f, SCROLL_POSITIONS as p, SCROLL_TRIGGER as m, scrollDistance as h, scrollPosition as g, scrollState as _ } from "./scroll.mjs";
|
|
10
|
+
import { sharedContext as v } from "./sharedContext.mjs";
|
|
11
|
+
import y from "./fetchManifest.mjs";
|
|
12
|
+
import b from "./generateFacade.mjs";
|
|
13
|
+
import x from "./syntaxHighlight.mjs";
|
|
14
|
+
import { cookieFromHeader as S, documentCookies as C } from "./cookies.mjs";
|
|
15
|
+
import { elementOf as w, isElementTarget as T, isNodeTarget as E, nodeOf as D } from "./eventTarget.mjs";
|
|
16
|
+
import { formatDate as O, formatDateUTC as k, formatFromNow as A, formatUTCToLocal as j, getDurationMs as M, isValidFormat as N, parseDate as P, toUnixSeconds as F } from "./formatDate.mjs";
|
|
17
|
+
import { INTERVAL_TRIGGER as I, MIN_INTERVAL_MS as L, intervalOf as R } from "./interval.mjs";
|
|
18
|
+
import { isDate as z } from "./isDate.mjs";
|
|
19
|
+
import { isUserEdit as B } from "./reducerOrigin.mjs";
|
|
20
|
+
import { evaluateRuleGroup as V } from "./ruleEvaluator.mjs";
|
|
21
|
+
import { ParamsFromURL as H, delay as U, emptyObject as W, getDisplayName as G, getKeyDecoded as K, getPathsFromObject as q, hexToRGB as J, isInViewport as Y, makeId as X } from "./utils.mjs";
|
|
22
|
+
import { disableReactDevTools as Z } from "./security.mjs";
|
|
23
|
+
import { EnclosingSpaceContext as Q } from "./enclosingSpace.mjs";
|
|
24
|
+
import { canonicalJson as $ } from "./canonicalJson.mjs";
|
|
25
|
+
import { SPACE_ROOT_CLASS as ee, spaceRootOf as te } from "./spaceRoot.mjs";
|
|
26
|
+
import { IMAGE_PATH as ne, IMAGE_WIDTHS as re, imageSrcSet as ie, imageUrl as ae, isImageWidth as oe, isRemoteImage as se, isResizableImage as ce } from "./images.mjs";
|
|
27
|
+
import { KEY_TRIGGER as le, isFieldEditing as ue, keyPressCombo as de, parseKeys as fe } from "./keys.mjs";
|
|
28
|
+
import { NOT_COPIED_REASON as pe, clipboardWriter as me, copyText as he } from "./clipboard.mjs";
|
|
29
|
+
export { Q as EnclosingSpaceContext, ne as IMAGE_PATH, re as IMAGE_WIDTHS, I as INTERVAL_TRIGGER, le as KEY_TRIGGER, s as MAX_PARAM_PASSES, L as MIN_INTERVAL_MS, pe as NOT_COPIED_REASON, H as ParamsFromURL, f as SCROLL_BEHAVIORS, p as SCROLL_POSITIONS, m as SCROLL_TRIGGER, ee as SPACE_ROOT_CLASS, $ as canonicalJson, me as clipboardWriter, S as cookieFromHeader, he as copyText, U as delay, Z as disableReactDevTools, C as documentCookies, w as elementOf, W as emptyObject, V as evaluateRuleGroup, y as fetchManifest, t as filters, O as formatDate, k as formatDateUTC, A as formatFromNow, j as formatUTCToLocal, b as generateFacade, G as getDisplayName, M as getDurationMs, K as getKeyDecoded, q as getPathsFromObject, a as hasTemplateSyntax, o as hasValidToken, J as hexToRGB, ie as imageSrcSet, ae as imageUrl, l as inspectTemplate, R as intervalOf, z as isDate, T as isElementTarget, ue as isFieldEditing, oe as isImageWidth, Y as isInViewport, E as isNodeTarget, e as isRecord, se as isRemoteImage, ce as isResizableImage, B as isUserEdit, N as isValidFormat, de as keyPressCombo, X as makeId, D as nodeOf, P as parseDate, fe as parseKeys, n as processTwig, r as processTwigParam, i as processTwigValue, c as resolveStepParam, h as scrollDistance, g as scrollPosition, _ as scrollState, v as sharedContext, te as spaceRootOf, x as syntaxHighlight, u as templatePaths, d as templateRootNames, F as toUnixSeconds };
|
package/dist/helpers/keys.mjs
CHANGED
|
@@ -47,14 +47,10 @@ var e = "onKey", t = [
|
|
|
47
47
|
let o = e.trim().toLowerCase();
|
|
48
48
|
if (!o) return { problem: "an empty shortcut (two commas in a row, or one at the end)" };
|
|
49
49
|
let s = o.endsWith("++") ? [...o.slice(0, -2).split("+"), "+"] : o.split("+"), c = o === "+" ? ["+"] : s.filter((e) => e !== ""), l = /* @__PURE__ */ new Set(), u = [];
|
|
50
|
-
for (let e of c) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
u.push(Object.hasOwn(r, e) ? r[e] : e);
|
|
57
|
-
}
|
|
50
|
+
for (let e of c) if (Object.hasOwn(n, e)) {
|
|
51
|
+
let r = n[e];
|
|
52
|
+
l.add(r === "mod" ? t ? "meta" : "ctrl" : r);
|
|
53
|
+
} else u.push(Object.hasOwn(r, e) ? r[e] : e);
|
|
58
54
|
if (u.length !== 1) return { problem: `"${e.trim()}" names ${u.length ? `${u.length} keys (${u.join(", ")})` : "no key, only modifiers"}: a shortcut is modifiers and ONE key, like "shift+f"` };
|
|
59
55
|
let [d] = u;
|
|
60
56
|
return d.length !== 1 && !i.has(d) ? { problem: `"${d}" in "${e.trim()}" is not a key: use one character ("f", "?", "+") or a key's name (${[...i].slice(0, 15).join(", ")}, f1…f12)` } : { combo: a(l, d) };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { e as evaluate, t as evaluateExpression };
|
|
1
|
+
export { evaluate, evaluateExpression } from "./Evaluator.mjs";
|
|
@@ -19,11 +19,7 @@ var r = (e, t) => {
|
|
|
19
19
|
this.skipWs(), this.eof() || this.report(`Unexpected "${this.src.slice(this.pos).trim()}" in "${this.src.trim()}"`);
|
|
20
20
|
}
|
|
21
21
|
expectChar(e, t) {
|
|
22
|
-
|
|
23
|
-
this.pos++;
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
this.report(`Missing ${t} in "${this.src.trim()}"`);
|
|
22
|
+
this.skipWs(), this.peek() === e ? this.pos++ : this.report(`Missing ${t} in "${this.src.trim()}"`);
|
|
27
23
|
}
|
|
28
24
|
parseTernary() {
|
|
29
25
|
let t = this.parseOr();
|
|
@@ -153,16 +149,13 @@ var r = (e, t) => {
|
|
|
153
149
|
continue;
|
|
154
150
|
}
|
|
155
151
|
let n = this.matchBinaryOp();
|
|
156
|
-
if (n) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
break;
|
|
152
|
+
if (n) e = {
|
|
153
|
+
type: "binary",
|
|
154
|
+
operator: n,
|
|
155
|
+
left: e,
|
|
156
|
+
right: this.parseConcat()
|
|
157
|
+
}, this.skipWs();
|
|
158
|
+
else break;
|
|
166
159
|
}
|
|
167
160
|
return e;
|
|
168
161
|
}
|
|
@@ -300,11 +293,8 @@ var r = (e, t) => {
|
|
|
300
293
|
for (this.skipWs(); this.peek() !== e.RParen;) {
|
|
301
294
|
let r = this.scanName();
|
|
302
295
|
if (!r) return this.pos = t, null;
|
|
303
|
-
if (n.push(r), this.skipWs(), this.peek() === e.Comma)
|
|
304
|
-
|
|
305
|
-
continue;
|
|
306
|
-
}
|
|
307
|
-
break;
|
|
296
|
+
if (n.push(r), this.skipWs(), this.peek() === e.Comma) this.pos++, this.skipWs();
|
|
297
|
+
else break;
|
|
308
298
|
}
|
|
309
299
|
return this.skipWs(), this.peek() === e.RParen && (this.pos++, this.skipWs(), this.peek() === e.Equals && this.at(1) === e.Greater) ? (this.pos += 2, n) : (this.pos = t, null);
|
|
310
300
|
}
|
|
@@ -367,18 +357,14 @@ var r = (e, t) => {
|
|
|
367
357
|
if (t !== e.LBracket) break;
|
|
368
358
|
this.pos++;
|
|
369
359
|
let n = this.parseTernary();
|
|
370
|
-
|
|
371
|
-
i.push(String(n.value));
|
|
372
|
-
continue;
|
|
373
|
-
}
|
|
374
|
-
i &&= (r = {
|
|
360
|
+
this.expectChar(e.RBracket, "a closing \"]\""), i && n.type === "literal" && (typeof n.value == "string" || typeof n.value == "number") ? i.push(String(n.value)) : (i &&= (r = {
|
|
375
361
|
type: "path",
|
|
376
362
|
segments: i
|
|
377
363
|
}, null), r = {
|
|
378
364
|
type: "index",
|
|
379
365
|
object: r,
|
|
380
366
|
index: n
|
|
381
|
-
};
|
|
367
|
+
});
|
|
382
368
|
}
|
|
383
369
|
return i ? {
|
|
384
370
|
type: "path",
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { e as parse };
|
|
1
|
+
export { parse } from "./Parser.mjs";
|