@40rty/ams-sdk 0.5.7 → 0.5.8

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.
@@ -12,3 +12,4 @@ export { buildBaseAttributesConfig, readBaseAttributesConfig } from './base-attr
12
12
  export { buildBucketLabelsConfig, readBucketLabelsConfig } from './bucket-labels';
13
13
  export { registerProductNameLookup, resolveProductNameLookup, clearProductNameLookups, type ProductNameLookup, type ProductNameLookupFactory, type ProductNameMatch, } from './product-lookup';
14
14
  export { registerCodeDiscountSource, resolveCodeDiscountSource, clearCodeDiscountSources, type CodeDiscountSource, type CodeDiscountSourceFactory, type CodeDiscountTerms, type StoreCodeDiscount, } from './code-discounts';
15
+ export { registerStoreThemeSource, resolveStoreThemeSource, clearStoreThemeSources, StoreThemeAccessError, type StoreThemeSource, type StoreThemeSourceFactory, type StoreThemeFile, type StoreThemeFilesPage, type StoreThemeProduct, } from './store-theme';
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The store's own storefront theme, read for a brand's tooling (`forty theme
3
+ * sync`): its theme files and which template each product page renders. A brand
4
+ * builds its product pages from these rather than from a rendered capture.
5
+ *
6
+ * Platform-neutral here, like `code-discounts.ts`: a platform's bindings
7
+ * register a factory that recognises its own store options and answers with a
8
+ * reader; the caller never names a platform.
9
+ */
10
+ export interface StoreThemeFile {
11
+ filename: string;
12
+ size: number;
13
+ /** Text files carry their content; binary assets their CDN url. */
14
+ content?: string;
15
+ url?: string;
16
+ }
17
+ export interface StoreThemeFilesPage {
18
+ themeId: string;
19
+ themeName: string;
20
+ files: StoreThemeFile[];
21
+ /** Pass back as `after` for the next page; null on the last one. */
22
+ nextCursor: string | null;
23
+ }
24
+ export interface StoreThemeProduct {
25
+ /** The platform's product id, as the commerce wire carries it. */
26
+ id: string;
27
+ handle: string;
28
+ /** The product's own template name, or null for the store's default one. */
29
+ templateSuffix: string | null;
30
+ }
31
+ export interface StoreThemeSource {
32
+ /** Theme files matching the platform's patterns (empty = every file), one page at a time. */
33
+ files(filenames: readonly string[], after: string | null): Promise<StoreThemeFilesPage>;
34
+ /** Every live product with the template it renders. */
35
+ products(): Promise<StoreThemeProduct[]>;
36
+ }
37
+ /** Thrown when the store has not granted theme access to whatever reads it — a setup step, not a bug. */
38
+ export declare class StoreThemeAccessError extends Error {
39
+ constructor(message: string);
40
+ }
41
+ export type StoreThemeSourceFactory = (options: unknown) => StoreThemeSource | undefined;
42
+ export declare function registerStoreThemeSource(factory: StoreThemeSourceFactory): void;
43
+ /** The first registered reader that recognises these store options, or undefined. */
44
+ export declare function resolveStoreThemeSource(options: unknown): StoreThemeSource | undefined;
45
+ export declare function clearStoreThemeSources(): void;
@@ -1406,6 +1406,7 @@ export declare const HOST_MODULES: {
1406
1406
  version: zod.ZodString;
1407
1407
  description: zod.ZodOptional<zod.ZodString>;
1408
1408
  builtWithSdk: zod.ZodOptional<zod.ZodString>;
1409
+ hostImports: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodArray<zod.ZodString, "many">>>;
1409
1410
  catalog: zod.ZodRecord<zod.ZodString, zod.ZodObject<{
1410
1411
  type: zod.ZodString;
1411
1412
  propsSchema: zod.ZodOptional<zod.ZodType<spacestation.WireSchema, zod.ZodTypeDef, spacestation.WireSchema>>;
@@ -1725,6 +1726,7 @@ export declare const HOST_MODULES: {
1725
1726
  config?: Record<string, unknown> | undefined;
1726
1727
  description?: string | undefined;
1727
1728
  builtWithSdk?: string | undefined;
1729
+ hostImports?: Record<string, string[]> | undefined;
1728
1730
  bundle?: {
1729
1731
  js: string;
1730
1732
  css: string;
@@ -1807,6 +1809,7 @@ export declare const HOST_MODULES: {
1807
1809
  config?: Record<string, unknown> | undefined;
1808
1810
  description?: string | undefined;
1809
1811
  builtWithSdk?: string | undefined;
1812
+ hostImports?: Record<string, string[]> | undefined;
1810
1813
  bundle?: {
1811
1814
  js: string;
1812
1815
  css: string;
@@ -1855,6 +1858,8 @@ export declare const HOST_MODULES: {
1855
1858
  space: string;
1856
1859
  } | undefined;
1857
1860
  }>;
1861
+ ReleaseMessageSchema: zod.ZodString;
1862
+ RELEASE_MESSAGE_MAX: 140;
1858
1863
  draftSourceId: typeof spacestation.draftSourceId;
1859
1864
  isDraftSource: typeof spacestation.isDraftSource;
1860
1865
  releasePreviewSourceId: typeof spacestation.releasePreviewSourceId;
@@ -1870,6 +1875,10 @@ export declare const HOST_MODULES: {
1870
1875
  compareSdkVersions: typeof spacestation.compareSdkVersions;
1871
1876
  sdkShimsFor: typeof spacestation.sdkShimsFor;
1872
1877
  sdkWindowProblem: typeof spacestation.sdkWindowProblem;
1878
+ HostImportsSchema: zod.ZodRecord<zod.ZodString, zod.ZodArray<zod.ZodString, "many">>;
1879
+ HostExportsSchema: zod.ZodRecord<zod.ZodString, zod.ZodArray<zod.ZodString, "many">>;
1880
+ hostImportProblems: typeof spacestation.hostImportProblems;
1881
+ hostImportsRefusal: typeof spacestation.hostImportsRefusal;
1873
1882
  PackageBundleRefSchema: zod.ZodObject<{
1874
1883
  sourceId: zod.ZodString;
1875
1884
  js: zod.ZodString;
@@ -4719,6 +4728,10 @@ export declare const HOST_MODULES: {
4719
4728
  registerCodeDiscountSource: typeof ecommerce.registerCodeDiscountSource;
4720
4729
  resolveCodeDiscountSource: typeof ecommerce.resolveCodeDiscountSource;
4721
4730
  clearCodeDiscountSources: typeof ecommerce.clearCodeDiscountSources;
4731
+ registerStoreThemeSource: typeof ecommerce.registerStoreThemeSource;
4732
+ resolveStoreThemeSource: typeof ecommerce.resolveStoreThemeSource;
4733
+ clearStoreThemeSources: typeof ecommerce.clearStoreThemeSources;
4734
+ StoreThemeAccessError: typeof ecommerce.StoreThemeAccessError;
4722
4735
  orderedVideoSources(video: ecommerce.ProductVideo): ecommerce.VideoSource[];
4723
4736
  createUnavailableProduct(gid: string): ecommerce.Product;
4724
4737
  isGhostEntity(value: unknown): boolean;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ /** What a bundle reads from each shared module — `default` included when it takes the default export. */
3
+ export declare const HostImportsSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>;
4
+ export type HostImports = z.infer<typeof HostImportsSchema>;
5
+ /** What each shared module exports in one deployment — what `GET /org/host-modules` answers. */
6
+ export declare const HostExportsSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>;
7
+ export type HostExports = z.infer<typeof HostExportsSchema>;
8
+ /**
9
+ * Each import `provided` cannot satisfy, as `module → name` — or `module (not
10
+ * provided)` when the deployment shares no such module at all. Empty when the
11
+ * bundle can run on it.
12
+ */
13
+ export declare function hostImportProblems(imports: HostImports, provided: HostExports): string[];
14
+ /** The refusal's one line: which deployment, and what to do about it. `commit` is `null` where the runtime does not say. */
15
+ export declare function hostImportsRefusal(commit: string | null): string;
@@ -2,7 +2,8 @@ export { WireSchemaSchema, type WireSchema, type WireResolved } from './wire-sch
2
2
  export { schemaToWire, UnsupportedSchemaError } from './schema-to-wire';
3
3
  export { schemaFromWire } from './schema-from-wire';
4
4
  export { WireCatalogSchema, WireCatalogEntrySchema, catalogToWire, catalogFromWire, type WireCatalog, type WireCatalogEntry, } from './catalog-wire';
5
- export { PackageReleaseSchema, draftSourceId, isDraftSource, releasePreviewSourceId, parseReleasePreview, type PackageRelease } from './package-release';
5
+ export { PackageReleaseSchema, ReleaseMessageSchema, RELEASE_MESSAGE_MAX, draftSourceId, isDraftSource, releasePreviewSourceId, parseReleasePreview, type PackageRelease } from './package-release';
6
6
  export { SDK_VERSION_PATTERN, SdkVersionSchema, OLDEST_SUPPORTED_SDK, SDK_SHIMS, compareSdkVersions, sdkShimsFor, sdkWindowProblem, type SdkShim, } from './sdk-compat';
7
+ export { HostImportsSchema, HostExportsSchema, hostImportProblems, hostImportsRefusal, type HostImports, type HostExports } from './host-imports';
7
8
  export { PackageBundleRefSchema, type PackageBundleRef } from './package-bundle-ref';
8
9
  export { BRAND_MARK_TYPES, BRAND_MARK_SLOTS, BRAND_MARK_MAX_BYTES, BrandMarkSchema, BrandMarkImageSchema, SpaceBrandMarkSchema, type BrandMark, type BrandMarkFile, type BrandMarkUpload, type BrandMarkStored, type BrandMarkSlot, type BrandMarkType, type BrandMarkImage, type SpaceBrandMark, } from './brand-mark';
@@ -1,4 +1,12 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * What a release changed, in one line a person reads in a version list — what
4
+ * `forty publish --message` and the console's Publish both take. Every release
5
+ * appended carries one; the release schema keeps it optional only because
6
+ * drafts and releases stored before it was required have none.
7
+ */
8
+ export declare const RELEASE_MESSAGE_MAX = 140;
9
+ export declare const ReleaseMessageSchema: z.ZodString;
2
10
  /**
3
11
  * A brand's component source, published as DATA from the brand's own
4
12
  * repository: its catalog (props schemas in wire form) and the markdown
@@ -25,6 +33,15 @@ export declare const PackageReleaseSchema: z.ZodObject<{
25
33
  * published before the stamp existed — those are legacy.
26
34
  */
27
35
  builtWithSdk: z.ZodOptional<z.ZodString>;
36
+ /**
37
+ * Every name the bundle reads from each module it takes from the page
38
+ * (`host-imports.ts`) — what lets the platform refuse a bundle it cannot
39
+ * run. Sent by `forty publish` / `forty dev` with every bundle; absent on
40
+ * releases built before it existed, which are admitted (and logged). Kept
41
+ * beside the release, not in the bundle, so a rollback can check it without
42
+ * fetching the components.
43
+ */
44
+ hostImports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
28
45
  catalog: z.ZodRecord<z.ZodString, z.ZodObject<{
29
46
  type: z.ZodString;
30
47
  propsSchema: z.ZodOptional<z.ZodType<import("./wire-schema").WireSchema, z.ZodTypeDef, import("./wire-schema").WireSchema>>;
@@ -383,6 +400,7 @@ export declare const PackageReleaseSchema: z.ZodObject<{
383
400
  config?: Record<string, unknown> | undefined;
384
401
  description?: string | undefined;
385
402
  builtWithSdk?: string | undefined;
403
+ hostImports?: Record<string, string[]> | undefined;
386
404
  bundle?: {
387
405
  js: string;
388
406
  css: string;
@@ -465,6 +483,7 @@ export declare const PackageReleaseSchema: z.ZodObject<{
465
483
  config?: Record<string, unknown> | undefined;
466
484
  description?: string | undefined;
467
485
  builtWithSdk?: string | undefined;
486
+ hostImports?: Record<string, string[]> | undefined;
468
487
  bundle?: {
469
488
  js: string;
470
489
  css: string;
@@ -31,7 +31,7 @@ export { isElementUnfilled, rendersNothing } from './catalog/element-filled';
31
31
  export { carriesShapeToken } from './catalog/shape-tokens';
32
32
  export { applySinglePatch } from './layout/apply-patch';
33
33
  export { derivePropsDoc } from './catalog/derive-props-doc';
34
- export { WireSchemaSchema, WireCatalogSchema, WireCatalogEntrySchema, schemaToWire, schemaFromWire, catalogToWire, catalogFromWire, UnsupportedSchemaError, PackageReleaseSchema, draftSourceId, isDraftSource, releasePreviewSourceId, parseReleasePreview, SDK_VERSION_PATTERN, SdkVersionSchema, OLDEST_SUPPORTED_SDK, SDK_SHIMS, compareSdkVersions, sdkShimsFor, sdkWindowProblem, type SdkShim, PackageBundleRefSchema, type PackageBundleRef, BRAND_MARK_TYPES, BRAND_MARK_SLOTS, BRAND_MARK_MAX_BYTES, BrandMarkSchema, BrandMarkImageSchema, SpaceBrandMarkSchema, type BrandMark, type BrandMarkFile, type BrandMarkUpload, type BrandMarkStored, type BrandMarkSlot, type BrandMarkType, type BrandMarkImage, type SpaceBrandMark, type PackageRelease, type WireSchema, type WireCatalog, type WireCatalogEntry, } from './catalog/wire';
34
+ export { WireSchemaSchema, WireCatalogSchema, WireCatalogEntrySchema, schemaToWire, schemaFromWire, catalogToWire, catalogFromWire, UnsupportedSchemaError, PackageReleaseSchema, ReleaseMessageSchema, RELEASE_MESSAGE_MAX, draftSourceId, isDraftSource, releasePreviewSourceId, parseReleasePreview, SDK_VERSION_PATTERN, SdkVersionSchema, OLDEST_SUPPORTED_SDK, SDK_SHIMS, compareSdkVersions, sdkShimsFor, sdkWindowProblem, type SdkShim, HostImportsSchema, HostExportsSchema, hostImportProblems, hostImportsRefusal, type HostImports, type HostExports, PackageBundleRefSchema, type PackageBundleRef, BRAND_MARK_TYPES, BRAND_MARK_SLOTS, BRAND_MARK_MAX_BYTES, BrandMarkSchema, BrandMarkImageSchema, SpaceBrandMarkSchema, type BrandMark, type BrandMarkFile, type BrandMarkUpload, type BrandMarkStored, type BrandMarkSlot, type BrandMarkType, type BrandMarkImage, type SpaceBrandMark, type PackageRelease, type WireSchema, type WireCatalog, type WireCatalogEntry, } from './catalog/wire';
35
35
  export { LateBoundValueSchema, DirectiveValueSchema, ProjectionDirectiveSchema, ProjectionPreferencesSchema, ProjectionSetPayloadSchema, PROJECTION_SET_SIGNAL, isLateBound, isActiveDirective, projectCollection, type LateBoundValue, type DirectiveValue, type ProjectionDirective, type ProjectionPreferences, type ProjectionSetPayload, type ProjectionAccessors, } from './projection/projection';
36
36
  export { VIEW_HOST_SIGNAL, HostPayloadSchema, type HostPayload, hostPlace, pagePlace, hostFillsPage, HostClearedSchema, HOST_CLEARED, type HostCleared, PAGELESS_HOST_PLACE, } from './host/host-page';
37
37
  export { VIEW_FOCUS_ELEMENT_SIGNAL, FocusElementPayloadSchema, type FocusElementPayload, } from './focus/focus';
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  "react": "^18.3.0 || ^19.0.0",
27
27
  "react-dom": "^18.3.0 || ^19.0.0"
28
28
  },
29
- "version": "0.5.7",
29
+ "version": "0.5.8",
30
30
  "homepage": "https://docs.40rty.ai",
31
31
  "license": "UNLICENSED",
32
32
  "engines": {