@plitzi/sdk-shared 0.38.20 → 0.38.22

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 (39) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/dist/actions/access.d.ts +5 -0
  3. package/dist/actions/access.mjs +11 -2
  4. package/dist/actions/index.d.ts +2 -1
  5. package/dist/actions/index.mjs +10 -9
  6. package/dist/actions/jobs.d.ts +10 -0
  7. package/dist/actions/jobs.mjs +17 -0
  8. package/dist/actions/validateDocument.mjs +56 -56
  9. package/dist/dataSource/globalSources.d.ts +1 -1
  10. package/dist/navigation/routes.mjs +38 -37
  11. package/dist/network/graphql/builder/Mutations/Space/jobs/SpaceControlJobMutation.d.ts +5 -0
  12. package/dist/network/graphql/builder/Mutations/Space/jobs/SpaceControlJobMutation.mjs +4 -0
  13. package/dist/network/graphql/builder/Mutations/index.d.ts +2 -0
  14. package/dist/network/graphql/builder/Mutations/index.mjs +70 -68
  15. package/dist/network/graphql/builder/Queries/Space/SpaceDeploymentsQuery.d.ts +1 -1
  16. package/dist/network/graphql/builder/Queries/Space/SpaceDeploymentsQuery.mjs +1 -1
  17. package/dist/network/graphql/builder/Queries/Space/SpaceJobsQuery.d.ts +10 -0
  18. package/dist/network/graphql/builder/Queries/Space/SpaceJobsQuery.mjs +4 -0
  19. package/dist/network/graphql/builder/Queries/index.d.ts +2 -0
  20. package/dist/network/graphql/builder/Queries/index.mjs +16 -14
  21. package/dist/realtime/index.d.ts +1 -1
  22. package/dist/realtime/index.mjs +4 -4
  23. package/dist/realtime/topics.d.ts +5 -0
  24. package/dist/realtime/topics.mjs +11 -11
  25. package/dist/schema/index.d.ts +1 -0
  26. package/dist/schema/index.mjs +12 -11
  27. package/dist/schema/pageAccess.d.ts +41 -0
  28. package/dist/schema/pageAccess.mjs +54 -0
  29. package/dist/store/storeHooks.d.ts +33 -33
  30. package/dist/types/ActionTypes.d.ts +0 -204
  31. package/dist/types/FunctionTypes.d.ts +41 -0
  32. package/dist/types/JobTypes.d.ts +327 -0
  33. package/dist/types/JobTypes.mjs +0 -0
  34. package/dist/types/ServerTypes.d.ts +17 -3
  35. package/dist/types/SpaceTypes.d.ts +5 -0
  36. package/dist/types/index.d.ts +1 -0
  37. package/package.json +1 -1
  38. package/vite.config.ts +9 -7
  39. package/dist/helpers/twigWrapper/bench.bench.d.ts +0 -1
@@ -47,53 +47,54 @@ import G from "./Space/functions/SpaceInstallTemplateFunctionsMutation.mjs";
47
47
  import K from "./Space/functions/SpaceRemoveFunctionsMutation.mjs";
48
48
  import q from "./Space/functions/SpaceSaveFunctionsMutation.mjs";
49
49
  import J from "./Space/functions/SpaceTryFunctionMutation.mjs";
50
- import Y from "./Space/pages/SpaceAddPageMutation.mjs";
51
- import X from "./Space/pages/SpaceHomePageMutation.mjs";
52
- import Z from "./Space/pages/SpaceRemovePageMutation.mjs";
53
- import Q from "./Space/pages/SpaceUpdatePageMutation.mjs";
54
- import $ from "./Space/resources/SpaceAddResourceMutation.mjs";
55
- import ee from "./Space/resources/SpaceMoveResourceMutation.mjs";
56
- import te from "./Space/resources/SpaceRemoveResourceMutation.mjs";
57
- import ne from "./Space/runtime/SpaceRemoveRuntimeMutation.mjs";
58
- import re from "./Space/runtime/SpaceRemoveRuntimeVariableMutation.mjs";
59
- import ie from "./Space/runtime/SpaceSetRuntimeSizeMutation.mjs";
60
- import ae from "./Space/runtime/SpaceSetRuntimeVariableMutation.mjs";
61
- import oe from "./Space/runtime/SpaceStartRuntimeMutation.mjs";
62
- import se from "./Space/runtime/SpaceStopRuntimeMutation.mjs";
63
- import ce from "./Space/variables/SpaceAddVariableMutation.mjs";
64
- import le from "./Space/variables/SpaceRemoveVariableMutation.mjs";
65
- import ue from "./Space/variables/SpaceUpdateVariableMutation.mjs";
66
- import de from "./Space/visitors/SpaceAddVisitorMutation.mjs";
67
- import fe from "./Space/visitors/SpaceRemoveVisitorMutation.mjs";
68
- import pe from "./Style/StyleUpdateMutation.mjs";
69
- import me from "./Style/StyleUpdateSettingsMutation.mjs";
70
- import he from "./Style/fonts/StyleAddFontMutation.mjs";
71
- import ge from "./Style/fonts/StyleRemoveFontMutation.mjs";
72
- import _e from "./Style/fonts/StyleUpdateFontMutation.mjs";
73
- import ve from "./Style/selectorVariables/StyleAddSelectorVariableMutation.mjs";
74
- import ye from "./Style/selectorVariables/StyleRemoveSelectorVariableMutation.mjs";
75
- import be from "./Style/selectorVariables/StyleUpdateSelectorVariableMutation.mjs";
76
- import xe from "./Style/selectors/StyleAddSelectorMutation.mjs";
77
- import Se from "./Style/selectors/StyleRemoveSelectorMutation.mjs";
78
- import Ce from "./Style/selectors/StyleRemoveSelectorsMutation.mjs";
79
- import we from "./Style/selectors/StyleUpdateSelectorMutation.mjs";
80
- import Te from "./Style/variables/StyleAddVariableMutation.mjs";
81
- import Ee from "./Style/variables/StyleRemoveVariableMutation.mjs";
82
- import De from "./Style/variables/StyleUpdateVariableMutation.mjs";
50
+ import Y from "./Space/jobs/SpaceControlJobMutation.mjs";
51
+ import X from "./Space/pages/SpaceAddPageMutation.mjs";
52
+ import Z from "./Space/pages/SpaceHomePageMutation.mjs";
53
+ import Q from "./Space/pages/SpaceRemovePageMutation.mjs";
54
+ import $ from "./Space/pages/SpaceUpdatePageMutation.mjs";
55
+ import ee from "./Space/resources/SpaceAddResourceMutation.mjs";
56
+ import te from "./Space/resources/SpaceMoveResourceMutation.mjs";
57
+ import ne from "./Space/resources/SpaceRemoveResourceMutation.mjs";
58
+ import re from "./Space/runtime/SpaceRemoveRuntimeMutation.mjs";
59
+ import ie from "./Space/runtime/SpaceRemoveRuntimeVariableMutation.mjs";
60
+ import ae from "./Space/runtime/SpaceSetRuntimeSizeMutation.mjs";
61
+ import oe from "./Space/runtime/SpaceSetRuntimeVariableMutation.mjs";
62
+ import se from "./Space/runtime/SpaceStartRuntimeMutation.mjs";
63
+ import ce from "./Space/runtime/SpaceStopRuntimeMutation.mjs";
64
+ import le from "./Space/variables/SpaceAddVariableMutation.mjs";
65
+ import ue from "./Space/variables/SpaceRemoveVariableMutation.mjs";
66
+ import de from "./Space/variables/SpaceUpdateVariableMutation.mjs";
67
+ import fe from "./Space/visitors/SpaceAddVisitorMutation.mjs";
68
+ import pe from "./Space/visitors/SpaceRemoveVisitorMutation.mjs";
69
+ import me from "./Style/StyleUpdateMutation.mjs";
70
+ import he from "./Style/StyleUpdateSettingsMutation.mjs";
71
+ import ge from "./Style/fonts/StyleAddFontMutation.mjs";
72
+ import _e from "./Style/fonts/StyleRemoveFontMutation.mjs";
73
+ import ve from "./Style/fonts/StyleUpdateFontMutation.mjs";
74
+ import ye from "./Style/selectorVariables/StyleAddSelectorVariableMutation.mjs";
75
+ import be from "./Style/selectorVariables/StyleRemoveSelectorVariableMutation.mjs";
76
+ import xe from "./Style/selectorVariables/StyleUpdateSelectorVariableMutation.mjs";
77
+ import Se from "./Style/selectors/StyleAddSelectorMutation.mjs";
78
+ import Ce from "./Style/selectors/StyleRemoveSelectorMutation.mjs";
79
+ import we from "./Style/selectors/StyleRemoveSelectorsMutation.mjs";
80
+ import Te from "./Style/selectors/StyleUpdateSelectorMutation.mjs";
81
+ import Ee from "./Style/variables/StyleAddVariableMutation.mjs";
82
+ import De from "./Style/variables/StyleRemoveVariableMutation.mjs";
83
+ import Oe from "./Style/variables/StyleUpdateVariableMutation.mjs";
83
84
  //#region src/network/graphql/builder/Mutations/index.ts
84
- var Oe = {
85
+ var ke = {
85
86
  SpaceUpdate: p,
86
87
  SpaceUpdateSchema: h,
87
- SpaceAddPage: Y,
88
- SpaceHomePage: X,
89
- SpaceUpdatePage: Q,
90
- SpaceRemovePage: Z,
88
+ SpaceAddPage: X,
89
+ SpaceHomePage: Z,
90
+ SpaceUpdatePage: $,
91
+ SpaceRemovePage: Q,
91
92
  SpaceAddPageFolder: H,
92
93
  SpaceUpdatePageFolder: W,
93
94
  SpaceRemovePageFolder: U,
94
- SpaceAddVariable: ce,
95
- SpaceUpdateVariable: ue,
96
- SpaceRemoveVariable: le,
95
+ SpaceAddVariable: le,
96
+ SpaceUpdateVariable: de,
97
+ SpaceRemoveVariable: ue,
97
98
  SpaceSetFlag: V,
98
99
  SpaceRemoveFlag: B,
99
100
  SpaceAddElement: e,
@@ -111,9 +112,9 @@ var Oe = {
111
112
  SpaceAddPlugin: t,
112
113
  SpaceUpdatePlugin: m,
113
114
  SpaceRemovePlugin: l,
114
- SpaceAddResource: $,
115
- SpaceMoveResource: ee,
116
- SpaceRemoveResource: te,
115
+ SpaceAddResource: ee,
116
+ SpaceMoveResource: te,
117
+ SpaceRemoveResource: ne,
117
118
  SpaceAddCdn: S,
118
119
  SpaceUpdateCdn: D,
119
120
  SpaceSetCdnCredential: T,
@@ -130,40 +131,41 @@ var Oe = {
130
131
  SpaceRemoveFunctions: K,
131
132
  SpaceInstallTemplateFunctions: G,
132
133
  SpaceTryFunction: J,
134
+ SpaceControlJob: Y,
133
135
  SpaceAddConnector: M,
134
136
  SpaceUpdateConnector: P,
135
137
  SpaceRemoveConnector: N,
136
138
  SpaceAddCredential: F,
137
139
  SpaceUpdateCredential: L,
138
140
  SpaceRemoveCredential: I,
139
- SpaceAddVisitor: de,
140
- SpaceRemoveVisitor: fe,
141
- SpaceSetRuntimeVariable: ae,
142
- SpaceSetRuntimeSize: ie,
143
- SpaceStartRuntime: oe,
144
- SpaceStopRuntime: se,
145
- SpaceRemoveRuntimeVariable: re,
146
- SpaceRemoveRuntime: ne,
141
+ SpaceAddVisitor: fe,
142
+ SpaceRemoveVisitor: pe,
143
+ SpaceSetRuntimeVariable: oe,
144
+ SpaceSetRuntimeSize: ae,
145
+ SpaceStartRuntime: se,
146
+ SpaceStopRuntime: ce,
147
+ SpaceRemoveRuntimeVariable: ie,
148
+ SpaceRemoveRuntime: re,
147
149
  SpacePublish: s,
148
150
  SpacePublishFlags: z,
149
151
  SpaceFixIssues: a,
150
152
  SpaceDeploy: i,
151
153
  SpaceUpdateSettings: g,
152
- StyleAddSelector: xe,
153
- StyleUpdateSelector: we,
154
- StyleRemoveSelector: Se,
155
- StyleRemoveSelectors: Ce,
156
- StyleAddSelectorVariable: ve,
157
- StyleUpdateSelectorVariable: be,
158
- StyleRemoveSelectorVariable: ye,
159
- StyleAddFont: he,
160
- StyleUpdateFont: _e,
161
- StyleRemoveFont: ge,
162
- StyleAddVariable: Te,
163
- StyleUpdateVariable: De,
164
- StyleRemoveVariable: Ee,
165
- StyleUpdate: pe,
166
- StyleUpdateSettings: me
154
+ StyleAddSelector: Se,
155
+ StyleUpdateSelector: Te,
156
+ StyleRemoveSelector: Ce,
157
+ StyleRemoveSelectors: we,
158
+ StyleAddSelectorVariable: ye,
159
+ StyleUpdateSelectorVariable: xe,
160
+ StyleRemoveSelectorVariable: be,
161
+ StyleAddFont: ge,
162
+ StyleUpdateFont: ve,
163
+ StyleRemoveFont: _e,
164
+ StyleAddVariable: Ee,
165
+ StyleUpdateVariable: Oe,
166
+ StyleRemoveVariable: De,
167
+ StyleUpdate: me,
168
+ StyleUpdateSettings: he
167
169
  };
168
170
  //#endregion
169
- export { Oe as default };
171
+ export { ke as default };
@@ -5,5 +5,5 @@ export type TSpaceDeploymentsQuery = {
5
5
  pageInfo: PageInfo;
6
6
  };
7
7
  };
8
- declare const SpaceDeploymentsQuery = "\n query SpaceDeploymentsQuery($filter: DeploymentInput, $page: Int, $pageSize: Int, $offset: Int) {\n SpaceDeployments(filter: $filter, page: $page, pageSize: $pageSize, offset: $offset) {\n edges {\n id\n environment\n revision\n domain\n isVerified\n default\n credential {\n identifier\n provider\n }\n createdAt\n updatedAt\n }\n pageInfo {\n hasPrevPage\n hasNextPage\n from\n to\n total\n }\n }\n }\n";
8
+ declare const SpaceDeploymentsQuery = "\n query SpaceDeploymentsQuery($filter: DeploymentInput, $page: Int, $pageSize: Int, $offset: Int) {\n SpaceDeployments(filter: $filter, page: $page, pageSize: $pageSize, offset: $offset) {\n edges {\n id\n environment\n revision\n domain\n isVerified\n default\n provider\n credential {\n identifier\n provider\n }\n createdAt\n updatedAt\n }\n pageInfo {\n hasPrevPage\n hasNextPage\n from\n to\n total\n }\n }\n }\n";
9
9
  export default SpaceDeploymentsQuery;
@@ -1,4 +1,4 @@
1
1
  //#region src/network/graphql/builder/Queries/Space/SpaceDeploymentsQuery.ts
2
- var e = "\n query SpaceDeploymentsQuery($filter: DeploymentInput, $page: Int, $pageSize: Int, $offset: Int) {\n SpaceDeployments(filter: $filter, page: $page, pageSize: $pageSize, offset: $offset) {\n edges {\n id\n environment\n revision\n domain\n isVerified\n default\n credential {\n identifier\n provider\n }\n createdAt\n updatedAt\n }\n pageInfo {\n hasPrevPage\n hasNextPage\n from\n to\n total\n }\n }\n }\n";
2
+ var e = "\n query SpaceDeploymentsQuery($filter: DeploymentInput, $page: Int, $pageSize: Int, $offset: Int) {\n SpaceDeployments(filter: $filter, page: $page, pageSize: $pageSize, offset: $offset) {\n edges {\n id\n environment\n revision\n domain\n isVerified\n default\n provider\n credential {\n identifier\n provider\n }\n createdAt\n updatedAt\n }\n pageInfo {\n hasPrevPage\n hasNextPage\n from\n to\n total\n }\n }\n }\n";
3
3
  //#endregion
4
4
  export { e as default };
@@ -0,0 +1,10 @@
1
+ import { PageInfo, SpaceJob } from '../../../../../types';
2
+ export type TSpaceJobsQuery = {
3
+ SpaceJobs: {
4
+ edges: SpaceJob[];
5
+ pageInfo: PageInfo;
6
+ };
7
+ };
8
+ /** The space's queue, most recently touched first: its actions' queued runs and its functions' jobs. */
9
+ declare const SpaceJobsQuery = "\n query SpaceJobsQuery($kind: String, $name: String, $status: String, $page: Int, $pageSize: Int) {\n SpaceJobs(kind: $kind, name: $name, status: $status, page: $page, pageSize: $pageSize) {\n edges {\n id\n environment\n kind\n name\n trigger\n startedBy\n status\n progress\n step\n error\n attempts\n maxAttempts\n activeMs\n pauseRequested\n cancelRequested\n key\n missed\n dueAt\n createdAt\n updatedAt\n }\n pageInfo {\n hasPrevPage\n hasNextPage\n from\n to\n total\n }\n }\n }\n";
10
+ export default SpaceJobsQuery;
@@ -0,0 +1,4 @@
1
+ //#region src/network/graphql/builder/Queries/Space/SpaceJobsQuery.ts
2
+ var e = "\n query SpaceJobsQuery($kind: String, $name: String, $status: String, $page: Int, $pageSize: Int) {\n SpaceJobs(kind: $kind, name: $name, status: $status, page: $page, pageSize: $pageSize) {\n edges {\n id\n environment\n kind\n name\n trigger\n startedBy\n status\n progress\n step\n error\n attempts\n maxAttempts\n activeMs\n pauseRequested\n cancelRequested\n key\n missed\n dueAt\n createdAt\n updatedAt\n }\n pageInfo {\n hasPrevPage\n hasNextPage\n from\n to\n total\n }\n }\n }\n";
3
+ //#endregion
4
+ export { e as default };
@@ -11,6 +11,7 @@ import { TSpaceDataQuery } from './Space/SpaceDataQuery';
11
11
  import { TSpaceDeploymentsQuery } from './Space/SpaceDeploymentsQuery';
12
12
  import { TSpaceFunctionsQuery } from './Space/SpaceFunctionsQuery';
13
13
  import { TSpaceIssuesQuery } from './Space/SpaceIssuesQuery';
14
+ import { TSpaceJobsQuery } from './Space/SpaceJobsQuery';
14
15
  import { TSpaceLatestRevisionQuery } from './Space/SpaceLatestRevisionQuery';
15
16
  import { TSpaceQuotaQuery } from './Space/SpaceQuotaQuery';
16
17
  import { TSpaceResourcesQuery } from './Space/SpaceResourcesQuery';
@@ -35,6 +36,7 @@ export type BuilderQueriesMap = {
35
36
  SpaceActionTasks: TSpaceActionTasksQuery;
36
37
  SpaceData: TSpaceDataQuery;
37
38
  SpaceFunctions: TSpaceFunctionsQuery;
39
+ SpaceJobs: TSpaceJobsQuery;
38
40
  SpaceConnectors: TSpaceConnectorsQuery;
39
41
  SpaceCredentials: TSpaceCredentialsQuery;
40
42
  SpaceVersionContents: TSpaceVersionContentsQuery;
@@ -11,20 +11,21 @@ import l from "./Space/SpaceDataQuery.mjs";
11
11
  import u from "./Space/SpaceDeploymentsQuery.mjs";
12
12
  import d from "./Space/SpaceFunctionsQuery.mjs";
13
13
  import f from "./Space/SpaceIssuesQuery.mjs";
14
- import p from "./Space/SpaceLatestRevisionQuery.mjs";
15
- import m from "./Space/SpaceQuotaQuery.mjs";
16
- import h from "./Space/SpaceResourcesQuery.mjs";
17
- import g from "./Space/SpaceRuntimeQuery.mjs";
18
- import _ from "./Space/SpaceVersionContentsQuery.mjs";
19
- import v from "./Space/SpaceVisitorsQuery.mjs";
14
+ import p from "./Space/SpaceJobsQuery.mjs";
15
+ import m from "./Space/SpaceLatestRevisionQuery.mjs";
16
+ import h from "./Space/SpaceQuotaQuery.mjs";
17
+ import g from "./Space/SpaceResourcesQuery.mjs";
18
+ import _ from "./Space/SpaceRuntimeQuery.mjs";
19
+ import v from "./Space/SpaceVersionContentsQuery.mjs";
20
+ import y from "./Space/SpaceVisitorsQuery.mjs";
20
21
  //#region src/network/graphql/builder/Queries/index.ts
21
- var y = {
22
+ var b = {
22
23
  Init: e,
23
- SpaceLatestRevision: p,
24
- SpaceQuota: m,
24
+ SpaceLatestRevision: m,
25
+ SpaceQuota: h,
25
26
  SpaceIssues: f,
26
27
  SpaceChanges: a,
27
- SpaceResources: h,
28
+ SpaceResources: g,
28
29
  SpaceDeployments: u,
29
30
  SpaceCdns: i,
30
31
  SpaceActions: r,
@@ -33,11 +34,12 @@ var y = {
33
34
  SpaceActionTasks: n,
34
35
  SpaceData: l,
35
36
  SpaceFunctions: d,
37
+ SpaceJobs: p,
36
38
  SpaceConnectors: s,
37
39
  SpaceCredentials: c,
38
- SpaceVersionContents: _,
39
- SpaceVisitors: v,
40
- SpaceRuntime: g
40
+ SpaceVersionContents: v,
41
+ SpaceVisitors: y,
42
+ SpaceRuntime: _
41
43
  };
42
44
  //#endregion
43
- export { y as default };
45
+ export { b as default };
@@ -1,6 +1,6 @@
1
1
  export { createRealtimeClient, realtimeClientFor } from './client';
2
2
  export { trackPresence } from './presence';
3
- export { JOIN_TYPE, LEAVE_TYPE, OBSERVER_COOKIE_NAME, PRESENCE_TYPE, REVOKED_TYPE, channelLimits, channelProblems, isValidTopic, matchChannel } from './topics';
3
+ export { JOIN_TYPE, LEAVE_TYPE, JOB_TYPE, OBSERVER_COOKIE_NAME, PRESENCE_TYPE, REVOKED_TYPE, channelLimits, channelProblems, isValidTopic, jobOfTopic, jobTopic, matchChannel } from './topics';
4
4
  export type { RealtimeClient, RealtimeClientOptions, RealtimeStatus } from './client';
5
5
  export type { PresenceListeners, PresenceTracker, RealtimeMember } from './presence';
6
6
  export type { ChannelMatch } from './topics';
@@ -1,4 +1,4 @@
1
- import { JOIN_TYPE as e, LEAVE_TYPE as t, OBSERVER_COOKIE_NAME as n, PRESENCE_TYPE as r, REVOKED_TYPE as i, channelLimits as a, channelProblems as o, isValidTopic as s, matchChannel as c } from "./topics.mjs";
2
- import { createRealtimeClient as l, realtimeClientFor as u } from "./client.mjs";
3
- import { trackPresence as d } from "./presence.mjs";
4
- export { e as JOIN_TYPE, t as LEAVE_TYPE, n as OBSERVER_COOKIE_NAME, r as PRESENCE_TYPE, i as REVOKED_TYPE, a as channelLimits, o as channelProblems, l as createRealtimeClient, s as isValidTopic, c as matchChannel, u as realtimeClientFor, d as trackPresence };
1
+ import { JOB_TYPE as e, JOIN_TYPE as t, LEAVE_TYPE as n, OBSERVER_COOKIE_NAME as r, PRESENCE_TYPE as i, REVOKED_TYPE as a, channelLimits as o, channelProblems as s, isValidTopic as c, jobOfTopic as l, jobTopic as u, matchChannel as d } from "./topics.mjs";
2
+ import { createRealtimeClient as f, realtimeClientFor as p } from "./client.mjs";
3
+ import { trackPresence as m } from "./presence.mjs";
4
+ export { e as JOB_TYPE, t as JOIN_TYPE, n as LEAVE_TYPE, r as OBSERVER_COOKIE_NAME, i as PRESENCE_TYPE, a as REVOKED_TYPE, o as channelLimits, s as channelProblems, f as createRealtimeClient, c as isValidTopic, l as jobOfTopic, u as jobTopic, d as matchChannel, p as realtimeClientFor, m as trackPresence };
@@ -1,5 +1,10 @@
1
1
  import { ChannelDeclaration, ChannelDeclarations } from '../types/RealtimeTypes';
2
2
  export declare const isValidTopic: (topic: string) => boolean;
3
+ export declare const jobTopic: (jobId: string) => string;
4
+ /** The job a topic is about, or `undefined` when it is not a job's. */
5
+ export declare const jobOfTopic: (topic: string) => string | undefined;
6
+ /** The type every message on a job's topic carries: the job as it is now (`FunctionJobView`). */
7
+ export declare const JOB_TYPE = "job";
3
8
  export type ChannelMatch = {
4
9
  pattern: string;
5
10
  declaration: ChannelDeclaration;
@@ -1,26 +1,26 @@
1
1
  import { isRecord as e } from "../helpers/isRecord.mjs";
2
2
  //#region src/realtime/topics.ts
3
- var t = /^[A-Za-z0-9:_.-]{1,128}$/, n = "[A-Za-z0-9_.-]{1,64}", r = (e) => t.test(e), i = (e) => RegExp(`^${e.split(/(\{[A-Za-z0-9_]+\})/).map((e) => /^\{[A-Za-z0-9_]+\}$/.test(e) ? n : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("")}$`), a = (e, t) => {
3
+ var t = /^[A-Za-z0-9:_.-]{1,128}$/, n = "[A-Za-z0-9_.-]{1,64}", r = (e) => t.test(e), i = /^\$job:([A-Za-z0-9:_.-]{1,128})$/, a = (e) => `$job:${e}`, o = (e) => i.exec(e)?.[1], s = "job", c = (e) => RegExp(`^${e.split(/(\{[A-Za-z0-9_]+\})/).map((e) => /^\{[A-Za-z0-9_]+\}$/.test(e) ? n : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("")}$`), l = (e, t) => {
4
4
  if (!t || !r(e)) return;
5
- let n = Object.keys(t).find((t) => i(t).test(e));
5
+ let n = Object.keys(t).find((t) => c(t).test(e));
6
6
  return n === void 0 ? void 0 : {
7
7
  pattern: n,
8
8
  declaration: t[n]
9
9
  };
10
- }, o = /^(?=.)[A-Za-z0-9:_.-]*(\{[A-Za-z0-9_]+\}[A-Za-z0-9:_.-]*)*$/, s = /* @__PURE__ */ new Set([
10
+ }, u = /^(?=.)[A-Za-z0-9:_.-]*(\{[A-Za-z0-9_]+\}[A-Za-z0-9:_.-]*)*$/, d = /* @__PURE__ */ new Set([
11
11
  "public",
12
12
  "session",
13
13
  "role"
14
- ]), c = (t, n) => {
14
+ ]), f = (t, n) => {
15
15
  let r = [];
16
- if (o.test(t) || r.push("a pattern is letters, digits and `:_.-`, with `{name}` for the part a page fills in — `board:{id}`"), !e(n)) return [...r, "a channel is an object: `{ access: { mode: \"public\" } }`"];
17
- let { access: i, publish: a, presence: c, grant: l, retain: u, maxMessageBytes: d, messagesPerSecond: f } = n, p = e(i) ? i.mode : void 0;
18
- typeof p != "string" || !s.has(p) ? r.push("`access` is { mode: \"public\" }, { mode: \"session\" } or { mode: \"role\", permissions: […] }") : p === "role" && !(e(i) && Array.isArray(i.permissions) && i.permissions.every((e) => typeof e == "string")) && r.push("`access: { mode: \"role\" }` names the permissions it needs: `permissions: [\"boardEdit\"]`"), a !== void 0 && a !== "clients" && a !== "server" && r.push("`publish` is \"clients\" (pages send) or \"server\" (only a flow's realtime.publish)"), c !== void 0 && typeof c != "boolean" && r.push("`presence` is true or false"), l !== void 0 && typeof l != "boolean" && r.push("`grant` is true (a page needs a grant from `realtime.grant` to open a topic) or false"), u !== void 0 && typeof u != "boolean" ? r.push("`retain` is true (the server keeps the latest message of each type for pages that join) or false") : u === !0 && a !== "server" && r.push("`retain: true` keeps what the server says, so only the server may speak: add `publish: \"server\"` — a page changes it through an action");
19
- for (let [e, t] of [["maxMessageBytes", d], ["messagesPerSecond", f]]) t !== void 0 && (typeof t != "number" || !Number.isInteger(t) || t <= 0) && r.push(`\`${e}\` is a whole number above zero`);
16
+ if (u.test(t) || r.push("a pattern is letters, digits and `:_.-`, with `{name}` for the part a page fills in — `board:{id}`"), !e(n)) return [...r, "a channel is an object: `{ access: { mode: \"public\" } }`"];
17
+ let { access: i, publish: a, presence: o, grant: s, retain: c, maxMessageBytes: l, messagesPerSecond: f } = n, p = e(i) ? i.mode : void 0;
18
+ typeof p != "string" || !d.has(p) ? r.push("`access` is { mode: \"public\" }, { mode: \"session\" } or { mode: \"role\", permissions: […] }") : p === "role" && !(e(i) && Array.isArray(i.permissions) && i.permissions.every((e) => typeof e == "string")) && r.push("`access: { mode: \"role\" }` names the permissions it needs: `permissions: [\"boardEdit\"]`"), a !== void 0 && a !== "clients" && a !== "server" && r.push("`publish` is \"clients\" (pages send) or \"server\" (only a flow's realtime.publish)"), o !== void 0 && typeof o != "boolean" && r.push("`presence` is true or false"), s !== void 0 && typeof s != "boolean" && r.push("`grant` is true (a page needs a grant from `realtime.grant` to open a topic) or false"), c !== void 0 && typeof c != "boolean" ? r.push("`retain` is true (the server keeps the latest message of each type for pages that join) or false") : c === !0 && a !== "server" && r.push("`retain: true` keeps what the server says, so only the server may speak: add `publish: \"server\"` — a page changes it through an action");
19
+ for (let [e, t] of [["maxMessageBytes", l], ["messagesPerSecond", f]]) t !== void 0 && (typeof t != "number" || !Number.isInteger(t) || t <= 0) && r.push(`\`${e}\` is a whole number above zero`);
20
20
  return r;
21
- }, l = (e) => ({
21
+ }, p = (e) => ({
22
22
  maxMessageBytes: e.maxMessageBytes ?? 4096,
23
23
  messagesPerSecond: e.messagesPerSecond ?? 30
24
- }), u = "$presence", d = "$leave", f = "$join", p = "$revoked", m = "plitzi-observer";
24
+ }), m = "$presence", h = "$leave", g = "$join", _ = "$revoked", v = "plitzi-observer";
25
25
  //#endregion
26
- export { f as JOIN_TYPE, d as LEAVE_TYPE, m as OBSERVER_COOKIE_NAME, u as PRESENCE_TYPE, p as REVOKED_TYPE, l as channelLimits, c as channelProblems, r as isValidTopic, a as matchChannel };
26
+ export { s as JOB_TYPE, g as JOIN_TYPE, h as LEAVE_TYPE, v as OBSERVER_COOKIE_NAME, m as PRESENCE_TYPE, _ as REVOKED_TYPE, p as channelLimits, f as channelProblems, r as isValidTopic, o as jobOfTopic, a as jobTopic, l as matchChannel };
@@ -8,3 +8,4 @@ export * from './motionReveal';
8
8
  export * from './wire';
9
9
  export * from './pageElements';
10
10
  export * from './markdownHeadings';
11
+ export * from './pageAccess';
@@ -1,11 +1,12 @@
1
- import { elementFromWire as e, schemaFromWire as t, schemaToWire as n } from "./wire.mjs";
2
- import { ANCHOR_PATTERN as r, anchorOf as i, isAnchor as a, uniqueAnchor as o } from "./anchor.mjs";
3
- import { COMPONENT_PROPS_SOURCE as s, EMPTY_SCHEMA as c, VARIABLE_REGEX as l } from "./schemaConstants.mjs";
4
- import { findLayoutCycle as u, resolveLayoutChain as d } from "./layoutChain.mjs";
5
- import { collectServerElements as f, hasServerElements as p, notFoundProvider as m, pageNotFound as h, pageSeoText as g, pageServerContext as _ } from "./serverElements.mjs";
6
- import { isSnippet as v } from "./snippet.mjs";
7
- import { MOTION_DEFAULT_DURATION as y, MOTION_ENTERS as b, MOTION_ENTER_EASING as x, MOTION_ENTER_FRAMES as S, MOTION_ENTER_FROM as C, MOTION_LOOPS as w, MOTION_LOOP_FRAMES as T, MOTION_MAX_MS as E, MOTION_PLAY_CSS as D, MOTION_SEEN_ATTRIBUTE as O, MOTION_SEEN_CSS as k, MOTION_STILL_CSS as A, MOTION_TRIGGERS as j, MOTION_VIEW_SELECTOR as M, MOVING_SELECTOR as N, isMotion as P, isMotionAnimation as F, motionAttributes as I, motionProblems as L } from "./motion.mjs";
8
- import { revealOnView as R } from "./motionReveal.mjs";
9
- import { pageElementTypes as z } from "./pageElements.mjs";
10
- import { headingText as B, markdownHeadings as V } from "./markdownHeadings.mjs";
11
- export { r as ANCHOR_PATTERN, s as COMPONENT_PROPS_SOURCE, c as EMPTY_SCHEMA, y as MOTION_DEFAULT_DURATION, b as MOTION_ENTERS, x as MOTION_ENTER_EASING, S as MOTION_ENTER_FRAMES, C as MOTION_ENTER_FROM, w as MOTION_LOOPS, T as MOTION_LOOP_FRAMES, E as MOTION_MAX_MS, D as MOTION_PLAY_CSS, O as MOTION_SEEN_ATTRIBUTE, k as MOTION_SEEN_CSS, A as MOTION_STILL_CSS, j as MOTION_TRIGGERS, M as MOTION_VIEW_SELECTOR, N as MOVING_SELECTOR, l as VARIABLE_REGEX, i as anchorOf, f as collectServerElements, e as elementFromWire, u as findLayoutCycle, p as hasServerElements, B as headingText, a as isAnchor, P as isMotion, F as isMotionAnimation, v as isSnippet, V as markdownHeadings, I as motionAttributes, L as motionProblems, m as notFoundProvider, z as pageElementTypes, h as pageNotFound, g as pageSeoText, _ as pageServerContext, d as resolveLayoutChain, R as revealOnView, t as schemaFromWire, n as schemaToWire, o as uniqueAnchor };
1
+ import { WITHHELD_ATTRIBUTE as e, mayReceive as t, pageAccessOf as n, pageAccessRefusal as r, pageWithheldOf as i, withholdPages as a } from "./pageAccess.mjs";
2
+ import { elementFromWire as o, schemaFromWire as s, schemaToWire as c } from "./wire.mjs";
3
+ import { ANCHOR_PATTERN as l, anchorOf as u, isAnchor as d, uniqueAnchor as f } from "./anchor.mjs";
4
+ import { COMPONENT_PROPS_SOURCE as p, EMPTY_SCHEMA as m, VARIABLE_REGEX as h } from "./schemaConstants.mjs";
5
+ import { findLayoutCycle as g, resolveLayoutChain as _ } from "./layoutChain.mjs";
6
+ import { collectServerElements as v, hasServerElements as y, notFoundProvider as b, pageNotFound as x, pageSeoText as S, pageServerContext as C } from "./serverElements.mjs";
7
+ import { isSnippet as w } from "./snippet.mjs";
8
+ import { MOTION_DEFAULT_DURATION as T, MOTION_ENTERS as E, MOTION_ENTER_EASING as D, MOTION_ENTER_FRAMES as O, MOTION_ENTER_FROM as k, MOTION_LOOPS as A, MOTION_LOOP_FRAMES as j, MOTION_MAX_MS as M, MOTION_PLAY_CSS as N, MOTION_SEEN_ATTRIBUTE as P, MOTION_SEEN_CSS as F, MOTION_STILL_CSS as I, MOTION_TRIGGERS as L, MOTION_VIEW_SELECTOR as R, MOVING_SELECTOR as z, isMotion as B, isMotionAnimation as V, motionAttributes as H, motionProblems as U } from "./motion.mjs";
9
+ import { revealOnView as W } from "./motionReveal.mjs";
10
+ import { pageElementTypes as G } from "./pageElements.mjs";
11
+ import { headingText as K, markdownHeadings as q } from "./markdownHeadings.mjs";
12
+ export { l as ANCHOR_PATTERN, p as COMPONENT_PROPS_SOURCE, m as EMPTY_SCHEMA, T as MOTION_DEFAULT_DURATION, E as MOTION_ENTERS, D as MOTION_ENTER_EASING, O as MOTION_ENTER_FRAMES, k as MOTION_ENTER_FROM, A as MOTION_LOOPS, j as MOTION_LOOP_FRAMES, M as MOTION_MAX_MS, N as MOTION_PLAY_CSS, P as MOTION_SEEN_ATTRIBUTE, F as MOTION_SEEN_CSS, I as MOTION_STILL_CSS, L as MOTION_TRIGGERS, R as MOTION_VIEW_SELECTOR, z as MOVING_SELECTOR, h as VARIABLE_REGEX, e as WITHHELD_ATTRIBUTE, u as anchorOf, v as collectServerElements, o as elementFromWire, g as findLayoutCycle, y as hasServerElements, K as headingText, d as isAnchor, B as isMotion, V as isMotionAnimation, w as isSnippet, q as markdownHeadings, t as mayReceive, H as motionAttributes, U as motionProblems, b as notFoundProvider, n as pageAccessOf, r as pageAccessRefusal, G as pageElementTypes, x as pageNotFound, S as pageSeoText, C as pageServerContext, i as pageWithheldOf, _ as resolveLayoutChain, W as revealOnView, s as schemaFromWire, c as schemaToWire, f as uniqueAnchor, a as withholdPages };
@@ -0,0 +1,41 @@
1
+ import { AccessCaller } from '../actions/access';
2
+ import { Schema } from '../types';
3
+ /**
4
+ * Who may see a page, as the page declares it: the permissions a visitor must hold, all of them. A page that says none
5
+ * is anybody's — `accessLevel` still decides signed in or out — and one that says some is for a signed-in visitor who
6
+ * holds every one: for a platform space, the account's permissions; for any other, those of the visitor roles the space
7
+ * declares and gives them.
8
+ *
9
+ * It is the server that keeps a page to the people it is for. A page a visitor may not see is answered with its refusal
10
+ * and never its content: the content is taken out of the space the browser is sent (`withholdPages`), because a page
11
+ * merely hidden in the browser was still sent to it.
12
+ */
13
+ export type PageAccess = {
14
+ permissions: string[];
15
+ };
16
+ /** A page's access, when its attributes declare one — at least one permission, each a name — or nothing. */
17
+ export declare const pageAccessOf: (attributes: Record<string, unknown> | undefined) => PageAccess | undefined;
18
+ /** Why this visitor may not see a page that declares `access`, or nothing when they may — or when it declares none. */
19
+ export declare const pageAccessRefusal: (access: PageAccess | undefined, caller: AccessCaller) => "unauthenticated" | "forbidden" | undefined;
20
+ /** The attribute a withheld page carries in the space the browser is sent: why it was withheld. */
21
+ export declare const WITHHELD_ATTRIBUTE = "withheld";
22
+ export type PageWithheld = 'unauthenticated' | 'forbidden';
23
+ /** Why a page of the space this browser was sent has no content, or nothing when it has its own. */
24
+ export declare const pageWithheldOf: (attributes: Record<string, unknown> | undefined) => PageWithheld | undefined;
25
+ /** The space as one visitor may be sent it, and the accesses of the protected pages it still holds whole. */
26
+ export type WithheldSchema = {
27
+ schema: Schema;
28
+ withheld: string[];
29
+ kept: PageAccess[];
30
+ };
31
+ /**
32
+ * The space with every page this visitor may not see emptied: its elements gone from `flat`, its `items` empty, and
33
+ * `withheld` on it saying why — so the page still routes, and draws its refusal rather than its content. What the
34
+ * visitor may see is left exactly as it was, and a space with no protected page is answered as it came, untouched.
35
+ *
36
+ * `kept` names the accesses of the protected pages left whole, so whoever caches the result can tell which visitors it
37
+ * may be handed to.
38
+ */
39
+ export declare const withholdPages: (schema: Schema, caller: AccessCaller) => WithheldSchema;
40
+ /** Whether a visitor may be handed a space that holds these protected pages whole: they may see every one of them. */
41
+ export declare const mayReceive: (kept: readonly PageAccess[], caller: AccessCaller) => boolean;
@@ -0,0 +1,54 @@
1
+ import { accessRefusal as e } from "../actions/access.mjs";
2
+ //#region src/schema/pageAccess.ts
3
+ var t = (e) => {
4
+ let t = e?.access;
5
+ if (typeof t != "object" || !t || !("permissions" in t)) return;
6
+ let { permissions: n } = t;
7
+ if (!Array.isArray(n)) return;
8
+ let r = n.filter((e) => typeof e == "string" && e !== "");
9
+ return r.length > 0 ? { permissions: r } : void 0;
10
+ }, n = (t, n) => t ? e({
11
+ mode: "role",
12
+ permissions: t.permissions
13
+ }, n) : void 0, r = "withheld", i = (e) => {
14
+ let t = e?.[r];
15
+ return t === "unauthenticated" || t === "forbidden" ? t : void 0;
16
+ }, a = (e, i) => {
17
+ let a = /* @__PURE__ */ new Map(), o = [];
18
+ for (let r of e.pages) {
19
+ let s = t(e.flat[r]?.attributes);
20
+ if (!s) continue;
21
+ let c = n(s, i);
22
+ c ? a.set(r, c) : o.push(s);
23
+ }
24
+ if (a.size === 0) return {
25
+ schema: e,
26
+ withheld: [],
27
+ kept: o
28
+ };
29
+ let s = {};
30
+ for (let [t, n] of Object.entries(e.flat)) {
31
+ let e = a.get(t);
32
+ e ? s[t] = {
33
+ ...n,
34
+ attributes: {
35
+ ...n.attributes,
36
+ [r]: e
37
+ },
38
+ definition: {
39
+ ...n.definition,
40
+ items: []
41
+ }
42
+ } : t !== n.definition.rootId && a.has(n.definition.rootId) || (s[t] = n);
43
+ }
44
+ return {
45
+ schema: {
46
+ ...e,
47
+ flat: s
48
+ },
49
+ withheld: [...a.keys()],
50
+ kept: o
51
+ };
52
+ }, o = (e, t) => e.every((e) => n(e, t) === void 0);
53
+ //#endregion
54
+ export { r as WITHHELD_ATTRIBUTE, o as mayReceive, t as pageAccessOf, n as pageAccessRefusal, i as pageWithheldOf, a as withholdPages };