@plitzi/sdk-shared 0.38.19 → 0.38.21

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 (40) hide show
  1. package/CHANGELOG.md +170 -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/store/tracing/tracingCollector.d.ts +1 -1
  31. package/dist/types/ActionTypes.d.ts +0 -204
  32. package/dist/types/FunctionTypes.d.ts +66 -0
  33. package/dist/types/JobTypes.d.ts +327 -0
  34. package/dist/types/JobTypes.mjs +0 -0
  35. package/dist/types/ServerTypes.d.ts +13 -3
  36. package/dist/types/SpaceTypes.d.ts +5 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/package.json +1 -1
  39. package/vite.config.ts +9 -7
  40. package/dist/helpers/twigWrapper/bench.bench.d.ts +0 -1
@@ -1,9 +1,10 @@
1
- import { ActionEmailConfig, ActionEntry, ActionJobQueue, ActionLimits, ActionRejectReason, ActionRunSummary, ActionRejectRecord, ActionRunRecord, ActionRunReport, ActionRunStatus, ActionTaskDescriptor, ActionTriggerType } from './ActionTypes';
1
+ import { ActionEmailConfig, ActionEntry, ActionLimits, ActionRejectReason, ActionRunSummary, ActionRejectRecord, ActionRunRecord, ActionRunReport, ActionRunStatus, ActionTaskDescriptor, ActionTriggerType } from './ActionTypes';
2
2
  import { Environment, ServerAuth } from './CommonTypes';
3
3
  import { PluginDeclaration } from './ComponentTypes';
4
4
  import { ConnectorEntry } from './ConnectorTypes';
5
5
  import { DataDraft, DataSaveResult } from './DataTypes';
6
6
  import { FunctionsDraft, FunctionsSaveResult } from './FunctionTypes';
7
+ import { JobQueue } from './JobTypes';
7
8
  import { SSRRealtimeConfig } from './RealtimeTypes';
8
9
  import { Schema } from './SchemaTypes';
9
10
  import { AnalyticsConfig, OfflineDataRaw } from './SdkTypes';
@@ -290,6 +291,11 @@ export type SSRUser = {
290
291
  permissions: string[];
291
292
  roles: string[];
292
293
  };
294
+ /**
295
+ * Who a run is for, as the session named them — without the session: what a step, a function and a job see of the
296
+ * person, and what a job keeps of whoever started it, for every slice it runs after their session is gone.
297
+ */
298
+ export type RunUser = Pick<SSRUser, 'id' | 'username' | 'email' | 'verified' | 'permissions' | 'roles'>;
293
299
  export type SSRSpaceDeployment = {
294
300
  /** Who may put this space in an iframe, as CSP `frame-ancestors` sources (e.g. `'self'`, `https://acme.com`,
295
301
  * or `*`). Resolved per space by the consumer, because only it knows the domains that space declares — a
@@ -718,8 +724,8 @@ export type SSRActionConfig = {
718
724
  * replicas in different countries agree about what has run without agreeing about what time it is.
719
725
  */
720
726
  export type SSRActionJobsConfig = {
721
- /** Shaped as `ActionJobQueue`. Omitted → this process's memory. */
722
- queue?: ActionJobQueue;
727
+ /** Shaped as `JobQueue`. Omitted → this process's memory. */
728
+ queue?: JobQueue;
723
729
  /** Jobs this replica runs at once. Default 4; `0` produces without consuming. */
724
730
  workers?: number;
725
731
  /** Whether this replica sweeps due schedules into the queue. Default true. */
@@ -1052,6 +1058,10 @@ export type SSRServerConfig = {
1052
1058
  plugins?: Record<string, unknown>;
1053
1059
  runner?: unknown;
1054
1060
  limits?: Record<string, number>;
1061
+ /** What the spaces' jobs may spend, per space (its plan): see `FunctionJobLimits` in `@plitzi/sdk-server/functions`. */
1062
+ jobs?: {
1063
+ limitsFor?: (spaceId: number) => Promise<Record<string, unknown> | undefined>;
1064
+ };
1055
1065
  };
1056
1066
  /** Realtime channels the spaces declare — see {@link SSRRealtimeConfig}. On, in memory, when absent. */
1057
1067
  realtime?: SSRRealtimeConfig;
@@ -104,6 +104,11 @@ export type SpaceDeployment = {
104
104
  domain: string;
105
105
  isVerified: boolean;
106
106
  default: boolean;
107
+ /**
108
+ * What serves it: `ssr` a page server — Plitzi's own when there is no `credential`, the space's when there is — or a
109
+ * static bucket (`s3`, `r2`).
110
+ */
111
+ provider: 'ssr' | 's3' | 'r2';
107
112
  credential: SpaceCredential | null;
108
113
  createdAt: number;
109
114
  updatedAt: number;
@@ -13,6 +13,7 @@ export * from './ConnectorTypes';
13
13
  export * from './ActionTypes';
14
14
  export * from './DataTypes';
15
15
  export * from './FunctionTypes';
16
+ export * from './JobTypes';
16
17
  export * from './RealtimeTypes';
17
18
  export * from './ComponentTypes';
18
19
  export * from './StateTypes';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-shared",
3
- "version": "0.38.19",
3
+ "version": "0.38.21",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist",
package/vite.config.ts CHANGED
@@ -55,11 +55,7 @@ type Options = {
55
55
  const SOURCE_MODULE = /\.(ts|tsx|js|mjs)$/;
56
56
  /** Matched against the path under `src`, so a whole test-only folder is excluded, not just suffixed file names. */
57
57
  const NOT_A_MODULE = new RegExp(
58
- [
59
- '(^|/)(__tests__|__mocks__|testUtils)(/|$)',
60
- '\\.(test|spec|stories[^.]*|bench)\\.(ts|tsx|js|mjs)$',
61
- '\\.d\\.ts$'
62
- ].join('|')
58
+ ['(^|/)(tests|__mocks__)(/|$)', '\\.(test|spec|stories[^.]*|bench)\\.(ts|tsx|js|mjs)$', '\\.d\\.ts$'].join('|')
63
59
  );
64
60
 
65
61
  export function getEntries(options: Options = {}) {
@@ -98,7 +94,13 @@ export default defineConfig(({ mode, command }) => {
98
94
  react(),
99
95
  dts({
100
96
  entryRoot: 'src',
101
- exclude: ['**/*.test.(ts|tsx)', '**/*.stories.(ts|tsx)', 'vite.config.ts', 'setupTests.ts'],
97
+ exclude: [
98
+ '**/*.(test|bench).(ts|tsx)',
99
+ '**/tests/**',
100
+ '**/*.stories.(ts|tsx)',
101
+ 'vite.config.ts',
102
+ 'setupTests.ts'
103
+ ],
102
104
  tsconfigPath: './tsconfig.app.json',
103
105
  // The declarations are written against the other packages' declarations, as a consumer reads them: through
104
106
  // their sources they would be compiled under this package's settings and their paths written into its types.
@@ -210,7 +212,7 @@ export default defineConfig(({ mode, command }) => {
210
212
  reporter: ['text', 'html'],
211
213
  reportsDirectory: 'tests',
212
214
  include: ['src'],
213
- exclude: ['**/*.test.tsx', '**/*.stories.ts', '**/*.stories.tsx'] // , 'src/index.ts'
215
+ exclude: ['**/*.test.tsx', '**/tests/**', '**/*.stories.ts', '**/*.stories.tsx'] // , 'src/index.ts'
214
216
  },
215
217
  server: {
216
218
  deps: {
@@ -1 +0,0 @@
1
- export {};