@plitzi/sdk-shared 0.39.4 → 0.39.6

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/clients/index.d.ts +2 -1
  3. package/dist/clients/index.mjs +24 -15
  4. package/dist/credentials/index.d.ts +4 -0
  5. package/dist/credentials/index.mjs +3 -0
  6. package/dist/credentials/kinds.d.ts +54 -0
  7. package/dist/credentials/kinds.mjs +326 -0
  8. package/dist/credentials/problems.d.ts +14 -0
  9. package/dist/credentials/problems.mjs +43 -0
  10. package/dist/helpers/twigWrapper/charClass.mjs +21 -16
  11. package/dist/hooks/index.d.ts +2 -1
  12. package/dist/hooks/index.mjs +3 -2
  13. package/dist/hooks/usePrePaint.d.ts +12 -0
  14. package/dist/hooks/usePrePaint.mjs +8 -0
  15. package/dist/navigation/index.d.ts +1 -0
  16. package/dist/navigation/index.mjs +4 -3
  17. package/dist/navigation/notFoundPages.d.ts +25 -0
  18. package/dist/navigation/notFoundPages.mjs +11 -0
  19. package/dist/network/graphql/builder/Mutations/Space/SpaceCancelDeployMutation.d.ts +7 -0
  20. package/dist/network/graphql/builder/Mutations/Space/SpaceCancelDeployMutation.mjs +3 -0
  21. package/dist/network/graphql/builder/Mutations/Space/SpaceCancelScheduledPublishMutation.d.ts +6 -0
  22. package/dist/network/graphql/builder/Mutations/Space/SpaceCancelScheduledPublishMutation.mjs +3 -0
  23. package/dist/network/graphql/builder/Mutations/Space/SpaceDeployMutation.d.ts +1 -1
  24. package/dist/network/graphql/builder/Mutations/Space/SpaceDeployMutation.mjs +1 -1
  25. package/dist/network/graphql/builder/Mutations/Space/SpaceRedeployMutation.d.ts +5 -0
  26. package/dist/network/graphql/builder/Mutations/Space/SpaceRedeployMutation.mjs +3 -0
  27. package/dist/network/graphql/builder/Mutations/Space/SpaceRollbackMutation.d.ts +5 -0
  28. package/dist/network/graphql/builder/Mutations/Space/SpaceRollbackMutation.mjs +3 -0
  29. package/dist/network/graphql/builder/Mutations/Space/SpaceSchedulePublishMutation.d.ts +5 -0
  30. package/dist/network/graphql/builder/Mutations/Space/SpaceSchedulePublishMutation.mjs +3 -0
  31. package/dist/network/graphql/builder/Mutations/Space/SpaceSetTargetMutation.d.ts +10 -0
  32. package/dist/network/graphql/builder/Mutations/Space/SpaceSetTargetMutation.mjs +3 -0
  33. package/dist/network/graphql/builder/Mutations/Space/SpaceTargetAutomationMutation.d.ts +11 -0
  34. package/dist/network/graphql/builder/Mutations/Space/SpaceTargetAutomationMutation.mjs +3 -0
  35. package/dist/network/graphql/builder/Mutations/index.d.ts +14 -0
  36. package/dist/network/graphql/builder/Mutations/index.mjs +88 -74
  37. package/dist/network/graphql/builder/Queries/Space/SpaceDeployDetailQuery.d.ts +7 -0
  38. package/dist/network/graphql/builder/Queries/Space/SpaceDeployDetailQuery.mjs +3 -0
  39. package/dist/network/graphql/builder/Queries/Space/SpacePublishCheckQuery.d.ts +7 -0
  40. package/dist/network/graphql/builder/Queries/Space/SpacePublishCheckQuery.mjs +3 -0
  41. package/dist/network/graphql/builder/Queries/Space/SpaceReleasesQuery.d.ts +7 -0
  42. package/dist/network/graphql/builder/Queries/Space/SpaceReleasesQuery.mjs +3 -0
  43. package/dist/network/graphql/builder/Queries/Space/SpaceScheduledPublishesQuery.d.ts +7 -0
  44. package/dist/network/graphql/builder/Queries/Space/SpaceScheduledPublishesQuery.mjs +3 -0
  45. package/dist/network/graphql/builder/Queries/Space/SpaceSnapshotsQuery.d.ts +7 -0
  46. package/dist/network/graphql/builder/Queries/Space/SpaceSnapshotsQuery.mjs +3 -0
  47. package/dist/network/graphql/builder/Queries/Space/SpaceTargetsQuery.d.ts +7 -0
  48. package/dist/network/graphql/builder/Queries/Space/SpaceTargetsQuery.mjs +3 -0
  49. package/dist/network/graphql/builder/Queries/Space/SpaceVersionChangesQuery.d.ts +7 -0
  50. package/dist/network/graphql/builder/Queries/Space/SpaceVersionChangesQuery.mjs +3 -0
  51. package/dist/network/graphql/builder/Queries/index.d.ts +14 -0
  52. package/dist/network/graphql/builder/Queries/index.mjs +38 -24
  53. package/dist/schema/index.mjs +2 -2
  54. package/dist/schema/pageAccess.d.ts +6 -0
  55. package/dist/schema/pageAccess.mjs +23 -23
  56. package/dist/store/runtimeStatePersist.mjs +8 -8
  57. package/dist/store/storeHooks.d.ts +45 -45
  58. package/dist/types/ServerTypes.d.ts +6 -0
  59. package/dist/types/SpaceTypes.d.ts +277 -6
  60. package/dist/types/StoreTypes.d.ts +6 -0
  61. package/package.json +9 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @plitzi/sdk-shared
2
2
 
3
+ ## 0.39.6
4
+
5
+ No changes in this release.
6
+
7
+ ## 0.39.5
8
+
9
+ ### Patch Changes
10
+
11
+ - 4427674: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
12
+ `@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
13
+
3
14
  ## 0.39.4
4
15
 
5
16
  ### Patch Changes
@@ -8,7 +8,8 @@
8
8
  export declare const CLIENT_HEADER = "x-plitzi-client";
9
9
  /** What the platform answers a client older than itself with: its own version. */
10
10
  export declare const CURRENT_HEADER = "x-plitzi-current";
11
- export declare const CLIENT_SURFACES: readonly ["cli", "builder"];
11
+ /** `sdkServer` is a server of a customer's own running `@plitzi/sdk-server` and asking Plitzi for its space. */
12
+ export declare const CLIENT_SURFACES: readonly ["cli", "builder", "sdkServer"];
12
13
  export type ClientSurface = (typeof CLIENT_SURFACES)[number];
13
14
  /** The step that brings each surface up to the platform. */
14
15
  export declare const CLIENT_UPGRADE: Record<ClientSurface, string>;
@@ -1,38 +1,47 @@
1
1
  // src/clients/index.ts
2
- var e = "x-plitzi-client", t = "x-plitzi-current", n = ["cli", "builder"], r = {
2
+ var e = "x-plitzi-client", t = "x-plitzi-current", n = [
3
+ "cli",
4
+ "builder",
5
+ "sdkServer"
6
+ ], r = {
3
7
  cli: "in a project, plitzi upgrade packages (the CLI is one of them); elsewhere, npx @plitzi/cli@latest",
4
- builder: "reload the builder: it loads the platform’s own"
5
- }, i = (e) => {
8
+ builder: "reload the builder: it loads the platform’s own",
9
+ sdkServer: "update @plitzi/sdk-server, build the server again (plitzi build --ssr) and deploy it"
10
+ }, i = {
11
+ cli: "CLI",
12
+ builder: "builder",
13
+ sdkServer: "server"
14
+ }, a = (e) => {
6
15
  let t = /^(\d+)\.(\d+)\.(\d+)/.exec(e.trim());
7
16
  return t ? [
8
17
  Number(t[1]),
9
18
  Number(t[2]),
10
19
  Number(t[3])
11
20
  ] : void 0;
12
- }, a = (e, t) => e[0] - t[0] || e[1] - t[1] || e[2] - t[2], o = (e) => n.some((t) => t === e), s = (e, t) => `${e}/${t}`, c = (e) => {
21
+ }, o = (e, t) => e[0] - t[0] || e[1] - t[1] || e[2] - t[2], s = (e) => n.some((t) => t === e), c = (e, t) => `${e}/${t}`, l = (e) => {
13
22
  let [t = "", n = ""] = (e ?? "").split("/");
14
- return o(t) && i(n) ? {
23
+ return s(t) && a(n) ? {
15
24
  surface: t,
16
25
  version: n
17
26
  } : void 0;
18
- }, l = (e) => {
19
- let t = i(e);
27
+ }, u = (e) => {
28
+ let t = a(e);
20
29
  if (!t) return e;
21
30
  let [n, r] = t;
22
31
  return r > 0 ? `${String(n)}.${String(r - 1)}.0` : `${String(n)}.0.0`;
23
- }, u = (e, t) => {
24
- let n = c(e), r = n && i(n.version), o = i(t.current);
25
- if (!n || !r || !o) return { kind: "current" };
26
- let s = i(t.oldest[n.surface]);
27
- return s && a(r, s) < 0 ? {
32
+ }, d = (e, t) => {
33
+ let n = l(e), r = n && a(n.version), i = a(t.current);
34
+ if (!n || !r || !i) return { kind: "current" };
35
+ let s = a(t.oldest[n.surface]);
36
+ return s && o(r, s) < 0 ? {
28
37
  kind: "refused",
29
38
  ...n,
30
39
  oldest: t.oldest[n.surface],
31
40
  current: t.current
32
- } : r[0] < o[0] || r[0] === o[0] && r[1] < o[1] ? {
41
+ } : r[0] < i[0] || r[0] === i[0] && r[1] < i[1] ? {
33
42
  kind: "behind",
34
43
  ...n,
35
44
  current: t.current
36
45
  } : { kind: "current" };
37
- }, d = (e) => `This ${e.surface === "cli" ? "CLI" : "builder"} is ${e.version}, and the platform (${e.current}) takes ${e.oldest} and later: ${r[e.surface]}.`, f = (e, t, n) => `Plitzi ${n} is out, and this ${e === "cli" ? "CLI" : "builder"} is ${t}: ${r[e]}.`;
38
- export { e as CLIENT_HEADER, n as CLIENT_SURFACES, r as CLIENT_UPGRADE, t as CURRENT_HEADER, f as behindText, s as clientHeaderValue, c as clientOf, u as judgeClient, l as oldestByDefault, d as outdatedText };
46
+ }, f = (e) => `This ${i[e.surface]} is ${e.version}, and the platform (${e.current}) takes ${e.oldest} and later: ${r[e.surface]}.`, p = (e, t, n) => `Plitzi ${n} is out, and this ${i[e]} is ${t}: ${r[e]}.`;
47
+ export { e as CLIENT_HEADER, n as CLIENT_SURFACES, r as CLIENT_UPGRADE, t as CURRENT_HEADER, p as behindText, c as clientHeaderValue, l as clientOf, d as judgeClient, u as oldestByDefault, f as outdatedText };
@@ -0,0 +1,4 @@
1
+ export { CREDENTIAL_GROUPS, CREDENTIAL_KINDS, isCredentialProvider, isDeployCredentialKind } from './kinds';
2
+ export type { CredentialField, CredentialGroup, CredentialKind, DeployCredentialKind } from './kinds';
3
+ export { credentialData, credentialProblems } from './problems';
4
+ export type { CredentialProblem } from './problems';
@@ -0,0 +1,3 @@
1
+ import { CREDENTIAL_GROUPS as e, CREDENTIAL_KINDS as t, isCredentialProvider as n, isDeployCredentialKind as r } from "./kinds.mjs";
2
+ import { credentialData as i, credentialProblems as a } from "./problems.mjs";
3
+ export { e as CREDENTIAL_GROUPS, t as CREDENTIAL_KINDS, i as credentialData, a as credentialProblems, n as isCredentialProvider, r as isDeployCredentialKind };
@@ -0,0 +1,54 @@
1
+ import { SpaceCredentialProvider } from '../types';
2
+ /**
3
+ * Every kind of credential a space keeps, as one list: what it signs in to, where its provider issues one and with
4
+ * what permissions, and its fields — the builder's form draws it, its list labels each credential by it, and the server
5
+ * judges a saved one against it (`credentialProblems`). A new kind is a value of `SpaceCredentialProvider` and its entry
6
+ * here.
7
+ */
8
+ export type CredentialGroup = 'api' | 'storage' | 'deploy' | 'email' | 'access';
9
+ export type CredentialField = {
10
+ key: string;
11
+ label: string;
12
+ required: boolean;
13
+ /** Typed as a password: never shown back, never trimmed. */
14
+ secret?: boolean;
15
+ example?: string;
16
+ /** What to write, said under the field. */
17
+ hint?: string;
18
+ /** What a new credential starts with. */
19
+ initial?: string;
20
+ /** The values it takes, when it is a choice. */
21
+ choices?: readonly {
22
+ value: string;
23
+ label: string;
24
+ }[];
25
+ /** The shape its provider issues it in: a value of another shape is refused as it is saved, naming the shape. */
26
+ format?: {
27
+ pattern: RegExp;
28
+ expected: string;
29
+ };
30
+ };
31
+ export type CredentialKind = {
32
+ label: string;
33
+ /** Font Awesome classes. */
34
+ icon: string;
35
+ group: CredentialGroup;
36
+ /** What it signs in to, in one sentence. */
37
+ purpose: string;
38
+ /** Where its provider issues one, and what it must be allowed — in the provider's own words for its screens. */
39
+ obtain?: {
40
+ url?: string;
41
+ steps: readonly string[];
42
+ };
43
+ /** Its fields; none for an open one, whose keys are its author's (a connector's `{{credential.<key>}}`). */
44
+ fields: readonly CredentialField[];
45
+ };
46
+ export declare const CREDENTIAL_GROUPS: readonly {
47
+ id: CredentialGroup;
48
+ label: string;
49
+ }[];
50
+ export declare const CREDENTIAL_KINDS: Readonly<Record<SpaceCredentialProvider, CredentialKind>>;
51
+ export declare const isCredentialProvider: (value: unknown) => value is SpaceCredentialProvider;
52
+ export type DeployCredentialKind = 'github' | 'cloudflare' | 'netlify' | 'vercel' | 'ftp';
53
+ /** A kind only deploy targets sign in with (an AWS key or an R2 pair also opens a CDN, so they are storage's). */
54
+ export declare const isDeployCredentialKind: (value: unknown) => value is DeployCredentialKind;
@@ -0,0 +1,326 @@
1
+ // src/credentials/kinds.ts
2
+ var e = [
3
+ {
4
+ id: "api",
5
+ label: "APIs and content"
6
+ },
7
+ {
8
+ id: "storage",
9
+ label: "Storage"
10
+ },
11
+ {
12
+ id: "deploy",
13
+ label: "Deploys"
14
+ },
15
+ {
16
+ id: "email",
17
+ label: "Email"
18
+ },
19
+ {
20
+ id: "access",
21
+ label: "Site access"
22
+ }
23
+ ], t = "Copy both values as soon as they are shown: the secret is shown only once.", n = {
24
+ custom: {
25
+ label: "API, CMS or secret",
26
+ icon: "fa-solid fa-plug",
27
+ group: "api",
28
+ purpose: "Named values of yours: the token a connector signs in to an API or a CMS with, or the secret a webhook is signed by.",
29
+ obtain: { steps: ["Create a token in the API’s or the CMS’s settings (Strapi: Settings → API Tokens; Contentful: Settings → API keys).", "Give it only what the connector does: read, or read and write."] },
30
+ fields: []
31
+ },
32
+ s3: {
33
+ label: "AWS",
34
+ icon: "fa-brands fa-aws",
35
+ group: "storage",
36
+ purpose: "An AWS access key: opens an S3 bucket of the space’s CDN, and deploys to S3, CloudFront or Amplify.",
37
+ obtain: {
38
+ url: "https://console.aws.amazon.com/iam/home#/users",
39
+ steps: [
40
+ "In IAM, open a user meant for Plitzi (or create one) → Security credentials → Create access key.",
41
+ "Allow it the bucket only: s3:ListBucket, s3:GetObject, s3:PutObject and s3:DeleteObject — plus cloudfront:UpdateDistribution and cloudfront:CreateInvalidation for CloudFront, or the app’s Amplify deployments.",
42
+ t
43
+ ]
44
+ },
45
+ fields: [{
46
+ key: "accessKeyId",
47
+ label: "Access Key ID",
48
+ required: !0,
49
+ example: "AKIAIOSFODNN7EXAMPLE",
50
+ format: {
51
+ pattern: /^[A-Z0-9]{16,128}$/u,
52
+ expected: "16 to 128 upper-case letters and digits"
53
+ }
54
+ }, {
55
+ key: "secretAccessKey",
56
+ label: "Secret Access Key",
57
+ required: !0,
58
+ secret: !0,
59
+ format: {
60
+ pattern: /^[A-Za-z0-9/+=]{40}$/u,
61
+ expected: "40 characters"
62
+ }
63
+ }]
64
+ },
65
+ r2: {
66
+ label: "Cloudflare R2",
67
+ icon: "fa-brands fa-cloudflare",
68
+ group: "storage",
69
+ purpose: "An R2 API token’s key pair: opens a bucket of the space’s CDN, and deploys to R2.",
70
+ obtain: {
71
+ url: "https://dash.cloudflare.com/?to=/:account/r2/api-tokens",
72
+ steps: [
73
+ "In R2 → Manage API tokens → Create API token.",
74
+ "Object Read & Write, applied to the bucket alone.",
75
+ `${t} Use the S3 client’s pair, not the token value.`
76
+ ]
77
+ },
78
+ fields: [{
79
+ key: "accessKeyId",
80
+ label: "Access Key ID",
81
+ required: !0,
82
+ format: {
83
+ pattern: /^[0-9a-f]{32}$/u,
84
+ expected: "32 hexadecimal characters"
85
+ }
86
+ }, {
87
+ key: "secretAccessKey",
88
+ label: "Secret Access Key",
89
+ required: !0,
90
+ secret: !0,
91
+ format: {
92
+ pattern: /^[0-9a-f]{64}$/u,
93
+ expected: "64 hexadecimal characters"
94
+ }
95
+ }]
96
+ },
97
+ github: {
98
+ label: "GitHub",
99
+ icon: "fa-brands fa-github",
100
+ group: "deploy",
101
+ purpose: "Commits the site to a repository’s branch that GitHub Pages serves.",
102
+ obtain: {
103
+ url: "https://github.com/settings/personal-access-tokens/new",
104
+ steps: [
105
+ "Create a fine-grained personal access token.",
106
+ "Repository access: only the site’s repository.",
107
+ "Permissions: Contents — Read and write."
108
+ ]
109
+ },
110
+ fields: [{
111
+ key: "token",
112
+ label: "Token",
113
+ required: !0,
114
+ secret: !0,
115
+ example: "github_pat_…"
116
+ }]
117
+ },
118
+ cloudflare: {
119
+ label: "Cloudflare Pages",
120
+ icon: "fa-brands fa-cloudflare",
121
+ group: "deploy",
122
+ purpose: "Deploys the site to a Cloudflare Pages project.",
123
+ obtain: {
124
+ url: "https://dash.cloudflare.com/profile/api-tokens",
125
+ steps: [
126
+ "Create Token → Create Custom Token.",
127
+ "Permissions: Account → Cloudflare Pages → Edit, for the project’s account.",
128
+ "The account ID is on the account’s home page, under API in the right-hand column."
129
+ ]
130
+ },
131
+ fields: [{
132
+ key: "apiToken",
133
+ label: "API token",
134
+ required: !0,
135
+ secret: !0
136
+ }, {
137
+ key: "accountId",
138
+ label: "Account ID",
139
+ required: !0,
140
+ example: "023e105f4ecef8ad9ca31a8372d0c353",
141
+ format: {
142
+ pattern: /^[0-9a-f]{32}$/u,
143
+ expected: "32 hexadecimal characters"
144
+ }
145
+ }]
146
+ },
147
+ netlify: {
148
+ label: "Netlify",
149
+ icon: "fa-solid fa-diamond",
150
+ group: "deploy",
151
+ purpose: "Deploys the site to a Netlify site.",
152
+ obtain: {
153
+ url: "https://app.netlify.com/user/applications#personal-access-tokens",
154
+ steps: ["New access token, with an expiry you will renew.", "It reaches every site its account can: use an account meant for deploys when you can."]
155
+ },
156
+ fields: [{
157
+ key: "token",
158
+ label: "Personal access token",
159
+ required: !0,
160
+ secret: !0,
161
+ example: "nfp_…"
162
+ }]
163
+ },
164
+ vercel: {
165
+ label: "Vercel",
166
+ icon: "fa-solid fa-caret-up",
167
+ group: "deploy",
168
+ purpose: "Deploys the site to a Vercel project as its production deployment.",
169
+ obtain: {
170
+ url: "https://vercel.com/account/settings/tokens",
171
+ steps: ["Create a token.", "Scope: the team the project belongs to — not Full Account."]
172
+ },
173
+ fields: [{
174
+ key: "token",
175
+ label: "Token",
176
+ required: !0,
177
+ secret: !0
178
+ }]
179
+ },
180
+ ftp: {
181
+ label: "FTP",
182
+ icon: "fa-solid fa-server",
183
+ group: "deploy",
184
+ purpose: "Uploads the site to a host over FTP — over TLS unless the host has none.",
185
+ obtain: { steps: ["Your host’s control panel lists its FTP accounts (cPanel: Files → FTP Accounts).", "Use an account whose home is the site’s folder, so it reaches nothing else."] },
186
+ fields: [
187
+ {
188
+ key: "host",
189
+ label: "Host",
190
+ required: !0,
191
+ example: "ftp.example.com"
192
+ },
193
+ {
194
+ key: "port",
195
+ label: "Port",
196
+ required: !1,
197
+ example: "21",
198
+ format: {
199
+ pattern: /^\d{1,5}$/u,
200
+ expected: "a port number"
201
+ }
202
+ },
203
+ {
204
+ key: "user",
205
+ label: "User",
206
+ required: !0
207
+ },
208
+ {
209
+ key: "password",
210
+ label: "Password",
211
+ required: !0,
212
+ secret: !0
213
+ },
214
+ {
215
+ key: "secure",
216
+ label: "Security",
217
+ required: !1,
218
+ initial: "explicit",
219
+ choices: [
220
+ {
221
+ value: "explicit",
222
+ label: "TLS when connected (AUTH TLS, port 21)"
223
+ },
224
+ {
225
+ value: "implicit",
226
+ label: "TLS from the start (port 990)"
227
+ },
228
+ {
229
+ value: "none",
230
+ label: "None — the password travels in the clear"
231
+ }
232
+ ]
233
+ }
234
+ ]
235
+ },
236
+ smtp: {
237
+ label: "SMTP (email)",
238
+ icon: "fa-solid fa-envelope",
239
+ group: "email",
240
+ purpose: "The mail server a flow’s Send email step sends through.",
241
+ obtain: { steps: ["Your email provider’s SMTP settings: Postmark, SendGrid, Amazon SES, Resend, or your own server.", "Gmail and Outlook need an app password, never the account’s own."] },
242
+ fields: [
243
+ {
244
+ key: "host",
245
+ label: "Host",
246
+ required: !0,
247
+ example: "smtp.example.com"
248
+ },
249
+ {
250
+ key: "port",
251
+ label: "Port",
252
+ required: !0,
253
+ example: "587",
254
+ initial: "587"
255
+ },
256
+ {
257
+ key: "security",
258
+ label: "Security",
259
+ required: !0,
260
+ initial: "starttls",
261
+ choices: [
262
+ {
263
+ value: "starttls",
264
+ label: "STARTTLS (usually 587)"
265
+ },
266
+ {
267
+ value: "tls",
268
+ label: "TLS (usually 465)"
269
+ },
270
+ {
271
+ value: "none",
272
+ label: "None"
273
+ }
274
+ ]
275
+ },
276
+ {
277
+ key: "username",
278
+ label: "User",
279
+ required: !1
280
+ },
281
+ {
282
+ key: "password",
283
+ label: "Password",
284
+ required: !1,
285
+ secret: !0
286
+ },
287
+ {
288
+ key: "fromEmail",
289
+ label: "Send as (email)",
290
+ required: !0,
291
+ example: "hello@example.com"
292
+ },
293
+ {
294
+ key: "fromName",
295
+ label: "Send as (name)",
296
+ required: !1,
297
+ example: "Acme"
298
+ }
299
+ ]
300
+ },
301
+ ssr: {
302
+ label: "Site password",
303
+ icon: "fa-solid fa-lock",
304
+ group: "access",
305
+ purpose: "Asks a domain’s visitors for a password before it shows them a page.",
306
+ fields: [{
307
+ key: "user",
308
+ label: "User",
309
+ required: !0,
310
+ format: {
311
+ pattern: /^.{2,20}$/u,
312
+ expected: "2 to 20 characters"
313
+ }
314
+ }, {
315
+ key: "pass",
316
+ label: "Password",
317
+ required: !0,
318
+ secret: !0,
319
+ format: {
320
+ pattern: /^.{2,50}$/u,
321
+ expected: "2 to 50 characters"
322
+ }
323
+ }]
324
+ }
325
+ }, r = (e) => typeof e == "string" && Object.hasOwn(n, e), i = (e) => r(e) && n[e].group === "deploy";
326
+ export { e as CREDENTIAL_GROUPS, n as CREDENTIAL_KINDS, r as isCredentialProvider, i as isDeployCredentialKind };
@@ -0,0 +1,14 @@
1
+ import { SpaceCredentialProvider } from '../types';
2
+ /** What is wrong with one field of a credential, said by the field's label — or `''` for the credential as a whole. */
3
+ export type CredentialProblem = {
4
+ key: string;
5
+ message: string;
6
+ };
7
+ /**
8
+ * What keeps a credential from being used, field by field — nothing when it is whole: the one judgement the builder's
9
+ * form shows beside each field and the server refuses a save with. A field with a problem of its own is said once;
10
+ * what a kind checks beyond its fields (an SMTP server, by the rule `email.send` applies) is said for the rest.
11
+ */
12
+ export declare const credentialProblems: (provider: SpaceCredentialProvider, data: Record<string, unknown>) => CredentialProblem[];
13
+ /** A credential's values as they are kept: the fields it asks, text trimmed (a secret as typed), empty ones left out. */
14
+ export declare const credentialData: (provider: SpaceCredentialProvider, values: Record<string, string>) => Record<string, string>;
@@ -0,0 +1,43 @@
1
+ import { CREDENTIAL_KINDS as e } from "./kinds.mjs";
2
+ import { readSmtpCredential as t } from "../actions/smtp.mjs";
3
+ // src/credentials/problems.ts
4
+ var n = (e) => e.split(".").length === 3 && e.length > 100, r = (e, t) => {
5
+ let r = typeof t == "string" ? e.secret ? t : t.trim() : typeof t == "number" ? String(t) : "";
6
+ if (!r) return e.required ? `${e.label} is required` : void 0;
7
+ if (e.choices && !e.choices.some((e) => e.value === r)) return `${e.label} is one of ${e.choices.map((e) => e.value).join(", ")}`;
8
+ if (e.format && !e.format.pattern.test(r)) {
9
+ let t = n(r) ? "a signed token, not a key" : `${String(r.length)} characters`;
10
+ return `${e.label} is ${e.format.expected}; this one is ${t}`;
11
+ }
12
+ }, i = (n, i) => {
13
+ let a = e[n];
14
+ if (a.fields.length === 0) {
15
+ let e = Object.entries(i);
16
+ return e.length === 0 ? [{
17
+ key: "",
18
+ message: "It holds at least one value, under the name its connector reads it by"
19
+ }] : e.flatMap(([e, t]) => typeof t == "string" && t !== "" ? [] : [{
20
+ key: e,
21
+ message: `${e} has no value`
22
+ }]);
23
+ }
24
+ let o = a.fields.flatMap((e) => {
25
+ let t = r(e, i[e.key]);
26
+ return t ? [{
27
+ key: e.key,
28
+ message: t
29
+ }] : [];
30
+ });
31
+ if (n === "smtp") {
32
+ let e = new Set(o.map((e) => e.key));
33
+ o.push(...t(i).problems.filter((t) => !e.has(t.key)));
34
+ }
35
+ return o;
36
+ }, a = (t, n) => {
37
+ let r = e[t];
38
+ return r.fields.length === 0 ? Object.fromEntries(Object.entries(n).flatMap(([e, t]) => e.trim() ? [[e.trim(), t]] : [])) : Object.fromEntries(r.fields.flatMap((e) => {
39
+ let t = n[e.key] ?? "", r = e.secret ? t : t.trim();
40
+ return r ? [[e.key, r]] : [];
41
+ }));
42
+ };
43
+ export { a as credentialData, i as credentialProblems };
@@ -34,25 +34,30 @@ var e = {
34
34
  LowerN: 110,
35
35
  LowerR: 114,
36
36
  LowerT: 116
37
- }, t = (t) => t >= 97 && t <= 122 || t >= 65 && t <= 90 || t === e.Underscore, n = (n) => t(n) || n >= e.Zero && n <= e.Nine, r = (t) => n(t) || t === e.Minus, i = (t) => t >= e.Zero && t <= e.Nine, a = (t) => t === e.Space || t === e.Tab || t === e.Newline || t === e.CarriageReturn, o = (e) => {
37
+ }, t = (t) => t >= 97 && t <= 122 || t >= 65 && t <= 90 || t === e.Underscore, n = (n) => t(n) || n >= e.Zero && n <= e.Nine, r = (t) => n(t) || t === e.Minus, i = (t) => t >= e.Zero && t <= e.Nine, a = (t) => t === e.Space || t === e.Tab || t === e.Newline || t === e.CarriageReturn, o = /* @__PURE__ */ new Set([
38
+ "true",
39
+ "false",
40
+ "null",
41
+ "none"
42
+ ]), s = (e) => {
38
43
  let r = e.length;
39
- if (r === 0 || !t(e.charCodeAt(0))) return !1;
44
+ if (r === 0 || !t(e.charCodeAt(0)) || o.has(e)) return !1;
40
45
  for (let t = 1; t < r; t++) if (!n(e.charCodeAt(t))) return !1;
41
46
  return !0;
42
- }, s = (r) => {
47
+ }, c = (r) => {
43
48
  let a = r.length;
44
- if (a === 0 || !t(r.charCodeAt(0))) return !1;
45
- let o = !1, s = !1;
46
- for (let c = 1; c < a; c++) {
47
- let a = r.charCodeAt(c);
49
+ if (a === 0 || !t(r.charCodeAt(0)) || o.has(r)) return !1;
50
+ let s = !1, c = !1;
51
+ for (let o = 1; o < a; o++) {
52
+ let a = r.charCodeAt(o);
48
53
  if (a === e.Dot) {
49
- if (o) return !1;
50
- o = !0, s = !1;
51
- } else if (o) {
52
- if (s = i(a), !s && !t(a)) return !1;
53
- o = !1;
54
- } else if (s ? !i(a) : !n(a)) return !1;
54
+ if (s) return !1;
55
+ s = !0, c = !1;
56
+ } else if (s) {
57
+ if (c = i(a), !c && !t(a)) return !1;
58
+ s = !1;
59
+ } else if (c ? !i(a) : !n(a)) return !1;
55
60
  }
56
- return !o;
57
- }, c = (e) => o(e);
58
- export { e as Char, i as isDigit, s as isDottedPath, n as isIdentPart, t as isIdentStart, r as isPathPart, o as isSimpleIdentifier, a as isSpace, c as isVariableName };
61
+ return !s;
62
+ }, l = (e) => s(e);
63
+ export { e as Char, i as isDigit, c as isDottedPath, n as isIdentPart, t as isIdentStart, r as isPathPart, s as isSimpleIdentifier, a as isSpace, l as isVariableName };
@@ -1,7 +1,8 @@
1
1
  import { default as useFontHead } from './useFontHead';
2
2
  import { default as useNetwork } from './useNetwork';
3
3
  import { default as usePlitzi } from './usePlitzi';
4
+ import { default as usePrePaint } from './usePrePaint';
4
5
  import { default as useStableValue } from './useStableValue';
5
6
  export * from './useNetwork';
6
7
  export * from './usePlitzi';
7
- export { useFontHead, useNetwork, usePlitzi, useStableValue };
8
+ export { useFontHead, useNetwork, usePlitzi, usePrePaint, useStableValue };
@@ -1,5 +1,6 @@
1
1
  import e from "./useFontHead.mjs";
2
2
  import t from "./useNetwork.mjs";
3
3
  import n, { PlitziContext as r, PlitziProvider as i } from "./usePlitzi.mjs";
4
- import a from "./useStableValue.mjs";
5
- export { r as PlitziContext, i as PlitziProvider, e as useFontHead, t as useNetwork, n as usePlitzi, a as useStableValue };
4
+ import a from "./usePrePaint.mjs";
5
+ import o from "./useStableValue.mjs";
6
+ export { r as PlitziContext, i as PlitziProvider, e as useFontHead, t as useNetwork, n as usePlitzi, a as usePrePaint, o as useStableValue };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Asks the page to run `script` as soon as it is parsed — before it paints, before React is there — for what an element
3
+ * draws by a fact only the browser knows (the address's hash): the server draws without it, and the page would show
4
+ * the server's drawing until hydration. Written into the server render's result (`SSRRenderResult.prePaint`), once per
5
+ * name however many elements ask, and run by the page with its own script policy. In the browser it does nothing: the
6
+ * element draws by the fact itself there, and must hydrate on what the script left in the document.
7
+ *
8
+ * `enabled` false asks for nothing — an element that needs it only as it is configured. `script` is a function of plain JavaScript that reads nothing but the document and the window — its source is what
9
+ * the page runs, so it may close over nothing.
10
+ */
11
+ declare const usePrePaint: (name: string, script: () => void, enabled?: boolean) => void;
12
+ export default usePrePaint;
@@ -0,0 +1,8 @@
1
+ import e from "../network/react/NetworkContext.mjs";
2
+ import { use as t } from "react";
3
+ // src/hooks/usePrePaint.ts
4
+ var n = (n, r, i = !0) => {
5
+ let { server: a } = t(e), o = a.ssr?.renderResult;
6
+ o && i && (o.prePaint ??= {}, o.prePaint[n] ??= `(${r.toString()})();`);
7
+ };
8
+ export { n as default };
@@ -1,4 +1,5 @@
1
1
  export { matchPath } from './matchPath';
2
+ export { freeSlugFor, isNotFoundPage, notFoundPageIn, pageFolderOf, slugOfName } from './notFoundPages';
2
3
  export { SITEMAP_EXCLUSION_WORDS, sitemapExclusion, sitemapPages, sitemapPaths } from './sitemap';
3
4
  export { getPageFullPath, getPaths, isAbsoluteUrl, isPageAuthored, matchRoutePath, notFoundPageFor, getRouteParams, getSlugParams, navigationTarget, NOT_FOUND_SLUG } from './routes';
4
5
  export type { PathMatch, PathPattern } from './matchPath';
@@ -1,4 +1,5 @@
1
1
  import { matchPath as e } from "./matchPath.mjs";
2
- import { SITEMAP_EXCLUSION_WORDS as t, sitemapExclusion as n, sitemapPages as r, sitemapPaths as i } from "./sitemap.mjs";
3
- import { NOT_FOUND_SLUG as a, getPageFullPath as o, getPaths as s, getRouteParams as c, getSlugParams as l, isAbsoluteUrl as u, isPageAuthored as d, matchRoutePath as f, navigationTarget as p, notFoundPageFor as m } from "./routes.mjs";
4
- export { a as NOT_FOUND_SLUG, t as SITEMAP_EXCLUSION_WORDS, o as getPageFullPath, s as getPaths, c as getRouteParams, l as getSlugParams, u as isAbsoluteUrl, d as isPageAuthored, e as matchPath, f as matchRoutePath, p as navigationTarget, m as notFoundPageFor, n as sitemapExclusion, r as sitemapPages, i as sitemapPaths };
2
+ import { freeSlugFor as t, isNotFoundPage as n, notFoundPageIn as r, pageFolderOf as i, slugOfName as a } from "./notFoundPages.mjs";
3
+ import { SITEMAP_EXCLUSION_WORDS as o, sitemapExclusion as s, sitemapPages as c, sitemapPaths as l } from "./sitemap.mjs";
4
+ import { NOT_FOUND_SLUG as u, getPageFullPath as d, getPaths as f, getRouteParams as p, getSlugParams as m, isAbsoluteUrl as h, isPageAuthored as g, matchRoutePath as _, navigationTarget as v, notFoundPageFor as y } from "./routes.mjs";
5
+ export { u as NOT_FOUND_SLUG, o as SITEMAP_EXCLUSION_WORDS, t as freeSlugFor, d as getPageFullPath, f as getPaths, p as getRouteParams, m as getSlugParams, h as isAbsoluteUrl, n as isNotFoundPage, g as isPageAuthored, e as matchPath, _ as matchRoutePath, v as navigationTarget, y as notFoundPageFor, r as notFoundPageIn, i as pageFolderOf, s as sitemapExclusion, c as sitemapPages, l as sitemapPaths, a as slugOfName };