@salsita-ai/sdk 0.50.0-develop.91d65bd507 → 0.50.0-develop.9239ced550
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/README.md +1 -1
- package/dist/application/index.d.ts +1 -0
- package/dist/application/index.js +1 -1
- package/dist/application/mount-application.d.ts +1 -1
- package/dist/application/mount-application.js +1 -1
- package/dist/application/mount-configurator.d.ts +19 -0
- package/dist/application/mount-configurator.js +1 -0
- package/dist/application/mounted-application-runtime.d.ts +4 -0
- package/dist/application/mounted-application-runtime.js +1 -0
- package/dist/application/register-web-component.d.ts +2 -0
- package/dist/application/register-web-component.js +1 -0
- package/dist/application-spec/core/enhanced-json-value.d.ts +2 -31
- package/dist/application-spec/core/enhanced-json-value.js +1 -1
- package/dist/application-spec/core/index.d.ts +1 -3
- package/dist/application-spec/core/index.js +1 -1
- package/dist/application-spec/core/markers/index.d.ts +1 -1
- package/dist/application-spec/core/markers/index.js +1 -1
- package/dist/application-spec/core/markers/msg-marker.d.ts +2 -28
- package/dist/application-spec/core/markers/msg-marker.js +1 -1
- package/dist/application-spec/core/markers/raw-eval-write-marker.d.ts +1 -1
- package/dist/application-spec/core/markers/raw-eval-write-marker.js +1 -1
- package/dist/application-spec/core/markers/raw-read-write-marker.js +1 -1
- package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
- package/dist/application-spec/generate-application/code/templates/index.d.ts +2 -6
- package/dist/application-spec/generate-application/code/templates/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill-bundle.d.ts +10 -0
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill-bundle.js +7 -0
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -1
- package/dist/application-spec/generate-application/implementations/phx-application-types.d.ts +25 -0
- package/dist/application-spec/generate-application/implementations/phx-application-types.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx-domain.d.ts +36 -0
- package/dist/application-spec/generate-application/implementations/phx-domain.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx-model.d.ts +24 -0
- package/dist/application-spec/generate-application/implementations/phx-model.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx.d.ts +22 -0
- package/dist/application-spec/generate-application/implementations/phx.js +1 -0
- package/dist/application-spec/generate-application/index.d.ts +2 -0
- package/dist/application-spec/generate-application/index.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +3 -3
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +4 -2
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.d.ts +16 -0
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +5 -0
- package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/application-spec-slice.d.ts +71 -0
- package/dist/application-spec/generate-application/runtime/application-spec-slice.js +1 -0
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +3 -3
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +4 -2
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.d.ts +16 -0
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime/create-application.d.ts +57 -0
- package/dist/application-spec/generate-application/runtime/create-application.js +1 -0
- package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.js +1 -1
- package/dist/application-spec/generate-application/runtime/factory-data/static-violations.d.ts +1 -1
- package/dist/application-spec/generate-application/runtime/factory-data/static-violations.js +1 -1
- package/dist/application-spec/generate-application/runtime/generate-runtime-instance.d.ts +1 -1
- package/dist/application-spec/generate-application/runtime/generate-runtime-instance.js +1 -1
- package/dist/application-spec/generate-application/runtime/index.d.ts +8 -0
- package/dist/application-spec/generate-application/runtime/index.js +1 -0
- package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +1 -1
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.d.ts +1 -1
- package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/spec-code/resolve-spec-code.d.ts +1 -1
- package/dist/application-spec/generate-application/runtime/spec-runtime.d.ts +21 -0
- package/dist/application-spec/generate-application/runtime/spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.d.ts +3 -2
- package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +44 -9
- package/dist/application-spec/generate-application/runtime-spec/runtime-spec.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-expressions.d.ts +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-expressions.js +1 -1
- package/dist/client/authorized-client.d.ts +3 -1
- package/dist/client/authorized-client.js +1 -1
- package/dist/client/contract.d.ts +17 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/local-authorized-client.d.ts +3 -1
- package/dist/client/local-authorized-client.js +1 -1
- package/dist/client/memory-authorized-client.d.ts +4 -1
- package/dist/client/memory-authorized-client.js +1 -1
- package/dist/client/phoenix-api.d.ts +228 -0
- package/dist/configurator/ConfiguratorApp.js +1 -1
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +13 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +2 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +15 -9
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.d.ts +1 -1
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.d.ts +12 -4
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.d.ts +8 -0
- package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.js +1 -0
- package/dist/docs/index.json +1 -1
- package/dist/docs/layouts/gallery/nightjar-guitar.mdx +31 -16
- package/dist/docs/layouts/gallery/tidepool-aquascape.mdx +205 -33
- package/dist/docs/phoenix/domain-model.mdx +4 -1
- package/dist/docs/phoenix/phoenix-cli.mdx +14 -6
- package/dist/docs/phoenix/project-structure.mdx +21 -17
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +6 -4
- package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
- package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
- package/dist/domain/application/configurator-builder.d.ts +7 -1
- package/dist/domain/application/configurator-builder.js +1 -1
- package/dist/domain/application/index.d.ts +1 -1
- package/dist/domain/application/index.js +1 -1
- package/dist/domain/application/standard-properties.js +1 -1
- package/dist/domain/domain-runtime/application.d.ts +39 -0
- package/dist/domain/domain-runtime/application.js +1 -0
- package/dist/domain/domain-runtime/domain-runtime.d.ts +36 -4
- package/dist/domain/domain-runtime/domain-runtime.js +1 -1
- package/dist/domain/domain-runtime/environment/initialize.d.ts +1 -1
- package/dist/domain/domain-runtime/index.d.ts +1 -0
- package/dist/domain/domain-runtime/index.js +1 -1
- package/dist/domain/domain-runtime/web-component/actions.d.ts +3 -0
- package/dist/domain/domain-runtime/web-component/actions.js +1 -1
- package/dist/domain/domain-runtime/web-component/initialize.d.ts +1 -0
- package/dist/domain/domain-runtime/web-component/initialize.js +1 -1
- package/dist/domain/domain-runtime/web-component/selectors.d.ts +2 -0
- package/dist/domain/domain-runtime/web-component/selectors.js +1 -1
- package/dist/domain/domain-runtime/web-component/types.d.ts +6 -3
- package/dist/domain/index.d.ts +1 -0
- package/dist/domain/index.js +1 -1
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +5 -0
- package/dist/domain/spec/application/index.d.ts +1 -0
- package/dist/domain/spec/application/index.js +1 -0
- package/dist/{application-spec/core → domain/spec}/components/component-filter.d.ts +3 -2
- package/dist/domain/spec/enhanced-json-value.d.ts +30 -0
- package/dist/domain/spec/enhanced-json-value.js +1 -0
- package/dist/domain/spec/index.d.ts +5 -0
- package/dist/domain/spec/index.js +1 -0
- package/dist/domain/spec/markers/index.d.ts +2 -0
- package/dist/domain/spec/markers/index.js +1 -0
- package/dist/domain/spec/markers/msg-marker.d.ts +28 -0
- package/dist/domain/spec/markers/msg-marker.js +1 -0
- package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
- package/dist/editor/domain-editors/apply-spec-update.d.ts +2 -1
- package/dist/editor/domain-editors/apply-spec-update.js +1 -1
- package/dist/editor/domain-editors/use-implementation-files.d.ts +0 -3
- package/dist/editor/domain-editors/use-implementation-files.js +1 -1
- package/dist/phoenix/application-spec/generate-application-spec-project.js +2 -2
- package/dist/phoenix/application-spec/resolve-deployment-data.d.ts +11 -0
- package/dist/phoenix/application-spec/resolve-deployment-data.js +2 -2
- package/dist/phoenix/bin.js +1 -1
- package/dist/phoenix/cli.js +1 -1
- package/dist/phoenix/commands/deploy.js +1 -1
- package/dist/phoenix/commands/dev.js +5 -5
- package/dist/phoenix/commands/generated-env-markers.d.ts +1 -0
- package/dist/phoenix/commands/generated-env-markers.js +1 -1
- package/dist/phoenix/commands/index.d.ts +1 -1
- package/dist/phoenix/commands/index.js +1 -1
- package/dist/phoenix/lingui/index.d.ts +1 -0
- package/dist/phoenix/lingui/index.js +1 -0
- package/dist/phoenix/{services → lingui}/lingui.d.ts +5 -2
- package/dist/phoenix/lingui/lingui.js +1 -0
- package/dist/phoenix/services/application-spec-project-watcher.d.ts +3 -1
- package/dist/phoenix/services/application-spec-project-watcher.js +2 -2
- package/dist/phoenix/services/index.d.ts +1 -0
- package/dist/phoenix/services/index.js +1 -1
- package/dist/phoenix/services/lingui-watcher.js +1 -1
- package/dist/phoenix/services/prepare-development-environment.js +1 -1
- package/dist/phoenix/services/vite-config.js +1 -1
- package/dist/react-sdk/application-runtime/common-services/analytics/analytics-service.d.ts +1 -1
- package/dist/react-sdk/application-runtime/common-services/initialize.d.ts +2 -2
- package/dist/react-sdk/application-runtime/hooks/use-access-service.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.d.ts +4 -11
- package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-web-component.d.ts +5 -0
- package/dist/react-sdk/application-runtime/hooks/use-web-component.js +1 -1
- package/dist/react-sdk/application-runtime/host-properties/actions.d.ts +15 -0
- package/dist/react-sdk/application-runtime/host-properties/actions.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.d.ts +30 -0
- package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.d.ts +7 -0
- package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.d.ts +21 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.d.ts +42 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/index.d.ts +8 -0
- package/dist/react-sdk/application-runtime/host-properties/index.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/initialize.d.ts +7 -0
- package/dist/react-sdk/application-runtime/host-properties/initialize.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/selectors.d.ts +54 -0
- package/dist/react-sdk/application-runtime/host-properties/selectors.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/types.d.ts +18 -0
- package/dist/react-sdk/application-runtime/host-properties/types.js +1 -0
- package/dist/react-sdk/application-runtime/index.d.ts +1 -0
- package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +151 -9
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
- package/package.json +3 -3
- package/dist/phoenix/services/lingui.js +0 -1
- /package/dist/{application-spec/core → domain/spec/application}/application-instance.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec/application}/application-instance.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/components/component-filter.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/components/index.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/components/index.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/components/sdk-code-ref.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/components/sdk-code-ref.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/index.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/index.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/relation-expression-params.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/relation-expression-params.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/sdk-expression-implementation.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/sdk-expression-implementation.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/markers/eval-marker.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/markers/eval-marker.js +0 -0
|
@@ -23,6 +23,11 @@ export type ApplicationRuntimeResult = {
|
|
|
23
23
|
} | {
|
|
24
24
|
readonly ok: false;
|
|
25
25
|
readonly missingExpressions: readonly MissingExpression[];
|
|
26
|
+
/**
|
|
27
|
+
* The migrations of both domains the migration modules do not export, which a built
|
|
28
|
+
* runtime lists in `migrationRuntime.missingMigrations` of each domain.
|
|
29
|
+
*/
|
|
30
|
+
readonly missingMigrations: readonly string[];
|
|
26
31
|
};
|
|
27
32
|
/**
|
|
28
33
|
* Builds an ApplicationRuntime from a RuntimeSpec: the part of the parsed spec the runtime reads, which a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Branded as i}from"@salsita-ai/common/utils";import{createImplementationErrorCollector as
|
|
1
|
+
import{Branded as i}from"@salsita-ai/common/utils";import{createImplementationErrorCollector as n}from"#package/domain";import{AdminRuntime as o}from"./admin-runtime/admin-runtime.js";import{ConfiguratorRuntime as r}from"./configurator-runtime/configurator-runtime.js";import{DataRuntime as m}from"./sections/data-runtime.js";export const ApplicationRuntime=(t,s,a,e,g,u=[],p={},f={},c,k)=>{let d=k??n(),M=r(t,s,a,e,g,f,c?.configurator,d),l=o(t,s,u,p,f,c?.admin,d);return(void 0===k&&d.throwIfAny(),M.ok&&l.ok)?{ok:!0,runtime:i({configurator:M.runtime,admin:l.runtime,data:m(t,s)})}:{ok:!1,missingExpressions:[...M.ok?[]:M.missingExpressions,...l.ok?[]:l.missingExpressions],missingMigrations:[...M.ok?M.runtime.migrationRuntime.missingMigrations:M.missingMigrations,...l.ok?l.runtime.migrationRuntime.missingMigrations:l.missingMigrations]}};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type AnyActionImplementations, type AnyDomainComponentOptic, type ApplicationConfiguratorSpec, type ElementRegistration, type HandlerRegistration, type ApplicationSpec as RuntimeApplicationSpec } from '#package/domain';
|
|
2
|
+
import type { RuntimeSpec } from '../runtime-spec/index.js';
|
|
3
|
+
import type { ApplicationRuntime } from './application-runtime.js';
|
|
4
|
+
type Theme = ApplicationConfiguratorSpec['theme'];
|
|
5
|
+
/**
|
|
6
|
+
* The theme presets of the SDK by name, as `getPhoenixThemes()` returns them. The caller passes
|
|
7
|
+
* them, because `application-spec` does not depend on the UI package that defines them.
|
|
8
|
+
*/
|
|
9
|
+
export type ThemePresets = Readonly<Record<string, Theme>>;
|
|
10
|
+
/**
|
|
11
|
+
* The project modules of an application's spec slice, checked and flattened: `handlers` and
|
|
12
|
+
* `elements` with the content hash of each registration (the remount key of a registration whose
|
|
13
|
+
* file changed), the component optics of `src/components/` and the action implementations of
|
|
14
|
+
* `src/actions/`.
|
|
15
|
+
*
|
|
16
|
+
* A `null` keeps the previous spec's value: the editor passes it for a kind of file that did not
|
|
17
|
+
* change since the last update.
|
|
18
|
+
*/
|
|
19
|
+
export interface ApplicationSpecSliceModules {
|
|
20
|
+
readonly handlers: {
|
|
21
|
+
readonly handlers: ReadonlyArray<HandlerRegistration<any, any>>;
|
|
22
|
+
readonly nameHashes?: Readonly<Record<string, string>>;
|
|
23
|
+
} | null;
|
|
24
|
+
readonly elements: {
|
|
25
|
+
readonly elements: readonly ElementRegistration[];
|
|
26
|
+
readonly nameHashes?: Readonly<Record<string, string>>;
|
|
27
|
+
} | null;
|
|
28
|
+
readonly customComponentOptics: readonly AnyDomainComponentOptic[] | null;
|
|
29
|
+
readonly actionImplementations: AnyActionImplementations | null;
|
|
30
|
+
}
|
|
31
|
+
interface SliceInput {
|
|
32
|
+
readonly runtime: ApplicationRuntime;
|
|
33
|
+
readonly modules: ApplicationSpecSliceModules;
|
|
34
|
+
readonly themePresets: ThemePresets;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The first spec slice of an application: every section is built from `runtime`, `spec` and the
|
|
38
|
+
* modules. `initialPublishedData` is empty; the caller computes it with a domain runtime of this
|
|
39
|
+
* slice and puts it in.
|
|
40
|
+
*/
|
|
41
|
+
export interface ApplicationSpecStart extends SliceInput {
|
|
42
|
+
readonly previous?: undefined;
|
|
43
|
+
readonly spec: RuntimeSpec;
|
|
44
|
+
/** The component optics of `src/admin/components/`. */
|
|
45
|
+
readonly customAdminComponentOptics: readonly AnyDomainComponentOptic[];
|
|
46
|
+
/** The SDK's default elements of the application kind; a project element with the same name replaces one. */
|
|
47
|
+
readonly defaultElements: readonly ElementRegistration[];
|
|
48
|
+
/** The resources URL of the environment, used when the spec sets no `baseResourcesUrl`. */
|
|
49
|
+
readonly environmentResourcesUrl: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A rebuild of a running application's spec slice, as the editor makes it when the project
|
|
53
|
+
* changes. Only the configurator sections are rebuilt; a section whose runtime did not change, and
|
|
54
|
+
* a kind of module given as `null`, keeps its object from `previous`, so selectors over it stay
|
|
55
|
+
* memoized. With `model: 'keep'` the domain factory and the model-owned fields stay too (the
|
|
56
|
+
* schema of the model is unchanged); with `model: 'rebuild'` they are built from `runtime`.
|
|
57
|
+
*/
|
|
58
|
+
export interface ApplicationSpecUpdate extends SliceInput {
|
|
59
|
+
readonly previous: RuntimeApplicationSpec;
|
|
60
|
+
readonly model: 'keep' | 'rebuild';
|
|
61
|
+
}
|
|
62
|
+
/** The component optics a project file contributes, as opposed to those the spec generates. */
|
|
63
|
+
export declare const customComponentOpticsOf: (componentOptics: readonly AnyDomainComponentOptic[]) => AnyDomainComponentOptic[];
|
|
64
|
+
/**
|
|
65
|
+
* Maps an application's runtime (`ApplicationRuntime`, built with the project's modules) and its
|
|
66
|
+
* checked modules onto the spec slice of the domain runtime, the one input of every mounted
|
|
67
|
+
* application: an application's first slice, which `createApplication` builds with it, or the
|
|
68
|
+
* editor's rebuild after a change of the project.
|
|
69
|
+
*/
|
|
70
|
+
export declare const applicationSpecSlice: (input: ApplicationSpecStart | ApplicationSpecUpdate) => RuntimeApplicationSpec;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveImportedTransformers as e}from"#package/domain";export const customComponentOpticsOf=e=>e.filter(e=>!0!==e.generated);let t=(t,n)=>{let{runtime:s,modules:a,themePresets:i}=t,{configurator:o}=s,r=(e,t,s)=>e||void 0===n?t():s(n),l=a.handlers?.handlers??n?.handlers??[],m=a.handlers||void 0===n?((e,t,n)=>{let s={};for(let a of e)s[a.name]=t?.[a.name]??n?.[a.name]??a.name;return s})(l,a.handlers?.nameHashes,n?.handlerHashes):n.handlerHashes,c=a.elements?.elements??n?.elements??[],p=a.elements||void 0===n?((e,t,n)=>{let s={},a=0;for(let i of e)if("assistantFormElement"!==i.type)if("entity"===i.type||"layout"===i.type)s[i.name]=t?.[i.name]??n?.[i.name]??i.name;else{let e=`icon:${a}`;s[e]=t?.[e]??n?.[e]??`${e}:${i.elements.length}`,a+=1}return s})(c,a.elements?.nameHashes,n?.elementHashes):n.elementHashes,d=a.customComponentOptics??customComponentOpticsOf(n?.componentOptics??[]),u=r(o.componentOptics.changed||null!==a.customComponentOptics,()=>[...o.componentOptics.optics.map(e=>e.optic),...d],e=>e.componentOptics),{importedTransformers:h,specTransformers:g}=o.transformersRuntime;return{presets:r(o.presetRuntime.changed,()=>o.presetRuntime.presets,e=>e.presets),theme:r(o.themeRuntime.changed,()=>{var e;let t;return t=(Object.hasOwn(i,(e=o.themeRuntime).preset)?i[e.preset]:{})??{},Object.keys(e.options).length>0?{...t,...e.options}:t},e=>e.theme),assistant:r(o.assistantRuntime.changed,()=>o.assistantRuntime.assistant,e=>e.assistant),navigationStates:r(o.statesRuntime.changed,()=>o.statesRuntime.navigationStates,e=>e.navigationStates),viewStates:r(o.statesRuntime.changed,()=>o.statesRuntime.viewStates,e=>e.viewStates),toolStates:r(o.statesRuntime.changed,()=>o.statesRuntime.toolStates,e=>e.toolStates),exportStates:r(o.statesRuntime.changed,()=>o.statesRuntime.exportStates,e=>e.exportStates),componentOptics:u,createTransformers:r(o.transformersRuntime.changed,()=>t=>e(h,g,t),e=>e.createTransformers),handlers:l,handlerHashes:m,elements:c,elementHashes:p}},n=(e,t,n)=>{let{modelRuntime:s,expressionRuntime:a,actionsRuntime:i,migrationRuntime:o}=e.configurator,r=s.domainBuilder.withExpressions(a.merged).withActions(Object.values(i.definitions)).withActionImplementations(t),l=(n?r.withMigrate(o.migrate):r).build();return{modelVersion:l.context.modelVersion,factory:l,aliasMap:l.context.aliasMap,entityReflections:l.context.entityReflections,$entityReflections:l.context.$entityReflections,allowedRootEntityTypes:l.context.allowedRootEntityTypes,migrate:l.context.migrate}};export const applicationSpecSlice=e=>void 0===e.previous?(e=>{let{runtime:s,spec:a}=e,i=(e=>{let{runtime:s,modules:a,spec:i,defaultElements:o}=e,{expressionRuntime:r,actionsRuntime:l}=s.configurator,{ui:m}=i.configurator,c=i.infra.resourcesConfig,p=a.actionImplementations??{};return{...t(e,void 0),...n(s,p,!0),expressions:r.merged,actions:l.definitions,actionImplementations:p,defaultElements:o,appLoader:m.appLoader??"universal",preview:m.preview??"auto",alwaysExpand:m.alwaysExpand??!1,deploymentQueryDisabled:c?.deploymentQueryDisabled??!1,prefetchTextureUrls:c?.prefetchTextureUrls??[]}})(e),o=a.configurator.ui.textLanguages;return{version:a.appMetadata.applicationVersion,dataConfig:s.data.dataSpec,chunks:s.data.chunks,publishedDataHash:s.data.publishedDataHash,initialPublishedData:{},canCreate:[...a.infra.acl.canCreate],enableAdminRelease:a.appMetadata.enableAdminRelease,textLanguages:o&&o.length>0?o:["en"],baseResourcesUrl:a.infra.resourcesConfig?.baseResourcesUrl??e.environmentResourcesUrl??"",configurator:i,admin:((e,t)=>{let{modelRuntime:n,expressionRuntime:s,migrationRuntime:a,presetRuntime:i,componentOptics:o,statesRuntime:r}=e.runtime.admin,[l]=i.presets;if(void 0===l)throw Error("Cannot register application spec because admin preset is required.");let m=n.domainBuilder.withExpressions(s.merged).withMigrate(a.migrate).build();return{factory:m,modelVersion:m.modelVersion,aliasMap:m.context.aliasMap,entityReflections:m.context.entityReflections,$entityReflections:m.context.$entityReflections,expressions:m.context.expressions,actions:m.context.actions,actionImplementations:m.context.actionImplementations,allowedRootEntityTypes:m.context.allowedRootEntityTypes,migrate:m.context.migrate,preset:l,componentOptics:[...o.optics.map(e=>e.optic),...e.customAdminComponentOptics],navigationStates:r.navigationStates,viewStates:[],handlers:t.handlers,handlerHashes:t.handlerHashes,elements:t.elements,elementHashes:t.elementHashes}})(e,i)}})(e):{...e.previous,configurator:(e=>{let{runtime:s,modules:a,previous:i,model:o}=e,r=i.configurator,{expressionRuntime:l,actionsRuntime:m}=s.configurator,c=t(e,r),p=a.actionImplementations??r.actionImplementations;return"keep"===o?{...r,...c,expressions:l.changed?l.merged:r.expressions,actions:m.changed?m.definitions:r.actions,actionImplementations:p}:{...r,...c,...n(s,p,!1),expressions:l.merged,actions:m.definitions,actionImplementations:p}})(e)};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Branded } from '@salsita-ai/common/utils';
|
|
2
2
|
import { type $DomainEntity, $DomainEntityReflection, DomainBuilder, type DomainEntity, DomainEntityReflection, RawAliasReflection, SchemaReflection } from '#package/domain';
|
|
3
3
|
import type { RuntimeReferenceStore } from '../../../caching/index.js';
|
|
4
|
-
import type {
|
|
5
|
-
import type { RuntimeModelVersion, RuntimeResolvedVersions } from '../../runtime-spec/index.js';
|
|
4
|
+
import type { Expressions } from '../../../parse-application-files/index.js';
|
|
5
|
+
import type { RuntimeDataSchemas, RuntimeModelVersion, RuntimeResolvedVersions } from '../../runtime-spec/index.js';
|
|
6
6
|
import type { SpecCodeMap } from '../spec-code/index.js';
|
|
7
7
|
type AnyEntity = DomainEntity<string>;
|
|
8
8
|
type AnyAliases = Record<string, AnyEntity>;
|
|
@@ -10,7 +10,7 @@ type AnyData = Record<string, unknown>;
|
|
|
10
10
|
type Any$Map = Record<AnyEntity['type'], $DomainEntity<AnyEntity>>;
|
|
11
11
|
type AnyDomainBuilder = DomainBuilder<AnyEntity, AnyEntity, AnyAliases, Any$Map, AnyData, AnyData, AnyData>;
|
|
12
12
|
interface ConfiguratorModelRuntimeSpec {
|
|
13
|
-
readonly dataSchemas:
|
|
13
|
+
readonly dataSchemas: RuntimeDataSchemas;
|
|
14
14
|
readonly expressions: Expressions;
|
|
15
15
|
readonly latestModel: RuntimeModelVersion;
|
|
16
16
|
readonly resolvedVersions: RuntimeResolvedVersions;
|
|
@@ -2,7 +2,7 @@ import { Branded } from '@salsita-ai/common/utils';
|
|
|
2
2
|
import type { ImplementationErrorCollector, ImportedTransformer, ProjectModule } from '#package/domain';
|
|
3
3
|
import type { RuntimeReferenceStore } from '../../../caching/index.js';
|
|
4
4
|
import type { RuntimeSpec } from '../../runtime-spec/index.js';
|
|
5
|
-
import { FactoryDataRuntime } from '../factory-data/index.js';
|
|
5
|
+
import type { FactoryDataRuntime } from '../factory-data/index.js';
|
|
6
6
|
import { type MigrationModules, MigrationRuntime } from '../migrations/index.js';
|
|
7
7
|
import { ActionsRuntime } from '../sections/actions-runtime.js';
|
|
8
8
|
import { AssistantRuntime } from '../sections/assistant-runtime.js';
|
|
@@ -12,7 +12,7 @@ import { PresetRuntime } from '../sections/preset-runtime.js';
|
|
|
12
12
|
import { ThemeRuntime } from '../sections/theme-runtime.js';
|
|
13
13
|
import { TransformersRuntime } from '../sections/transformers-runtime.js';
|
|
14
14
|
import type { SpecCodeMap } from '../spec-code/index.js';
|
|
15
|
-
import { ConfiguratorModelRuntime } from './configurator-model-runtime.js';
|
|
15
|
+
import type { ConfiguratorModelRuntime } from './configurator-model-runtime.js';
|
|
16
16
|
import { ConfiguratorStatesRuntime } from './states-runtime.js';
|
|
17
17
|
export type ConfiguratorRuntime = Branded<'ConfiguratorRuntime', {
|
|
18
18
|
readonly modelRuntime: ConfiguratorModelRuntime;
|
|
@@ -33,5 +33,7 @@ export type ConfiguratorRuntimeResult = {
|
|
|
33
33
|
} | {
|
|
34
34
|
readonly ok: false;
|
|
35
35
|
readonly missingExpressions: readonly MissingExpression[];
|
|
36
|
+
/** The migrations the migration modules do not export, as `migrationRuntime.missingMigrations` lists them. */
|
|
37
|
+
readonly missingMigrations: readonly string[];
|
|
36
38
|
};
|
|
37
39
|
export declare const ConfiguratorRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore, expressionModules: readonly ProjectModule[], importedTransformers: readonly ImportedTransformer[], invariantImplementations: InvariantImplementations | undefined, migrationModules: MigrationModules, code: SpecCodeMap | undefined, errors: ImplementationErrorCollector) => ConfiguratorRuntimeResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Branded as t}from"@salsita-ai/common/utils";import{
|
|
1
|
+
import{Branded as t}from"@salsita-ai/common/utils";import{MigrationRuntime as e}from"../migrations/index.js";import{ActionsRuntime as i}from"../sections/actions-runtime.js";import{AssistantRuntime as o}from"../sections/assistant-runtime.js";import{ComponentOptics as s}from"../sections/component-optic.js";import{ExpressionRuntime as r}from"../sections/expression-runtime.js";import{PresetRuntime as n}from"../sections/preset-runtime.js";import{ThemeRuntime as m}from"../sections/theme-runtime.js";import{TransformersRuntime as c}from"../sections/transformers-runtime.js";import{ConfiguratorSpecRuntime as u}from"./configurator-spec-runtime.js";import{ConfiguratorStatesRuntime as p}from"./states-runtime.js";export const ConfiguratorRuntime=(a,f,g,R,j,l,x,d)=>{let{modelRuntime:k,factoryDataRuntime:E}=u(a,f,x),S=r(a.configurator,f,g,"configuratorExpressionRuntime",j,x,d),h=e(f,{referenceScope:"configuratorRuntime/migrationRuntime",resolvedVersions:a.configurator.resolvedVersions,latestEntities:k.entities,migrationModules:l});return S.ok?{ok:!0,runtime:t({modelRuntime:k,componentOptics:s(f,{components:a.configurator.components,referenceScope:"configuratorRuntime/componentOptics",modelRuntime:k,code:x}),presetRuntime:n(f,{referenceScope:"configuratorRuntime/presetRuntime",presets:a.configurator.presets.presets}),statesRuntime:p(a,f),expressionRuntime:S.runtime,themeRuntime:m(a,f),transformersRuntime:c(a,f,R),assistantRuntime:o(a,f),actionsRuntime:i(a.configurator.actions,f),migrationRuntime:h,factoryDataRuntime:E})}:{ok:!1,missingExpressions:S.missing,missingMigrations:h.missingMigrations}};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
+
import type { RuntimeReferenceStore } from '../../../caching/index.js';
|
|
3
|
+
import type { RuntimeSpec } from '../../runtime-spec/index.js';
|
|
4
|
+
import { FactoryDataRuntime } from '../factory-data/index.js';
|
|
5
|
+
import type { SpecCodeMap } from '../spec-code/index.js';
|
|
6
|
+
import { ConfiguratorModelRuntime } from './configurator-model-runtime.js';
|
|
7
|
+
/**
|
|
8
|
+
* The sections of the configurator domain that the spec alone determines: its model and the data
|
|
9
|
+
* of its `phx.domain` factories. `ConfiguratorRuntime` builds its own from this function, so a
|
|
10
|
+
* build of either in the same reference store returns the same objects.
|
|
11
|
+
*/
|
|
12
|
+
export type ConfiguratorSpecRuntime = Branded<'ConfiguratorSpecRuntime', {
|
|
13
|
+
readonly modelRuntime: ConfiguratorModelRuntime;
|
|
14
|
+
readonly factoryDataRuntime: FactoryDataRuntime;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const ConfiguratorSpecRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore, code: SpecCodeMap | undefined) => ConfiguratorSpecRuntime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Branded as t}from"@salsita-ai/common/utils";import{FactoryDataRuntime as r}from"../factory-data/index.js";import{ConfiguratorModelRuntime as a}from"./configurator-model-runtime.js";export const ConfiguratorSpecRuntime=(i,o,e)=>{let n=a(i.configurator,o,e);return t({modelRuntime:n,factoryDataRuntime:r(o,{referenceScope:"configuratorRuntime/factoryDataRuntime",invariants:i.configurator.invariants,defaults:i.configurator.defaults,aliases:n.aliases,entities:n.entities})})};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type Messages } from '@lingui/core';
|
|
2
|
+
import { type Application, type ElementRegistration, type ProjectModule } from '#package/domain';
|
|
3
|
+
import type { RuntimeReferenceStore } from '../../caching/index.js';
|
|
4
|
+
import type { RuntimeSpec } from '../runtime-spec/index.js';
|
|
5
|
+
import { type ThemePresets } from './application-spec-slice.js';
|
|
6
|
+
import type { MigrationModules } from './migrations/index.js';
|
|
7
|
+
import type { SpecCodeModule } from './spec-code/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* The project modules of an application, as the generated barrels list them: each file of a
|
|
10
|
+
* convention folder as `{ origin, exports }`, unchecked; the migration modules of both domains keyed
|
|
11
|
+
* by project path (`src/migrations/v2.ts`); and the message catalogs of `src/locales/<locale>/`,
|
|
12
|
+
* keyed by locale. `components` holds the files of `src/components/` and the frontend component
|
|
13
|
+
* files, in that order, and `elements` every element file the application mounts.
|
|
14
|
+
*/
|
|
15
|
+
export interface ApplicationModules {
|
|
16
|
+
readonly expressions: readonly ProjectModule[];
|
|
17
|
+
readonly invariants: readonly ProjectModule[];
|
|
18
|
+
readonly actions: readonly ProjectModule[];
|
|
19
|
+
readonly components: readonly ProjectModule[];
|
|
20
|
+
readonly handlers: readonly ProjectModule[];
|
|
21
|
+
readonly elements: readonly ProjectModule[];
|
|
22
|
+
readonly transformers: readonly ProjectModule[];
|
|
23
|
+
readonly adminExpressions: readonly ProjectModule[];
|
|
24
|
+
readonly adminInvariants: readonly ProjectModule[];
|
|
25
|
+
readonly adminComponents: readonly ProjectModule[];
|
|
26
|
+
readonly migrations: MigrationModules;
|
|
27
|
+
readonly catalogs: Readonly<Record<string, Messages>>;
|
|
28
|
+
}
|
|
29
|
+
export interface CreateApplicationInput {
|
|
30
|
+
/** The runtime spec, `.phoenix/application-spec.json` decoded with `decodeRuntimeSpec`. */
|
|
31
|
+
readonly spec: RuntimeSpec;
|
|
32
|
+
/** The store `createPhx` built the `phx` values in. */
|
|
33
|
+
readonly referenceStore: RuntimeReferenceStore;
|
|
34
|
+
/** The generated `.phoenix/spec-code.ts` module of the same generation as `spec`. */
|
|
35
|
+
readonly specCode?: SpecCodeModule | undefined;
|
|
36
|
+
readonly modules: ApplicationModules;
|
|
37
|
+
/** The SDK's default elements of the application kind; a project element with the same name replaces one. */
|
|
38
|
+
readonly defaultElements: readonly ElementRegistration[];
|
|
39
|
+
/** The SDK's theme presets by name, `getPhoenixThemes()`. */
|
|
40
|
+
readonly themePresets: ThemePresets;
|
|
41
|
+
readonly environment?: Application['environment'] | undefined;
|
|
42
|
+
/** The services a host provides; i18n is built from the catalogs. */
|
|
43
|
+
readonly services?: Omit<Application['services'], 'i18n'> | undefined;
|
|
44
|
+
/** The tag the web component mounts as; by default the spec's `webComponentTag`, else `salsita-configurator`. */
|
|
45
|
+
readonly tag?: string | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Builds an application from its runtime spec and its project modules, ready to mount, with no
|
|
49
|
+
* `ConfiguratorBuilder` and no `ApplicationConfig`: the full `ApplicationRuntime` in the store
|
|
50
|
+
* `createPhx` built the `phx` values in, the spec slice of the domain runtime, the initial published
|
|
51
|
+
* data and i18n.
|
|
52
|
+
*
|
|
53
|
+
* Every mistake of the project's files is reported at once, as one `ImplementationErrors`: a file
|
|
54
|
+
* that breaks its folder's contract, an expression defined twice or one the spec already gives a
|
|
55
|
+
* value, a declared expression no file implements and a migration no file exports.
|
|
56
|
+
*/
|
|
57
|
+
export declare const createApplication: <TYPES = unknown>(input: CreateApplicationInput) => Application<TYPES>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{setupI18n as e}from"@lingui/core";import{initConsoleLogger as t}from"@salsita-ai/common/utils";import{ImplementationError as i,NoopAnalyticsSystem as n,checkSingleInstanceHandlers as o,createDomainRuntime as a,createImplementationErrorCollector as r,createInitialPublishedData as s,resolveActionModules as m,resolveComponentOpticModules as c,resolveElementModule as l,resolveHandlerModule as p,resolveInvariantModules as u,resolveTransformerModule as d}from"#package/domain";import{defaultI18n as f,mergeCatalogs as g,sdkCatalog as h}from"#package/i18n";import{ApplicationRuntime as v}from"./application-runtime.js";import{applicationSpecSlice as E}from"./application-spec-slice.js";let M=(e,t,i)=>e.filter(e=>i.attempt(()=>(t(e),!0),!1)),w=(e,t,i)=>e.flatMap(e=>i.attempt(()=>t(e),[]));export const createApplication=I=>{let{spec:T,referenceStore:b,specCode:k,modules:x,environment:A={}}=I,C=r(),R=w(x.handlers,p,C),y=w(x.elements,l,C),N=w(x.transformers,e=>[d(e)],C),P=w(x.components,e=>c([e]),C),S=w(x.adminComponents,e=>c([e]),C),O=M(x.invariants,e=>u([e]),C),j=M(x.adminInvariants,e=>u([e]),C),L=M(x.actions,e=>m([e]),C),U=v(T,b,x.expressions,N,u(O),x.adminExpressions,u(j),x.migrations,k,C);if((U.ok?[...U.runtime.configurator.migrationRuntime.missingMigrations,...U.runtime.admin.migrationRuntime.missingMigrations]:U.missingMigrations).forEach(e=>C.add((e=>{let[t=e,n="migrateToVN"]=e.split("#");return new i({code:"MISSING_IMPLEMENTATION",origin:t,problem:`The migration ${n} is missing`,fix:`The spec declares the model version this file migrates to, so the file must export ${n}, the function that turns a state of the previous version into one of this version; without it a saved configuration of an earlier version cannot load. Add or rename the export.`})})(e))),C.throwIfAny(),!U.ok)throw Error("The application runtime could not be built, but no implementation error was recorded.");o(R);let $=E({runtime:U.runtime,spec:T,modules:{handlers:{handlers:R},elements:{elements:y},customComponentOptics:P,actionImplementations:m(L)},customAdminComponentOptics:S,defaultElements:I.defaultElements,themePresets:I.themePresets,environmentResourcesUrl:A.defaultEnvs?.resourcesUrl}),D=t(),F=s({adminDomainFactory:$.admin.factory,domainRuntime:a({application:{spec:$,environment:A},services:{analyticsService:new n,i18n:f,logger:D}}),adminPresets:U.runtime.admin.presetRuntime.presets,handlers:$.configurator.handlers,dataSpec:$.dataConfig??void 0,chunks:$.chunks,logger:D});return{spec:{...$,initialPublishedData:F},environment:A,services:{...I.services,i18n:e({messages:g([h,x.catalogs]),locale:T.configurator.ui.availableLocales[0]})},tag:I.tag??T.appMetadata.webComponentTag??"salsita-configurator"}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createMessageDescriptor as e,isEvalMarker as t,isMsgMarker as r}from"
|
|
1
|
+
import{createMessageDescriptor as e,isEvalMarker as t,isMsgMarker as r}from"#package/domain";let a=(s,i)=>{if(null===s||"object"!=typeof s)return s;if(r(s))return e(s);if(t(s))throw Error(`The default at ${i} is an $eval expression. Defaults are static values; the parser rejects $eval in them, so the spec given to the runtime was not produced by it. Parse the spec again and pass the result.`);return Array.isArray(s)?s.map((e,t)=>a(e,`${i}[${t}]`)):Object.fromEntries(Object.entries(s).map(([e,t])=>[e,a(t,`${i}.${e}`)]))};export const createRecipeDefaults=e=>Object.fromEntries(Object.entries(e.entries).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).map(([t,r])=>[t,a(r,`${e}.${t}`)]))]));
|
package/dist/application-spec/generate-application/runtime/factory-data/static-violations.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Violation } from '#package/domain';
|
|
2
2
|
import type { Invariants } from '../../../parse-application-files/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* The violation each static invariant of a domain reports when its implementation returns `false`,
|
package/dist/application-spec/generate-application/runtime/factory-data/static-violations.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createMessageDescriptor as t}from"
|
|
1
|
+
import{createMessageDescriptor as t}from"#package/domain";export const createStaticViolations=e=>{let i={};for(let[o,r]of Object.entries(e.entries))for(let e of Object.values(r)){if("static"!==e.kind)continue;let r={type:String(e.violationType),severity:e.severity,message:"string"==typeof e.message?e.message:t(e.message),...void 0===e.controlViolationPriority?{}:{controlViolationPriority:e.controlViolationPriority}};i[o]={...i[o],[String(e.name)]:r}}return i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ApplicationInstance } from '
|
|
1
|
+
import { ApplicationInstance } from '#package/domain';
|
|
2
2
|
export declare const generateRuntimeInstance: (applicationInstance: ApplicationInstance) => ApplicationInstance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ApplicationInstance as e}from"
|
|
1
|
+
import{ApplicationInstance as e}from"#package/domain";export const generateRuntimeInstance=n=>e(n.applicationVersion);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ApplicationRuntime, type ApplicationRuntimeResult } from './application-runtime.js';
|
|
2
|
+
export { AdminModelRuntime } from './admin-runtime/admin-model-runtime.js';
|
|
3
|
+
export { ConfiguratorModelRuntime } from './configurator-runtime/configurator-model-runtime.js';
|
|
4
|
+
export { SpecRuntime } from './spec-runtime.js';
|
|
5
|
+
export * from './factory-data/index.js';
|
|
6
|
+
export * from './migrations/index.js';
|
|
7
|
+
export * from './sections/index.js';
|
|
8
|
+
export * from './spec-code/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ApplicationRuntime}from"./application-runtime.js";export{AdminModelRuntime}from"./admin-runtime/admin-model-runtime.js";export{ConfiguratorModelRuntime}from"./configurator-runtime/configurator-model-runtime.js";export{SpecRuntime}from"./spec-runtime.js";export*from"./factory-data/index.js";export*from"./migrations/index.js";export*from"./sections/index.js";export*from"./spec-code/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Branded as e}from"@salsita-ai/common/utils";import{DomainComponentOpticBuilder as t,
|
|
1
|
+
import{Branded as e}from"@salsita-ai/common/utils";import{DomainComponentOpticBuilder as t,FILTER_CRITERION_KEYS as a,adminSidebarComponent as i,attributeSelectionComponent as r,componentsByName as n,composedOfComponent as o,isSdkCodeRef as d,navigationPageComponent as c,navigationPanelListComponent as m,referenceComponent as s}from"#package/domain";import*as l from"#package/domain";import{specCodeComponentKey as g,specCodeFilterId as p}from"../../runtime-spec/index.js";import{resolveSpecCode as R}from"../spec-code/index.js";let A=new Map([["reference",s],["composedOf",o],["adminSidebar",i],["attributeSelection",r],["navigationPage",c],["navigationPanelList",m]]),f={createAdminCustomPageRead:l.createAdminCustomPageRead,createAdminCustomSidebarRead:l.createAdminCustomSidebarRead,createAdminDataPageRead:l.createAdminDataPageRead,createAdminDataTableSidebarRead:l.createAdminDataTableSidebarRead,createAdminNavigationPanelRead:l.createAdminNavigationPanelRead,createAdminPresetCategoryPageRead:l.createAdminPresetCategoryPageRead,createAdminPresetCategorySelectionRead:l.createAdminPresetCategorySelectionRead,createAdminPresetCategorySelectionWrite:l.createAdminPresetCategorySelectionWrite,createAdminPresetCategorySidebarRead:l.createAdminPresetCategorySidebarRead,createAdminPresetListPageRead:l.createAdminPresetListPageRead,createAdminPresetSidebarRead:l.createAdminPresetSidebarRead,createAdminRecipeCollectionPageRead:l.createAdminRecipeCollectionPageRead,createAdminRecipeSidebarRead:l.createAdminRecipeSidebarRead},u=(e,t)=>{let a=f[e.sdkFunction]??l[e.sdkFunction];if("function"!=typeof a)throw Error(`SDK factory function "${e.sdkFunction}" not found. Make sure it is exported from the package.`);return a(...e.params.map(e=>{if(d(e)){let a=t.entities[e.$codeRef]??t.aliasReflections[e.$codeRef];if(!a)throw Error(`Reflection "${e.$codeRef}" not found in ModelRuntime. This is a bug — the target was validated at parse time.`);return a}return e}))};export const buildSdkOptic=(i,r,o,d,c)=>{let m=t.from(o),s=n.get(i.componentName)??A.get(i.componentName);if(!s)throw Error(`SDK component "${i.componentName}" not found. This is a bug — the component was validated at parse time.`);let l=m.withComponent(s,i.instanceName,!0),f=i.isAlias?l.withAlias(String(i.typeOrAlias)):l.withEntity(String(i.typeOrAlias)),P=g(String(i.typeOrAlias),String(i.instanceName),i.componentName);for(let[e,t]of r.filters.items.entries()){if("root"===t.kind){let e=t.target,a=t=>t[e];f=f.withFilter(a);continue}let i={};for(let r of a){let a=t[r];void 0!==a&&("dynamic"===a.kind?i[r]=e=>e[a.target]:"eval"===a.kind?i[r]=R(c,p(P,e,r,a.code),a.code):i[r]=a.value)}f=f.withGradualFilter(i)}let S=u(r.readFactory,d),y=u(r.writeFactory,d),b=f.attach(S,y);return e({typeOrAlias:String(i.typeOrAlias),componentName:i.componentName,instanceName:String(i.instanceName),optic:b})};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
-
import type
|
|
2
|
+
import { type DomainEntity, type Expression as DomainExpression, type Invariant as DomainInvariant, type ImplementationErrorCollector, type ProjectModule } from '#package/domain';
|
|
3
3
|
import type { RuntimeReferenceStore } from '../../../caching/index.js';
|
|
4
4
|
import type { Expressions } from '../../../parse-application-files/index.js';
|
|
5
5
|
import { type RuntimeModelVersion } from '../../runtime-spec/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"lodash-es/isEqual.js";import{Branded as t}from"@salsita-ai/common/utils";import{ImplementationError as i,
|
|
1
|
+
import e from"lodash-es/isEqual.js";import{Branded as t}from"@salsita-ai/common/utils";import{ImplementationError as i,canonicalEnhancedJsonValueKey as n,createRelationFactory as a,isSdkExpressionImplementation as r,mergeExpressionModules as o}from"#package/domain";import{specCodeExpressionKey as l}from"../../runtime-spec/index.js";import{generateMemoEvalPlanRuntime as s}from"./generate-memo-eval-plan-runtime.js";let p={},m=["0-1","1-1","0-N","1-N"],d={relation:(e,t)=>{let i=t[0];if(!("object"==typeof i&&null!==i&&"kind"in i&&"target"in i&&"string"==typeof i.target&&"cardinality"in i&&m.includes(i.cardinality)&&("allOfType"===i.kind||("direct"===i.kind||"indirect"===i.kind)&&"field"in i&&"string"==typeof i.field)))throw Error("Cannot create the relation expression because its parameter is not a relation declaration. The application spec is inconsistent; rebuild it from a valid relations declaration.");return a(e.aliasMap)(i)},violations:(e,t)=>{let i=t[0];if("object"!=typeof i||null===i||!("entityType"in i)||"string"!=typeof i.entityType)throw Error("Cannot create the violations expression because its entityType parameter is missing. The application spec is inconsistent; rebuild it from a valid invariants declaration.");let n=i.entityType,a=Object.entries(e.invariantImplementations).flatMap(([t,i])=>{let a=e.aliasMap[t];return t===n||a?.includes(n)?i:[]});return{origin:{name:"$violations",typeOrAlias:n},evaluate:(e,t,i)=>a.flatMap(n=>n.evaluate(e,t,i)),meta:{}}}},f=e=>{let t=s(e.plan,l(e.entityOrAlias,e.name),e.code);return{origin:{name:e.name,typeOrAlias:e.entityOrAlias},evaluate:(e,i,n)=>t(n.domain.get$Entity(e,i),i,n),meta:{}}},u=e=>({...(0,d[e.kind])({aliasMap:e.aliasMap,invariantImplementations:e.invariantImplementations},e.params),origin:{name:e.name,typeOrAlias:e.entityOrAlias}});export const ExpressionRuntime=(a,l,s,m,d=p,c,g,y={})=>{let v={};for(let[e,t]of a.latestModel.aliases)v[String(e)]=t.map(String);let x={...y};for(let[e,t]of Object.entries(o(s,v,g,((e,t,i)=>{let n=new Map,a=(e,t)=>{n.set(e,(n.get(e)??new Set).add(t))};for(let[i,n]of e.expressions.expressions)for(let[e,r]of n)if("user"!==r.implementation.kind)for(let n of t[String(i)]??[String(i)])a(n,String(e));for(let[e,t]of Object.entries(i))for(let i of Object.keys(t))a(e,i);return n})(a,v,y))))x[e]={...x[e],...t};let S=l.createBuilder(`${m}/sdk`,{build:u,getKey:e=>`sdk::${e.entityOrAlias}::${e.name}`,compare:(t,i)=>t.kind===i.kind&&e(t.params,i.params)&&e(t.aliasMap,i.aliasMap)&&("violations"!==i.kind||t.invariantImplementations===i.invariantImplementations)}),h=l.createBuilder(`${m}/user`,{build:e=>e.impl,getKey:e=>`user::${e.entityType}::${e.name}`,compare:(e,t)=>{let i,n;return(i=e.impl)===(n=t.impl)||i.evaluate===n.evaluate&&i.meta===n.meta&&i.origin.name===n.origin.name&&i.origin.typeOrAlias===n.origin.typeOrAlias}}),O=l.createBuilder(`${m}/value`,{build:f,getKey:e=>`value::${e.entityOrAlias}::${e.name}`,compare:(e,t)=>e.valueKey===t.valueKey&&e.code===t.code}),b={},k=!1,$=new Set,M=new Set,A=new Set;for(let[e,t]of a.expressions.expressions)for(let[,i]of t){let t=v[String(e)]??[String(e)];if(r(i.implementation)){let n={entityOrAlias:String(e),name:String(i.name),kind:i.implementation.kind,params:i.implementation.params,aliasMap:v,invariantImplementations:d},a=S.build(n);for(let e of(a.changed&&(k=!0),$.add(S.getKey(n)),t))b[e]||(b[e]={}),b[e][String(i.name)]=a.output;continue}if("value"===i.implementation.kind){let a=i.implementation.value,r={entityOrAlias:String(e),name:String(i.name),valueKey:n(a),plan:i.implementation.plan,code:c},o=O.build(r);for(let e of(o.changed&&(k=!0),A.add(O.getKey(r)),t))b[e]||(b[e]={}),b[e][String(i.name)]=o.output;continue}}for(let[e,t]of Object.entries(x))for(let[i,n]of Object.entries(t)){let t={entityType:e,name:i,impl:n},a=h.build(t);a.changed&&(k=!0),M.add(h.getKey(t)),b[e]||(b[e]={}),b[e][i]=a.output}S.cleanup($)&&(k=!0),h.cleanup(M)&&(k=!0),O.cleanup(A)&&(k=!0);let T=[];for(let[e,t]of a.expressions.entityExpressions)for(let i of t.shapeGroups){let t=a.expressions.expressions.get(i);if(t)for(let[i]of t)b[String(e)]?.[String(i)]||T.push({entityType:String(e),exprName:String(i)})}return T.length>0?(T.forEach(e=>g.add(new i({code:"MISSING_IMPLEMENTATION",origin:null,problem:`Missing implementation of expression ${e.entityType}.${e.exprName}`,fix:"The spec declares it without a value of its own ($eval, $msg or a read), so a project file implements it: a default export of phx.domain.implementCustomExpressions({ ... }) in src/expressions/, or of phx.domain.admin.implementCustomExpressions({ ... }) in src/admin/expressions/ for an admin entity type. Implement it, or remove the declaration from the spec."}))),{ok:!1,missing:T}):{ok:!0,runtime:t({merged:b,changed:k})}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createMessageDescriptor as e,memoEval as t}from"#package/domain";import{specCodeEvalIds as a}from"../../runtime-spec/index.js";import{resolveSpecCode as r}from"../spec-code/index.js";let n=(t,a)=>{if("literal"===t.kind)return t.value;if("slot"===t.kind)return a[t.depIndex];if("msg"===t.kind)return e(t.marker);if("array"===t.kind)return t.items.map(e=>n(e,a));let r={};for(let[e,l]of t.entries)r[e]=n(l,a);return r};export const generateMemoEvalPlanRuntime=(e,l,i)=>{if(0===e.deps.length){let t=n(e.template,[]);return()=>t}let s=a(e,l),o=e.deps.map((e,t)=>{let a=s[t];return"eval"===e.kind&&void 0!==a?r(i,a,e.code):void 0});return t(t=>e.deps.map((e,a)=>"eval"===e.kind?o[a](t):Reflect.get(t,e.target)),(...t)=>n(e.template,t))};export const evaluateStaticMemoEvalPlan=(e,t,l)=>{if(e.usesSelf)throw Error("Cannot evaluate a plan that uses self as a static value. Filter self-dependent plans before evaluating constants.");let i=a(e,t),s=e.deps.map((e,t)=>{if("read"===e.kind)throw Error(`Cannot evaluate the self-dependent read "${e.target}" as a static value. Filter self-dependent plans before evaluating constants.`);return r(l,i[t],e.code)()});return n(e.template,s)};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
+
import type { RuntimeReferenceStore } from '../../caching/index.js';
|
|
3
|
+
import type { RuntimeSpec } from '../runtime-spec/index.js';
|
|
4
|
+
import { AdminSpecRuntime } from './admin-runtime/admin-spec-runtime.js';
|
|
5
|
+
import { ConfiguratorSpecRuntime } from './configurator-runtime/configurator-spec-runtime.js';
|
|
6
|
+
import type { SpecCodeModule } from './spec-code/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* The sections of both domains that the spec alone determines, without a project module: each
|
|
9
|
+
* domain's model and the data of its `phx.domain` factories.
|
|
10
|
+
*
|
|
11
|
+
* An application is built in two steps in one reference store. This is the first: it runs before
|
|
12
|
+
* the project's modules load, because they call the `phx.domain` factories while they are evaluated.
|
|
13
|
+
* The second, `ApplicationRuntime` with the loaded modules, builds the same sections through the
|
|
14
|
+
* same functions, so it returns the same objects: `phx.domain.model.X` is the reflection the
|
|
15
|
+
* application's domain validates with.
|
|
16
|
+
*/
|
|
17
|
+
export type SpecRuntime = Branded<'SpecRuntime', {
|
|
18
|
+
readonly configurator: ConfiguratorSpecRuntime;
|
|
19
|
+
readonly admin: AdminSpecRuntime;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const SpecRuntime: (spec: RuntimeSpec, referenceStore: RuntimeReferenceStore, specCode: SpecCodeModule | undefined) => SpecRuntime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Branded as i}from"@salsita-ai/common/utils";import{AdminSpecRuntime as r}from"./admin-runtime/admin-spec-runtime.js";import{ConfiguratorSpecRuntime as o}from"./configurator-runtime/configurator-spec-runtime.js";export const SpecRuntime=(m,t,n)=>i({configurator:o(m,t,n?.configurator),admin:r(m,t,n?.admin)});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The version of the JSON format `encodeRuntimeSpec` writes. Raise it with every change to the
|
|
3
|
-
* format or to the shape of `RuntimeSpec
|
|
4
|
-
* or newer SDK wrote instead of building a
|
|
3
|
+
* format or to the shape of `RuntimeSpec` once a released SDK has written the current version, so
|
|
4
|
+
* that `decodeRuntimeSpec` refuses an artifact an older or newer SDK wrote instead of building a
|
|
5
|
+
* runtime from data it does not understand.
|
|
5
6
|
*/
|
|
6
7
|
export declare const RUNTIME_SPEC_FORMAT_VERSION = 1;
|
|
7
8
|
/** One step from a value into a part of it: an object key or an array index. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdminSpec, ApplicationSpec, ConfiguratorSpec, EntitySchema, Infra, ModelVersion, ResolvedModelVersion, ResolvedVersions } from '../../parse-application-files/index.js';
|
|
1
|
+
import type { AdminSpec, ApplicationSpec, AssistantSpec, ConfiguratorSpec, DataSchemaEntry, DataSchemas, DataSpec, EntitySchema, Infra, ModelVersion, ResolvedModelVersion, ResolvedVersions, Shape } from '../../parse-application-files/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* The part of a parsed entity schema the runtime reads: the entity type and the schema of its
|
|
4
4
|
* shape, from which it builds the entity's reflection. The full schema with `id` and `type` is
|
|
@@ -8,12 +8,22 @@ import type { AdminSpec, ApplicationSpec, ConfiguratorSpec, EntitySchema, Infra,
|
|
|
8
8
|
export type RuntimeEntitySchema = Pick<EntitySchema, 'entityType' | 'shapeSchema'>;
|
|
9
9
|
/**
|
|
10
10
|
* The part of a parsed model version the runtime reads: the entity types, the aliases, the common
|
|
11
|
-
* types and the schema of every entity's shape. The
|
|
12
|
-
* parser and the type generator
|
|
11
|
+
* types and the schema of every entity's shape. The shapes and the resolved shapes only serve the
|
|
12
|
+
* parser and the type generator, except the runtime schemas of the latest version's shapes (see
|
|
13
|
+
* `RuntimeLatestModelVersion`).
|
|
13
14
|
*/
|
|
14
15
|
export type RuntimeModelVersion = Pick<ModelVersion, 'versionKey' | 'entityTypes' | 'rootEntityTypes' | 'aliases' | 'commonTypes'> & {
|
|
15
16
|
readonly entitySchemas: readonly RuntimeEntitySchema[];
|
|
16
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* The latest model version of a domain as the runtime reads it: a model version plus the runtime
|
|
20
|
+
* schema of every shape, which `phx.domain.model` reflects as `<Name>Shape`.
|
|
21
|
+
*/
|
|
22
|
+
export type RuntimeLatestModelVersion = RuntimeModelVersion & {
|
|
23
|
+
readonly shapes: ReadonlyMap<Shape['name'], RuntimeShapeSchema>;
|
|
24
|
+
};
|
|
25
|
+
/** The part of a parsed shape the runtime reads: its name and its runtime JSON schema. */
|
|
26
|
+
export type RuntimeShapeSchema = Pick<Shape, 'name' | 'runtimeSchema'>;
|
|
17
27
|
/** One model version of a domain as the runtime reads it, with the migration file that leads to it. */
|
|
18
28
|
export type RuntimeResolvedModelVersion = Omit<ResolvedModelVersion, 'modelVersion'> & {
|
|
19
29
|
readonly modelVersion: RuntimeModelVersion;
|
|
@@ -24,15 +34,39 @@ export type RuntimeResolvedVersions = Pick<ResolvedVersions, 'latestVersion'> &
|
|
|
24
34
|
};
|
|
25
35
|
/** The model of a domain as the runtime reads it: the latest version and every earlier one. */
|
|
26
36
|
interface RuntimeDomainModel {
|
|
27
|
-
readonly latestModel:
|
|
37
|
+
readonly latestModel: RuntimeLatestModelVersion;
|
|
28
38
|
readonly resolvedVersions: RuntimeResolvedVersions;
|
|
29
39
|
}
|
|
40
|
+
/** The part of a parsed data schema the runtime reads: the JSON schema it validates the data with. */
|
|
41
|
+
export type RuntimeDataSchemaEntry = Pick<DataSchemaEntry, 'runtimeSchema'>;
|
|
42
|
+
/**
|
|
43
|
+
* The data schemas as the runtime reads them: the JSON schema of each kind of data and the hash of
|
|
44
|
+
* the published data. The enhanced schemas, with Phoenix references, only serve the type generator.
|
|
45
|
+
*/
|
|
46
|
+
export type RuntimeDataSchemas = Pick<DataSchemas, 'publishedDataHash'> & {
|
|
47
|
+
readonly [KIND in Exclude<keyof DataSchemas, 'publishedDataHash' | 'backendData'>]: RuntimeDataSchemaEntry;
|
|
48
|
+
} & {
|
|
49
|
+
readonly backendData: RuntimeDataSchemaEntry | undefined;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The assistant as the runtime reads it: its resolved manifest. The parsed assistant schema the
|
|
53
|
+
* manifest is resolved from only serves the parser.
|
|
54
|
+
*/
|
|
55
|
+
export type RuntimeAssistantSpec = Pick<NonNullable<AssistantSpec>, 'resolved'> | null;
|
|
56
|
+
/**
|
|
57
|
+
* The data spec as the runtime reads it: the data entries and their chunks. The data entries and
|
|
58
|
+
* admin data pages the parser derives from them only serve the admin spec and the type generator.
|
|
59
|
+
*/
|
|
60
|
+
export type RuntimeDataSpec = Pick<DataSpec, 'entries' | 'chunks'>;
|
|
30
61
|
/**
|
|
31
62
|
* The configurator part of the runtime spec. It leaves out the configuration schema and its
|
|
32
63
|
* version, which only a deployment registers, and the assistant's server settings (instructions
|
|
33
64
|
* and AI settings), which must never reach the browser of a customer.
|
|
34
65
|
*/
|
|
35
|
-
export type RuntimeConfiguratorSpec = Pick<ConfiguratorSpec, 'components' | 'presets' | 'expressions' | 'actions' | 'invariants' | '
|
|
66
|
+
export type RuntimeConfiguratorSpec = Pick<ConfiguratorSpec, 'components' | 'presets' | 'expressions' | 'actions' | 'invariants' | 'defaults' | 'states' | 'theme' | 'ui' | 'transformers'> & RuntimeDomainModel & {
|
|
67
|
+
readonly dataSchemas: RuntimeDataSchemas;
|
|
68
|
+
readonly assistant: RuntimeAssistantSpec;
|
|
69
|
+
};
|
|
36
70
|
/**
|
|
37
71
|
* The admin part of the runtime spec. It leaves out the configuration schema and its version, which
|
|
38
72
|
* only a deployment registers.
|
|
@@ -54,15 +88,16 @@ export type RuntimeInfra = Pick<Infra, 'acl' | 'resources' | 'resourcesConfig'>;
|
|
|
54
88
|
* leaves out what only the parser, the type generator or a deployment use, and holds plain data,
|
|
55
89
|
* Maps and Sets only, so it can be encoded as JSON.
|
|
56
90
|
*/
|
|
57
|
-
export interface RuntimeSpec extends Pick<ApplicationSpec, 'appMetadata'
|
|
91
|
+
export interface RuntimeSpec extends Pick<ApplicationSpec, 'appMetadata'> {
|
|
92
|
+
readonly dataSpec: RuntimeDataSpec;
|
|
58
93
|
readonly configurator: RuntimeConfiguratorSpec;
|
|
59
94
|
readonly admin: RuntimeAdminSpec;
|
|
60
95
|
readonly infra: RuntimeInfra;
|
|
61
96
|
}
|
|
62
97
|
/**
|
|
63
|
-
* Takes from a parsed application spec the part the runtime reads.
|
|
64
|
-
*
|
|
65
|
-
* runtime does not read.
|
|
98
|
+
* Takes from a parsed application spec the part the runtime reads. It reuses the sections it keeps
|
|
99
|
+
* whole, and builds trimmed copies of the model versions, data schemas, assistant and data spec
|
|
100
|
+
* without what the runtime does not read.
|
|
66
101
|
*/
|
|
67
102
|
export declare const toRuntimeSpec: (spec: ApplicationSpec) => RuntimeSpec;
|
|
68
103
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=e=>({versionKey:e.versionKey,entityTypes:e.entityTypes,rootEntityTypes:e.rootEntityTypes,aliases:e.aliases,commonTypes:e.commonTypes,entitySchemas:e.entitySchemas.map(e=>({entityType:e.entityType,shapeSchema:e.shapeSchema}))}),s=
|
|
1
|
+
let e=e=>({versionKey:e.versionKey,entityTypes:e.entityTypes,rootEntityTypes:e.rootEntityTypes,aliases:e.aliases,commonTypes:e.commonTypes,entitySchemas:e.entitySchemas.map(e=>({entityType:e.entityType,shapeSchema:e.shapeSchema}))}),s=e=>({runtimeSchema:e.runtimeSchema}),a=s=>{let a;return{latestModel:{...e(a=s.latestModel),shapes:new Map([...a.shapes].map(([e,s])=>[e,{name:s.name,runtimeSchema:s.runtimeSchema}]))},resolvedVersions:{latestVersion:s.resolvedVersions.latestVersion,versionedModels:s.resolvedVersions.versionedModels.map(s=>({version:s.version,key:s.key,isLatest:s.isLatest,migrationFile:s.migrationFile,modelVersion:e(s.modelVersion)}))}}};export const toRuntimeSpec=e=>{let t,{configurator:n,admin:i,infra:r}=e;return{configurator:{components:n.components,presets:n.presets,expressions:n.expressions,actions:n.actions,invariants:n.invariants,dataSchemas:{publishedDataHash:(t=n.dataSchemas).publishedDataHash,publishedData:s(t.publishedData),sessionData:s(t.sessionData),frontendData:s(t.frontendData),backendData:t.backendData&&s(t.backendData),finalizeData:s(t.finalizeData),prefetchedFinalizeData:s(t.prefetchedFinalizeData),finalizeResult:s(t.finalizeResult),callbackData:s(t.callbackData)},defaults:n.defaults,states:n.states,theme:n.theme,ui:n.ui,transformers:n.transformers,assistant:n.assistant&&{resolved:n.assistant.resolved},...a(n)},admin:{components:i.components,presets:i.presets,expressions:i.expressions,invariants:i.invariants,defaults:i.defaults,states:i.states,adminPages:i.adminPages,...a(i)},appMetadata:e.appMetadata,infra:{acl:r.acl,resources:r.resources,resourcesConfig:r.resourcesConfig},dataSpec:{entries:e.dataSpec.entries,chunks:e.dataSpec.chunks}}};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type EnhancedJsonValue } from '#package/domain';
|
|
2
3
|
import { type EnhancedJsonSchemaType } from '../../core/enhanced-json-schema.js';
|
|
3
|
-
import { type EnhancedJsonValue } from '../../core/enhanced-json-value.js';
|
|
4
4
|
/**
|
|
5
5
|
* Discriminator tag for a single parsed expression entry.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as
|
|
1
|
+
import{z as e}from"zod";import{EVAL_MARKER_KEY as r,MSG_ID_MARKER_KEY as n,MSG_MARKER_KEY as s,evalMarkerSchema as o,msgMarkerSchema as a}from"#package/domain";import{enhancedJsonSchema as i,extendEnhancedJsonSchema as t}from"../../core/enhanced-json-schema.js";export const RawExpressionKind={User:"user",Value:"value"};let c=t(o),m=t(a),d=[r,s,n],p=e=>{let r={};for(let[n,s]of Object.entries(e))d.includes(n)||(r[n]=s);return r};export const rawExpressionEntrySchema=e.union([c,m,i]).transform(e=>{if(r in e)return{kind:RawExpressionKind.Value,constant:!1,value:{[r]:e.$eval},schema:p(e)};if(s in e){let r=void 0!==e.$msgId?{[s]:e.$msg,[n]:e.$msgId}:{[s]:e.$msg};return{kind:RawExpressionKind.Value,constant:!1,value:r,schema:p(e)}}return{kind:RawExpressionKind.User,schema:e}});export const rawExpressionsSchema=e.record(e.string(),e.record(e.string(),rawExpressionEntrySchema).readonly()).readonly();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AccessLevel } from '@salsita-ai/contracts/api';
|
|
2
2
|
import { type ChatStreamChunk } from '@salsita-ai/contracts/chat';
|
|
3
|
-
import { type AssistantChatConnection, type AssistantEarlierThread, type AssistantThreadCompaction, type AuthorizedPhoenixApiClient, type ChatToolCall, type ChatToolCallResult, type ConfigurationPayload, type ConfigurationSchema, type waitForFinalizationResultSettings } from './contract.js';
|
|
3
|
+
import { type AssistantChatConnection, type AssistantEarlierThread, type AssistantImageUpload, type AssistantThreadCompaction, type AuthorizedPhoenixApiClient, type ChatToolCall, type ChatToolCallResult, type ConfigurationPayload, type ConfigurationSchema, type waitForFinalizationResultSettings } from './contract.js';
|
|
4
4
|
import type { components } from './phoenix-api.js';
|
|
5
5
|
export declare class AuthorizedClient<FINALIZE_DATA extends Record<string, unknown>, FINALIZE_RESULT extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>> implements AuthorizedPhoenixApiClient<FINALIZE_DATA, FINALIZE_RESULT, FRONTEND_DATA> {
|
|
6
6
|
private readonly _baseUrl;
|
|
@@ -28,6 +28,8 @@ export declare class AuthorizedClient<FINALIZE_DATA extends Record<string, unkno
|
|
|
28
28
|
getAssistantChatConnection: (configurationId: string) => AssistantChatConnection;
|
|
29
29
|
compactAssistantThread: (configurationId: string) => Promise<AssistantThreadCompaction>;
|
|
30
30
|
getAssistantEarlierThread: (configurationId: string, threadId: string, limit: number) => Promise<AssistantEarlierThread>;
|
|
31
|
+
uploadAssistantImage: (configurationId: string, image: Blob) => Promise<AssistantImageUpload>;
|
|
32
|
+
getAssistantImage: (configurationId: string, imageId: string) => Promise<Blob>;
|
|
31
33
|
sendMessage: (configurationId: string, content: string, context?: Record<string, string>) => Promise<ReadableStream<ChatStreamChunk>>;
|
|
32
34
|
sendToolCallResults: (configurationId: string, calls: ChatToolCall[], results: ChatToolCallResult[], agent?: string) => Promise<ReadableStream<ChatStreamChunk>>;
|
|
33
35
|
generateShareLink: (configurationId: string, revisionId: string, expiration: number, access: AccessLevel, baseUrl: string | undefined) => Promise<{
|