@fluid-app/fluid-cli-portal 0.1.52 → 0.1.53

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/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Command } from "commander";
2
- import { CliError, FetchClient, FluidPlugin, Result } from "@fluid-app/fluid-cli";
2
+ import { CliError, FluidPlugin, Result } from "@fluid-app/fluid-cli";
3
3
 
4
4
  //#region src/types.d.ts
5
5
  /**
@@ -339,6 +339,35 @@ interface GitAutoCommitOptions {
339
339
  * `node_modules/`, `dist/`, `.portal-sync/`, logs, `*.tsbuildinfo`), so
340
340
  * generated output and local secrets stay out of the commit.
341
341
  *
342
+ * That boundary is not enough on its own for tool-local state written
343
+ * INTO the project directory by whatever opened it — most importantly
344
+ * Mist Desktop's `.mist-desktop/` (private chats, attachments,
345
+ * screenshots) and the `.mist` clone marker. A `.gitignore`-only fix
346
+ * can't reach clones that already exist, so this applies belt AND
347
+ * suspenders, all anchored to the repository root (see
348
+ * {@link resolveRepoRoot}):
349
+ *
350
+ * 1. {@link excludeLocalStateFromGit} — idempotent `.git/info/exclude`
351
+ * write, so `git add` never picks the paths up in the first place.
352
+ * Heals pre-existing clones on their next push.
353
+ * 2. `git reset -- ':(top).mist' .mist` after staging — unstages the
354
+ * marker if step 1 silently failed. We deliberately do NOT pass a
355
+ * `:(exclude)` pathspec to `git add`: when the path is *also*
356
+ * listed in `.git/info/exclude`, git exits 1 with "paths are
357
+ * ignored by one of your .gitignore files", turning the normal
358
+ * (already-healed) case into a hard failure. Add-then-reset is a
359
+ * no-op when there's nothing staged.
360
+ * 3. `git rm --cached -r --ignore-unmatch .mist-desktop` — untracks
361
+ * chat history that an older, unhardened push already committed.
362
+ * Ignore rules alone cannot untrack an existing path. `--cached`
363
+ * keeps every file on disk; only the index entry goes away. This
364
+ * runs even under `ignoreRemovals`, where suppressing deletions
365
+ * protects remote-only *portal* files — private chats are never
366
+ * that, and leaving them tracked would keep republishing them.
367
+ *
368
+ * Steps 2 and 3 are best-effort and never fail the publish; the commit
369
+ * itself is what must succeed.
370
+ *
342
371
  * Uses the repo's configured identity, else a synthetic Fluid bot
343
372
  * identity so the commit isn't rejected. "nothing to commit" is treated
344
373
  * as a no-op, not an error.
@@ -364,7 +393,7 @@ declare function gitPush(cwd: string, remoteUrl: string, branch?: string): Promi
364
393
  *
365
394
  * POST <endpoint> -> 201 { git_credential: { remote_url, expires_at }, status, meta }
366
395
  * errors: 409 not_provisioned/not_connected, 502 vendor_error, 422 else
367
- * { error: { message, details: { type } }, status, meta }
396
+ * { error_message, errors: { type: [type] }, meta }
368
397
  *
369
398
  * The exact path is still being finalized as 006 lands, so it lives in
370
399
  * one constant here. Until the endpoint ships to prod a request 404s —
@@ -378,9 +407,16 @@ interface PortalGitCredential {
378
407
  }
379
408
  /**
380
409
  * Outcome of a credential request. `unavailable` means "no repo to sync"
381
- * (endpoint missing / not provisioned / not connected) — the caller
382
- * should warn and skip, never abort. `error` is an unexpected transport
383
- * failure the caller may log but still shouldn't hard-fail push on.
410
+ * (endpoint missing / not provisioned / not connected). Its `retryable`
411
+ * flag distinguishes backend states that are expected to self-heal
412
+ * (`not_provisioned` — the first credential request triggers repository
413
+ * provisioning) from ones that don't (`not_connected` — the company's
414
+ * Git integration isn't connected, which no amount of retrying fixes;
415
+ * verified against prod where both brand-new and long-standing
416
+ * definitions on an unconnected company return `not_connected` 409s
417
+ * permanently). `conflictType` carries the raw 409 conflict type so
418
+ * callers can tailor messaging. `error` is an unexpected transport or
419
+ * provider failure.
384
420
  */
385
421
  type GitCredentialOutcome = {
386
422
  readonly status: "ok";
@@ -388,6 +424,8 @@ type GitCredentialOutcome = {
388
424
  } | {
389
425
  readonly status: "unavailable";
390
426
  readonly reason: string;
427
+ readonly retryable: boolean;
428
+ readonly conflictType?: string;
391
429
  } | {
392
430
  readonly status: "error";
393
431
  readonly reason: string;
@@ -406,6 +444,8 @@ interface CreatePortalGitCredentialOptions {
406
444
  readonly definitionId: number;
407
445
  /** Injectable for tests; defaults to global fetch. */
408
446
  readonly fetchImpl?: typeof fetch;
447
+ /** Deadline for one API request; defaults to 15 seconds. */
448
+ readonly requestTimeoutMs?: number;
409
449
  }
410
450
  /**
411
451
  * Request a git credential for the portal definition's provisioned repo.
@@ -458,143 +498,6 @@ declare function createPortalProject(appName: string, options: CreateOptions, co
458
498
  //#region src/commands/pull.d.ts
459
499
  declare const pullCommand: Command;
460
500
  //#endregion
461
- //#region src/commands/push.d.ts
462
- declare const pushCommand: Command;
463
- //#endregion
464
- //#region src/commands/widget-create.d.ts
465
- declare const widgetCommand: Command;
466
- //#endregion
467
- //#region src/commands/widget-publish.d.ts
468
- declare const topLevelWidgetCommand: Command;
469
- //#endregion
470
- //#region src/commands/deploy.d.ts
471
- declare const deployCommand: Command;
472
- //#endregion
473
- //#region src/commands/version.d.ts
474
- declare const versionCommand: Command;
475
- //#endregion
476
- //#region src/commands/doctor.d.ts
477
- declare const doctorCommand: Command;
478
- //#endregion
479
- //#region src/utils/mappings.d.ts
480
- /** Definition metadata stored at the top level of the mappings file. */
481
- interface DefinitionMapping {
482
- readonly name: string;
483
- readonly id: number;
484
- }
485
- /**
486
- * Resource types that support slug-to-ID mappings.
487
- * "countries" and "ranks" use display names as keys (not slugified).
488
- */
489
- type MappedResourceType = "screens" | "themes" | "navigations" | "profiles" | "countries" | "ranks";
490
- /** Full mappings structure persisted to disk. */
491
- interface PortalMappings {
492
- readonly definition: DefinitionMapping;
493
- readonly screens: Record<string, number>;
494
- readonly themes: Record<string, number>;
495
- readonly navigations: Record<string, number>;
496
- readonly profiles: Record<string, number>;
497
- readonly countries: Record<string, number>;
498
- readonly ranks: Record<string, number>;
499
- }
500
- /**
501
- * Read the mappings file from the `.portal-sync/` directory.
502
- * Returns `null` if the file does not exist.
503
- */
504
- declare function readMappings(portalSyncDir: string): Promise<PortalMappings | null>;
505
- /**
506
- * Write the mappings file to the `.portal-sync/` directory.
507
- * Creates the directory if it does not exist.
508
- */
509
- declare function writeMappings(portalSyncDir: string, mappings: PortalMappings): Promise<void>;
510
- /**
511
- * Derive a filesystem-safe slug from a resource name.
512
- *
513
- * - Lowercases the name
514
- * - Replaces non-alphanumeric characters (except hyphens) with hyphens
515
- * - Collapses consecutive hyphens
516
- * - Trims leading/trailing hyphens
517
- *
518
- * If the derived slug collides with an existing slug in `existingSlugs`,
519
- * a numeric suffix is appended (e.g., `home-2`, `home-3`).
520
- */
521
- declare function deriveSlug(name: string, existingSlugs?: ReadonlySet<string>): string;
522
- /**
523
- * Resolve a slug to its server-side ID.
524
- * Returns `undefined` if the slug is not mapped.
525
- */
526
- declare function resolveSlugToId(mappings: PortalMappings, resourceType: MappedResourceType, slug: string): number | undefined;
527
- /**
528
- * Resolve a server-side ID back to its slug.
529
- * Returns `undefined` if no slug maps to the given ID.
530
- */
531
- declare function resolveIdToSlug(mappings: PortalMappings, resourceType: MappedResourceType, id: number): string | undefined;
532
- /**
533
- * Add or update a mapping entry for a given resource type.
534
- * Returns a new `PortalMappings` object (immutable update).
535
- */
536
- declare function updateMapping(mappings: PortalMappings, resourceType: MappedResourceType, slug: string, id: number): PortalMappings;
537
- /**
538
- * Remove a mapping entry for a given resource type.
539
- * Returns a new `PortalMappings` object (immutable update).
540
- * If the slug does not exist, the original mappings are returned unchanged.
541
- */
542
- declare function removeMapping(mappings: PortalMappings, resourceType: MappedResourceType, slug: string): PortalMappings;
543
- //#endregion
544
- //#region src/utils/snapshot.d.ts
545
- /** SHA-256 hex digest of a file's contents. */
546
- type FileHash = string;
547
- /** Map of relative file paths to their content hashes. */
548
- type FileHashMap = Record<string, FileHash>;
549
- /** Snapshot structure persisted to `.portal-sync/snapshot.json`. */
550
- interface Snapshot {
551
- /** Human-readable name of the portal definition. */
552
- readonly definition: string;
553
- /** Server-side ID of the portal definition. */
554
- readonly definition_id: number;
555
- /** ISO 8601 timestamp of when the snapshot was created. */
556
- readonly pulled_at: string;
557
- /** Map of relative file paths → SHA-256 hashes. */
558
- readonly files: FileHashMap;
559
- }
560
- /** Result of diffing current files against a snapshot. */
561
- interface SnapshotDiff {
562
- /** Files that exist on disk but not in the snapshot. */
563
- readonly new: readonly string[];
564
- /** Files that exist in both but have different hashes. */
565
- readonly changed: readonly string[];
566
- /** Files that exist in the snapshot but not on disk. */
567
- readonly deleted: readonly string[];
568
- }
569
- /**
570
- * Compute the SHA-256 hash of a file's contents.
571
- * Returns the hex-encoded digest.
572
- */
573
- declare function computeFileHash(filePath: string): Promise<FileHash>;
574
- /**
575
- * Read the snapshot file from the `.portal-sync/` directory.
576
- * Returns `null` if the file does not exist.
577
- */
578
- declare function readSnapshot(portalSyncDir: string): Promise<Snapshot | null>;
579
- /**
580
- * Write the snapshot file to the `.portal-sync/` directory.
581
- * Creates the directory if it does not exist.
582
- */
583
- declare function writeSnapshot(portalSyncDir: string, snapshot: Snapshot): Promise<void>;
584
- /**
585
- * Compare the current portal directory contents against a snapshot.
586
- *
587
- * Returns lists of new, changed, and deleted files (relative paths).
588
- */
589
- declare function diffAgainstSnapshot(portalDir: string, snapshot: Snapshot): Promise<SnapshotDiff>;
590
- /**
591
- * Build a fresh snapshot from the current portal directory contents.
592
- *
593
- * Hashes every file in `portalDir` (excluding `.portal-sync/`)
594
- * and records the definition metadata.
595
- */
596
- declare function buildSnapshot(portalDir: string, definitionName: string, definitionId: number): Promise<Snapshot>;
597
- //#endregion
598
501
  //#region ../../api-clients/fluidos/src/generated/fluid-os-v0.d.ts
599
502
  interface components {
600
503
  schemas: {
@@ -983,6 +886,192 @@ interface components {
983
886
  pathItems: never;
984
887
  }
985
888
  //#endregion
889
+ //#region src/utils/mappings.d.ts
890
+ /** Definition metadata stored at the top level of the mappings file. */
891
+ interface DefinitionMapping {
892
+ readonly name: string;
893
+ readonly id: number;
894
+ }
895
+ /**
896
+ * Resource types that support slug-to-ID mappings.
897
+ * "countries" and "ranks" use display names as keys (not slugified).
898
+ */
899
+ type MappedResourceType = "screens" | "themes" | "navigations" | "profiles" | "countries" | "ranks";
900
+ /** Full mappings structure persisted to disk. */
901
+ interface PortalMappings {
902
+ readonly definition: DefinitionMapping;
903
+ readonly screens: Record<string, number>;
904
+ readonly themes: Record<string, number>;
905
+ readonly navigations: Record<string, number>;
906
+ readonly profiles: Record<string, number>;
907
+ readonly countries: Record<string, number>;
908
+ readonly ranks: Record<string, number>;
909
+ }
910
+ /**
911
+ * Read the mappings file from the `.portal-sync/` directory.
912
+ * Returns `null` if the file does not exist.
913
+ */
914
+ declare function readMappings(portalSyncDir: string): Promise<PortalMappings | null>;
915
+ /**
916
+ * Write the mappings file to the `.portal-sync/` directory.
917
+ * Creates the directory if it does not exist.
918
+ */
919
+ declare function writeMappings(portalSyncDir: string, mappings: PortalMappings): Promise<void>;
920
+ /**
921
+ * Derive a filesystem-safe slug from a resource name.
922
+ *
923
+ * - Lowercases the name
924
+ * - Replaces non-alphanumeric characters (except hyphens) with hyphens
925
+ * - Collapses consecutive hyphens
926
+ * - Trims leading/trailing hyphens
927
+ *
928
+ * If the derived slug collides with an existing slug in `existingSlugs`,
929
+ * a numeric suffix is appended (e.g., `home-2`, `home-3`).
930
+ */
931
+ declare function deriveSlug(name: string, existingSlugs?: ReadonlySet<string>): string;
932
+ /**
933
+ * Resolve a slug to its server-side ID.
934
+ * Returns `undefined` if the slug is not mapped.
935
+ */
936
+ declare function resolveSlugToId(mappings: PortalMappings, resourceType: MappedResourceType, slug: string): number | undefined;
937
+ /**
938
+ * Resolve a server-side ID back to its slug.
939
+ * Returns `undefined` if no slug maps to the given ID.
940
+ */
941
+ declare function resolveIdToSlug(mappings: PortalMappings, resourceType: MappedResourceType, id: number): string | undefined;
942
+ /**
943
+ * Add or update a mapping entry for a given resource type.
944
+ * Returns a new `PortalMappings` object (immutable update).
945
+ */
946
+ declare function updateMapping(mappings: PortalMappings, resourceType: MappedResourceType, slug: string, id: number): PortalMappings;
947
+ /**
948
+ * Remove a mapping entry for a given resource type.
949
+ * Returns a new `PortalMappings` object (immutable update).
950
+ * If the slug does not exist, the original mappings are returned unchanged.
951
+ */
952
+ declare function removeMapping(mappings: PortalMappings, resourceType: MappedResourceType, slug: string): PortalMappings;
953
+ //#endregion
954
+ //#region src/utils/snapshot.d.ts
955
+ /** SHA-256 hex digest of a file's contents. */
956
+ type FileHash = string;
957
+ /** Map of relative file paths to their content hashes. */
958
+ type FileHashMap = Record<string, FileHash>;
959
+ /** Snapshot structure persisted to `.portal-sync/snapshot.json`. */
960
+ interface Snapshot {
961
+ /** Human-readable name of the portal definition. */
962
+ readonly definition: string;
963
+ /** Server-side ID of the portal definition. */
964
+ readonly definition_id: number;
965
+ /** ISO 8601 timestamp of when the snapshot was created. */
966
+ readonly pulled_at: string;
967
+ /** Map of relative file paths → SHA-256 hashes. */
968
+ readonly files: FileHashMap;
969
+ }
970
+ /** Result of diffing current files against a snapshot. */
971
+ interface SnapshotDiff {
972
+ /** Files that exist on disk but not in the snapshot. */
973
+ readonly new: readonly string[];
974
+ /** Files that exist in both but have different hashes. */
975
+ readonly changed: readonly string[];
976
+ /** Files that exist in the snapshot but not on disk. */
977
+ readonly deleted: readonly string[];
978
+ }
979
+ /**
980
+ * Compute the SHA-256 hash of a file's contents.
981
+ * Returns the hex-encoded digest.
982
+ */
983
+ declare function computeFileHash(filePath: string): Promise<FileHash>;
984
+ /**
985
+ * Read the snapshot file from the `.portal-sync/` directory.
986
+ * Returns `null` if the file does not exist.
987
+ */
988
+ declare function readSnapshot(portalSyncDir: string): Promise<Snapshot | null>;
989
+ /**
990
+ * Write the snapshot file to the `.portal-sync/` directory.
991
+ * Creates the directory if it does not exist.
992
+ */
993
+ declare function writeSnapshot(portalSyncDir: string, snapshot: Snapshot): Promise<void>;
994
+ /**
995
+ * Compare the current portal directory contents against a snapshot.
996
+ *
997
+ * Returns lists of new, changed, and deleted files (relative paths).
998
+ */
999
+ declare function diffAgainstSnapshot(portalDir: string, snapshot: Snapshot): Promise<SnapshotDiff>;
1000
+ /**
1001
+ * Build a fresh snapshot from the current portal directory contents.
1002
+ *
1003
+ * Hashes every file in `portalDir` (excluding `.portal-sync/`)
1004
+ * and records the definition metadata.
1005
+ */
1006
+ declare function buildSnapshot(portalDir: string, definitionName: string, definitionId: number): Promise<Snapshot>;
1007
+ //#endregion
1008
+ //#region src/utils/push-validation.d.ts
1009
+ /** Categorize changed files by resource type. */
1010
+ interface CategorizedChanges {
1011
+ readonly screens: {
1012
+ new: string[];
1013
+ changed: string[];
1014
+ deleted: string[];
1015
+ };
1016
+ readonly themes: {
1017
+ new: string[];
1018
+ changed: string[];
1019
+ deleted: string[];
1020
+ };
1021
+ readonly navigations: {
1022
+ new: string[];
1023
+ changed: string[];
1024
+ deleted: string[];
1025
+ };
1026
+ readonly profiles: {
1027
+ new: string[];
1028
+ changed: string[];
1029
+ deleted: string[];
1030
+ };
1031
+ }
1032
+ /** A validation error found during cross-reference checking. */
1033
+ interface ValidationError {
1034
+ readonly file: string;
1035
+ readonly message: string;
1036
+ }
1037
+ /**
1038
+ * Extract the slug from a file path (e.g., "screens/home.json" -> "home").
1039
+ */
1040
+ declare function slugFromPath(filePath: string): string;
1041
+ /**
1042
+ * Categorize a snapshot diff into resource-type-specific change lists.
1043
+ */
1044
+ declare function categorizeChanges(diff: SnapshotDiff): CategorizedChanges;
1045
+ /**
1046
+ * Validate that all cross-references between local portal files are valid.
1047
+ *
1048
+ * Checks:
1049
+ * - New and changed resources contain the required local-file fields
1050
+ * - New and changed themes include the required config object
1051
+ * - Navigation items' "screen" slugs reference existing screen files or mappings
1052
+ * - Profile "navigation" and "mobile_navigation" slugs reference existing nav files or mappings
1053
+ * - Profile "themes" slugs reference existing theme files or mappings
1054
+ */
1055
+ declare function validateCrossReferences(portalDir: string, mappings: PortalMappings, changes: CategorizedChanges): Promise<ValidationError[]>;
1056
+ //#endregion
1057
+ //#region src/commands/push.d.ts
1058
+ declare const pushCommand: Command;
1059
+ //#endregion
1060
+ //#region src/commands/widget-create.d.ts
1061
+ declare const widgetCommand: Command;
1062
+ //#endregion
1063
+ //#region src/commands/widget-publish.d.ts
1064
+ declare const topLevelWidgetCommand: Command;
1065
+ //#endregion
1066
+ //#region src/commands/deploy.d.ts
1067
+ declare const deployCommand: Command;
1068
+ //#endregion
1069
+ //#region src/commands/version.d.ts
1070
+ declare const versionCommand: Command;
1071
+ //#endregion
1072
+ //#region src/commands/doctor.d.ts
1073
+ declare const doctorCommand: Command;
1074
+ //#endregion
986
1075
  //#region src/utils/transform.d.ts
987
1076
  type ApiScreen = components["schemas"]["FluidOSScreen"];
988
1077
  type ApiTheme = components["schemas"]["FluidOSTheme"];
@@ -999,7 +1088,8 @@ interface LocalTheme {
999
1088
  readonly active: boolean;
1000
1089
  }
1001
1090
  interface LocalNavigationItem {
1002
- readonly id: number;
1091
+ /** Server-owned sync identity. New draft items omit it until push. */
1092
+ readonly id?: number;
1003
1093
  readonly icon: string | null;
1004
1094
  readonly label: string | null;
1005
1095
  readonly screen: string | null;
@@ -1069,383 +1159,8 @@ declare const buildThemeIdToSlugMap: (mappings: Record<string, number>) => Map<n
1069
1159
  */
1070
1160
  declare function transformProfile(profile: ApiProfile, navIdToSlug: Map<number, string>, themeIdToSlug: Map<number, string>): LocalProfile;
1071
1161
  //#endregion
1072
- //#region src/utils/push-validation.d.ts
1073
- /** Categorize changed files by resource type. */
1074
- interface CategorizedChanges {
1075
- readonly screens: {
1076
- new: string[];
1077
- changed: string[];
1078
- deleted: string[];
1079
- };
1080
- readonly themes: {
1081
- new: string[];
1082
- changed: string[];
1083
- deleted: string[];
1084
- };
1085
- readonly navigations: {
1086
- new: string[];
1087
- changed: string[];
1088
- deleted: string[];
1089
- };
1090
- readonly profiles: {
1091
- new: string[];
1092
- changed: string[];
1093
- deleted: string[];
1094
- };
1095
- }
1096
- /** A validation error found during cross-reference checking. */
1097
- interface ValidationError {
1098
- readonly file: string;
1099
- readonly message: string;
1100
- }
1101
- /**
1102
- * Extract the slug from a file path (e.g., "screens/home.json" -> "home").
1103
- */
1104
- declare function slugFromPath(filePath: string): string;
1105
- /**
1106
- * Categorize a snapshot diff into resource-type-specific change lists.
1107
- */
1108
- declare function categorizeChanges(diff: SnapshotDiff): CategorizedChanges;
1109
- /**
1110
- * Validate that all cross-references between local portal files are valid.
1111
- *
1112
- * Checks:
1113
- * - Navigation items' "screen" slugs reference existing screen files or mappings
1114
- * - Profile "navigation" and "mobile_navigation" slugs reference existing nav files or mappings
1115
- * - Profile "themes" slugs reference existing theme files or mappings
1116
- */
1117
- declare function validateCrossReferences(portalDir: string, mappings: PortalMappings, changes: CategorizedChanges): Promise<ValidationError[]>;
1118
- //#endregion
1119
- //#region ../../portal/core/src/remote-dom-widget-package.d.ts
1120
- declare const REMOTE_DOM_WIDGET_MANIFEST_VERSION: 1;
1121
- declare const REMOTE_DOM_WIDGET_RUNTIME: "remote-dom";
1122
- type JsonPrimitive = string | number | boolean | null;
1123
- type JsonValue = JsonPrimitive | readonly JsonValue[] | JsonObject;
1124
- interface JsonObject {
1125
- readonly [key: string]: JsonValue;
1126
- }
1127
- interface RemoteDomWidgetCapabilityDeclaration {
1128
- readonly name: string;
1129
- readonly version: string;
1130
- }
1131
- interface RemoteDomWidgetDefinition {
1132
- readonly type: string;
1133
- readonly displayName: string;
1134
- readonly description: string;
1135
- readonly icon: string;
1136
- readonly category: string;
1137
- readonly propertySchema: JsonObject;
1138
- readonly defaultProps: JsonObject;
1139
- readonly container: "inline" | "block" | "card" | "fullscreen";
1140
- readonly resizable: boolean | "horizontal" | "vertical" | "both";
1141
- readonly minSdkVersion: string;
1142
- readonly capabilities: readonly RemoteDomWidgetCapabilityDeclaration[];
1143
- }
1144
- /**
1145
- * Canonical package contract shared by the CLI, catalog APIs, and portal hosts.
1146
- * Catalog producers resolve every artifact to its public URL before returning
1147
- * this descriptor; consumers do not translate legacy manifest shapes.
1148
- */
1149
- interface RemoteDomWidgetPackageDescriptor {
1150
- readonly manifestVersion: typeof REMOTE_DOM_WIDGET_MANIFEST_VERSION;
1151
- readonly runtime: typeof REMOTE_DOM_WIDGET_RUNTIME;
1152
- readonly packageId: string;
1153
- readonly source: "company" | "droplet";
1154
- readonly version: string;
1155
- readonly workerEntryUrl: string;
1156
- readonly cssUrls: readonly string[];
1157
- readonly assetUrls: readonly string[];
1158
- readonly widgets: readonly RemoteDomWidgetDefinition[];
1159
- }
1160
- //#endregion
1161
- //#region src/utils/widget-package-validation.d.ts
1162
- type WidgetPackageOwnerKind = "company" | "droplet";
1163
- interface WidgetCapabilityMetadata {
1164
- readonly name: string;
1165
- readonly version?: string;
1166
- }
1167
- interface SourceWidgetMetadata {
1168
- readonly name: string;
1169
- readonly displayName?: string;
1170
- readonly description?: string;
1171
- readonly icon?: string;
1172
- readonly category?: string;
1173
- readonly propertySchema?: JsonObject;
1174
- readonly defaultProps?: JsonObject;
1175
- readonly container?: unknown;
1176
- readonly minSdkVersion?: string;
1177
- readonly resizable?: unknown;
1178
- readonly capabilities?: readonly WidgetCapabilityMetadata[];
1179
- }
1180
- interface SourceWidgetPackageMetadata {
1181
- readonly manifestVersion?: number;
1182
- readonly scope?: string;
1183
- readonly packageStableId?: string;
1184
- readonly packageId: string;
1185
- readonly packageType?: string;
1186
- readonly version: string;
1187
- readonly widgets: readonly SourceWidgetMetadata[];
1188
- readonly cssUrls?: readonly string[];
1189
- }
1190
- interface WidgetDescriptorMetadata extends RemoteDomWidgetDefinition {
1191
- readonly name: string;
1192
- }
1193
- declare const WIDGET_PACKAGE_ARTIFACT_PATH: unique symbol;
1194
- /** A package-local artifact path written into the uploaded manifest. */
1195
- type WidgetPackageArtifactPath = string & {
1196
- readonly [WIDGET_PACKAGE_ARTIFACT_PATH]: true;
1197
- };
1198
- /**
1199
- * Upload-time manifest whose artifact references are package-local paths.
1200
- *
1201
- * This is deliberately distinct from RemoteDomWidgetPackageDescriptor, whose
1202
- * catalog-facing artifact fields must already be resolved to absolute URLs.
1203
- */
1204
- interface WidgetPackagePublishManifest {
1205
- readonly manifestVersion: 1;
1206
- readonly runtime: "remote-dom";
1207
- readonly packageId: string;
1208
- readonly source: WidgetPackageOwnerKind;
1209
- readonly version: string;
1210
- readonly workerEntryUrl: WidgetPackageArtifactPath;
1211
- readonly cssUrls: readonly WidgetPackageArtifactPath[];
1212
- readonly assetUrls: readonly WidgetPackageArtifactPath[];
1213
- readonly widgets: readonly RemoteDomWidgetDefinition[];
1214
- }
1215
- interface ValidatedWidgetPackageBuild {
1216
- readonly sourcePackage: SourceWidgetPackageMetadata;
1217
- readonly packageKey: string;
1218
- readonly packageId: string;
1219
- readonly owner: WidgetPackageOwnerKind;
1220
- readonly version: string;
1221
- readonly widgets: readonly WidgetDescriptorMetadata[];
1222
- }
1223
- type WidgetPackageValidationErrorCode = "NO_SOURCE_PACKAGE" | "MULTIPLE_SOURCE_PACKAGES" | "INVALID_SOURCE_PACKAGE" | "INVALID_WIDGET_METADATA" | "UNSUPPORTED_OWNER" | "INVALID_PACKAGE_KEY" | "INVALID_VERSION" | "NO_WIDGETS" | "INVALID_WIDGET_NAME" | "INVALID_WIDGET_TYPE" | "DUPLICATE_WIDGET";
1224
- interface WidgetPackageValidationError {
1225
- readonly code: WidgetPackageValidationErrorCode;
1226
- readonly message: string;
1227
- readonly path?: string;
1228
- }
1229
- interface WidgetPackageValidationResult {
1230
- readonly success: boolean;
1231
- readonly value?: ValidatedWidgetPackageBuild;
1232
- readonly errors: readonly WidgetPackageValidationError[];
1233
- }
1234
- interface ValidateSourceWidgetPackageOptions {
1235
- readonly owner?: WidgetPackageOwnerKind;
1236
- }
1237
- declare function validateSingleSourceWidgetPackage(sourcePackages: readonly unknown[], options?: ValidateSourceWidgetPackageOptions): WidgetPackageValidationResult;
1238
- declare function buildWidgetPackagePublishManifest(validated: ValidatedWidgetPackageBuild, options?: {
1239
- readonly cssUrls?: readonly string[];
1240
- }): WidgetPackagePublishManifest;
1241
- //#endregion
1242
- //#region src/utils/widget-package-builder.d.ts
1243
- interface BuildSharedWidgetPackageOptions {
1244
- readonly projectDir: string;
1245
- readonly publishDir?: string;
1246
- readonly owner?: WidgetPackageOwnerKind;
1247
- }
1248
- interface SharedWidgetPackageBuildResult {
1249
- readonly publishDir: string;
1250
- readonly packageId: string;
1251
- readonly version: string;
1252
- readonly manifestPath: string;
1253
- readonly publishManifestPath: string;
1254
- readonly widgetScriptPath: string;
1255
- }
1256
- interface SharedWidgetPackageBuildError {
1257
- readonly code: "CONFIG_LOAD_FAILED" | "VALIDATION_FAILED" | "INVALID_PUBLISH_DIR" | "WRITE_FAILED";
1258
- readonly message: string;
1259
- readonly details?: string;
1260
- }
1261
- declare function buildSharedWidgetPackage(options: BuildSharedWidgetPackageOptions): Promise<Result<SharedWidgetPackageBuildResult, SharedWidgetPackageBuildError>>;
1262
- declare function createWidgetPackageEntrySource(options: {
1263
- readonly configImportPath: string;
1264
- readonly cssImportPath?: string;
1265
- readonly validated: ValidatedWidgetPackageBuild;
1266
- }): string;
1267
- //#endregion
1268
- //#region src/utils/widget-package-config.d.ts
1269
- interface WidgetSourceConfig {
1270
- readonly path: string;
1271
- readonly relativePath: string;
1272
- }
1273
- interface WidgetSourceConfigLoadError {
1274
- readonly code: "CONFIG_LOAD_FAILED" | "INVALID_FORMAT";
1275
- readonly message: string;
1276
- readonly details?: string;
1277
- }
1278
- declare function resolvePortalWidgetSourceConfig(projectDir: string): Promise<WidgetSourceConfig | undefined>;
1279
- declare function loadSourceWidgetPackages(projectDir: string): Promise<Result<unknown[], WidgetSourceConfigLoadError>>;
1280
- //#endregion
1281
- //#region src/utils/widget-package-artifacts.d.ts
1282
- declare const WIDGET_PACKAGE_BUILDER_VERSION = "1";
1283
- interface ArtifactMetadata {
1284
- readonly path: string;
1285
- readonly sha256: string;
1286
- readonly bytes: number;
1287
- readonly contentType: string;
1288
- }
1289
- interface PublishManifestMetadata {
1290
- readonly packageId: string;
1291
- readonly version: string;
1292
- readonly builderVersion: string;
1293
- readonly cliVersion: string;
1294
- readonly runtimeVersion: string;
1295
- readonly manifestHash: string;
1296
- readonly artifacts: readonly ArtifactMetadata[];
1297
- }
1298
- declare function computeArtifactMetadata(filePath: string, baseDir: string): Promise<ArtifactMetadata>;
1299
- declare function collectWidgetPackageArtifacts(publishDir: string): Promise<ArtifactMetadata[]>;
1300
- declare function createPublishManifestMetadata(options: {
1301
- readonly packageId: string;
1302
- readonly version: string;
1303
- readonly cliVersion: string;
1304
- readonly runtimeVersion: string;
1305
- readonly manifestContent: string | Buffer;
1306
- readonly artifacts: readonly ArtifactMetadata[];
1307
- readonly builderVersion?: string;
1308
- }): PublishManifestMetadata;
1309
- declare function getArtifactContentType(filePath: string): string;
1310
- declare function sha256(content: string | Buffer): string;
1311
- //#endregion
1312
- //#region src/utils/widget-package-upload.d.ts
1313
- type WidgetPackageUploadOwner = {
1314
- readonly kind: "droplet";
1315
- readonly uuid: string;
1316
- } | {
1317
- readonly kind: "company";
1318
- };
1319
- type WidgetPackageArtifactMetadata = ArtifactMetadata;
1320
- interface WidgetPackageUploadArtifact extends WidgetPackageArtifactMetadata {
1321
- readonly body: BodyInit;
1322
- }
1323
- interface WidgetPackageSessionRequest {
1324
- readonly version: string;
1325
- readonly packageKey: string;
1326
- readonly builderVersion: string;
1327
- readonly cliVersion: string;
1328
- readonly runtimeVersion: string;
1329
- readonly manifestHash: string;
1330
- readonly manifest: Record<string, unknown>;
1331
- readonly artifacts: readonly WidgetPackageArtifactMetadata[];
1332
- }
1333
- interface WidgetPackagePublishRequest extends Omit<WidgetPackageSessionRequest, "artifacts"> {
1334
- readonly artifacts: readonly WidgetPackageUploadArtifact[];
1335
- }
1336
- type WidgetPackageArtifactPayload = ArtifactMetadata;
1337
- interface WidgetPackageUploadSessionPayload {
1338
- readonly version: string;
1339
- readonly package_key: string;
1340
- readonly builder_version: string;
1341
- readonly cli_version: string;
1342
- readonly runtime_version: string;
1343
- readonly manifest_hash: string;
1344
- readonly manifest: Record<string, unknown>;
1345
- readonly artifacts: readonly WidgetPackageArtifactPayload[];
1346
- }
1347
- interface WidgetPackageCompleteUploadPayload {
1348
- readonly package_key: string;
1349
- readonly artifacts: readonly WidgetPackageArtifactPayload[];
1350
- }
1351
- interface WidgetPackageSignedUpload {
1352
- readonly path: string;
1353
- readonly url: string;
1354
- readonly contentType: string;
1355
- readonly headers: Readonly<Record<string, string>>;
1356
- }
1357
- interface WidgetPackageUploadSession {
1358
- readonly version: string;
1359
- readonly uploads: readonly WidgetPackageSignedUpload[];
1360
- readonly raw: unknown;
1361
- }
1362
- interface WidgetPackageArtifactUploadResult {
1363
- readonly path: string;
1364
- readonly status: number;
1365
- readonly contentType: string;
1366
- }
1367
- interface WidgetPackageCompleteResult {
1368
- readonly version: string;
1369
- readonly status?: string;
1370
- readonly packageKey?: string;
1371
- readonly raw: unknown;
1372
- }
1373
- interface WidgetPackagePublishResult {
1374
- readonly dryRun: boolean;
1375
- readonly sessionPayload: WidgetPackageUploadSessionPayload;
1376
- readonly session?: WidgetPackageUploadSession;
1377
- readonly uploadedArtifacts?: readonly WidgetPackageArtifactUploadResult[];
1378
- readonly complete?: WidgetPackageCompleteResult;
1379
- }
1380
- interface BasePublishWidgetPackageVersionOptions {
1381
- readonly owner: WidgetPackageUploadOwner;
1382
- readonly request: WidgetPackagePublishRequest;
1383
- readonly fetchImpl?: WidgetPackageUploadFetch;
1384
- }
1385
- interface DryRunPublishWidgetPackageVersionOptions extends BasePublishWidgetPackageVersionOptions {
1386
- readonly client?: FetchClient;
1387
- readonly dryRun: true;
1388
- }
1389
- interface PublishWidgetPackageVersionUploadOptions extends BasePublishWidgetPackageVersionOptions {
1390
- readonly client: FetchClient;
1391
- readonly dryRun?: boolean;
1392
- }
1393
- type PublishWidgetPackageVersionOptions = DryRunPublishWidgetPackageVersionOptions | PublishWidgetPackageVersionUploadOptions;
1394
- type WidgetPackageUploadFetch = (input: string | URL, init: RequestInit) => Promise<Response>;
1395
- declare class WidgetPackageUploadError extends Error {
1396
- readonly code: string;
1397
- constructor(code: string, message: string);
1398
- }
1399
- declare function buildWidgetPackageUploadSessionPayload(request: WidgetPackageSessionRequest): WidgetPackageUploadSessionPayload;
1400
- declare function buildWidgetPackageCompleteUploadPayload(packageKey: string, artifacts: readonly WidgetPackageArtifactMetadata[]): WidgetPackageCompleteUploadPayload;
1401
- declare function getWidgetPackageUploadSessionRoute(owner: WidgetPackageUploadOwner): string;
1402
- declare function getWidgetPackageCompleteUploadRoute(owner: WidgetPackageUploadOwner, version: string): string;
1403
- declare function requestWidgetPackageUploadSession(client: FetchClient, owner: WidgetPackageUploadOwner, request: WidgetPackageSessionRequest): Promise<WidgetPackageUploadSession>;
1404
- declare function uploadWidgetPackageArtifacts(session: WidgetPackageUploadSession, artifacts: readonly WidgetPackageUploadArtifact[], fetchImpl?: WidgetPackageUploadFetch): Promise<WidgetPackageArtifactUploadResult[]>;
1405
- declare function completeWidgetPackageUpload(client: FetchClient, owner: WidgetPackageUploadOwner, version: string, packageKey: string, artifacts: readonly WidgetPackageArtifactMetadata[]): Promise<WidgetPackageCompleteResult>;
1406
- declare function publishWidgetPackageVersion(options: PublishWidgetPackageVersionOptions): Promise<WidgetPackagePublishResult>;
1407
- declare function normalizeWidgetPackageUploadSession(response: unknown, requestedVersion: string, requestedArtifacts: readonly WidgetPackageArtifactMetadata[]): WidgetPackageUploadSession;
1408
- declare function normalizeWidgetPackageCompleteResponse(response: unknown, requestedVersion: string): WidgetPackageCompleteResult;
1409
- //#endregion
1410
- //#region src/commands/widget-package-publish.d.ts
1411
- interface PublishWidgetRuntimeArtifactsOptions {
1412
- readonly projectDir: string;
1413
- readonly outDir: string;
1414
- readonly buildOwner: WidgetPackageOwnerKind;
1415
- readonly uploadOwner: WidgetPackageUploadOwner;
1416
- readonly dryRun?: boolean;
1417
- readonly client?: FetchClient;
1418
- }
1419
- interface PublishWidgetRuntimeArtifactsResult {
1420
- readonly build: SharedWidgetPackageBuildResult;
1421
- readonly request: WidgetPackagePublishRequest;
1422
- readonly publish: WidgetPackagePublishResult;
1423
- }
1424
- interface PublishWidgetRuntimeArtifactsDependencies {
1425
- readonly buildSharedWidgetPackage?: typeof buildSharedWidgetPackage;
1426
- readonly publishWidgetPackageVersion?: typeof publishWidgetPackageVersion;
1427
- }
1428
- declare function publishWidgetRuntimeArtifacts(options: PublishWidgetRuntimeArtifactsOptions, dependencies?: PublishWidgetRuntimeArtifactsDependencies): Promise<PublishWidgetRuntimeArtifactsResult>;
1429
- declare function createWidgetPackagePublishRequest(options: {
1430
- readonly publishDir: string;
1431
- readonly manifestPath: string;
1432
- readonly publishManifestPath: string;
1433
- readonly owner: WidgetPackageOwnerKind;
1434
- }): Promise<WidgetPackagePublishRequest>;
1435
- declare function createAuthenticatedWidgetPackageClient(): FetchClient;
1436
- declare function printWidgetPublishSummary(options: {
1437
- readonly title: string;
1438
- readonly ownerLabel: string;
1439
- readonly environment?: string;
1440
- readonly outDir: string;
1441
- readonly result: PublishWidgetRuntimeArtifactsResult;
1442
- }): void;
1443
- declare function printRuntimeOnlyNotice(): void;
1444
- declare function printDryRunSessionPayload(result: PublishWidgetRuntimeArtifactsResult): void;
1445
- declare function validateWidgetPublishOutDir(projectDir: string, outDir: string): string;
1446
- //#endregion
1447
1162
  //#region src/index.d.ts
1448
1163
  declare const plugin: FluidPlugin;
1449
1164
  //#endregion
1450
- export { type ArtifactMetadata, type BuildOptions, type BuildSharedWidgetPackageOptions, CANONICAL_PROJECT_NAME, type CategorizedChanges, type CreateOptions, type CreatePortalGitCredentialOptions, type CreatePortalProjectDependencies, type DefinitionMapping, type DevOptions, FILE_SYSTEM_ERRORS, type FileHash, type FileHashMap, type FileSystemError, type FileSystemErrorCode, type GitCredentialOutcome, GitError, type LocalNavigation, type LocalNavigationItem, type LocalProfile, type LocalScreen, type LocalTheme, type MappedResourceType, type PortalDeployOptions, type PortalGitCredential, type PortalGitSyncOptions, type PortalGitSyncResult, type PortalMappings, type ProjectConfig, type PublishManifestMetadata, type PublishWidgetPackageVersionOptions, type PublishWidgetRuntimeArtifactsDependencies, type PublishWidgetRuntimeArtifactsOptions, type PublishWidgetRuntimeArtifactsResult, type RemoteDomWidgetPackageDescriptor, type ScaffoldFromGitHubOptions, type SelectedPageTemplate, type SharedWidgetPackageBuildError, type SharedWidgetPackageBuildResult, type Snapshot, type SnapshotDiff, type SourceWidgetMetadata, type SourceWidgetPackageMetadata, TEMPLATES, TEMPLATE_REPO_URL, type TemplateName, type TemplatePaths, type TemplateVariables, type ValidateSourceWidgetPackageOptions, type ValidatedWidgetPackageBuild, type ValidationError, WIDGET_PACKAGE_BUILDER_VERSION, type WidgetCreateOptions, type WidgetDescriptorMetadata, type WidgetPackageArtifactMetadata, type WidgetPackageArtifactPath, type WidgetPackageArtifactPayload, type WidgetPackageArtifactUploadResult, type WidgetPackageCompleteResult, type WidgetPackageCompleteUploadPayload, type WidgetPackageOwnerKind, type WidgetPackagePublishManifest, type WidgetPackagePublishRequest, type WidgetPackagePublishResult, type WidgetPackageSessionRequest, type WidgetPackageSignedUpload, type WidgetPackageUploadArtifact, WidgetPackageUploadError, type WidgetPackageUploadFetch, type WidgetPackageUploadOwner, type WidgetPackageUploadSession, type WidgetPackageUploadSessionPayload, type WidgetPackageValidationError, type WidgetPackageValidationErrorCode, type WidgetPackageValidationResult, type WidgetPublishOptions, type WidgetSourceConfig, type WidgetSourceConfigLoadError, buildIdToSlugMap, buildNavigationIdToSlugMap, buildSharedWidgetPackage, buildSnapshot, buildThemeIdToSlugMap, buildWidgetPackageCompleteUploadPayload, buildWidgetPackagePublishManifest, buildWidgetPackageUploadSessionPayload, categorizeChanges, cloneCommand, collectWidgetPackageArtifacts, completeWidgetPackageUpload, computeArtifactMetadata, computeFileHash, copyTemplate, copyTemplateSafe, createAuthenticatedWidgetPackageClient, createCommand, createDirectory, createDirectorySafe, createPortalGitCredential, createPortalProject, createPublishManifestMetadata, createWidgetPackageEntrySource, createWidgetPackagePublishRequest, plugin as default, deployCommand, deriveScreenSlug, deriveSlug, diffAgainstSnapshot, directoryExists, doctorCommand, ensureGitAvailable, fileExists, getArtifactContentType, getInstallCommand, getOriginUrl, getRunCommand, getSdkVersion, getSdkVersionSafe, getTemplatePaths, getWidgetPackageCompleteUploadRoute, getWidgetPackageUploadSessionRoute, gitAheadBehindVsFetchHead, gitAutoCommit, gitClone, gitFetch, gitInit, gitMergeFastForward, gitMissingError, gitPush, hasUncommittedChanges, installDependencies, isGitAvailable, isGitRepo, loadSourceWidgetPackages, normalizeWidgetPackageCompleteResponse, normalizeWidgetPackageUploadSession, pathExists, portalGitCredentialPath, printDryRunSessionPayload, printRuntimeOnlyNotice, printWidgetPublishSummary, promptProjectConfig, publishWidgetPackageVersion, publishWidgetRuntimeArtifacts, pullCommand, pushCommand, readFileSafe, readMappings, readSnapshot, removeMapping, requestWidgetPackageUploadSession, resolveIdToSlug, resolvePortalWidgetSourceConfig, resolveSlugToId, rewriteProjectName, runPackageManager, runPortalGitSync, scaffoldFromGitHub, sha256, slugFromPath, topLevelWidgetCommand, transformNavigation, transformNavigationItems, transformProfile, transformScreen, transformTheme, updateMapping, uploadWidgetPackageArtifacts, validateCrossReferences, validateSingleSourceWidgetPackage, validateWidgetPublishOutDir, versionCommand, widgetCommand, writeFileSafe, writeFluidrcProfile, writeMappings, writeSnapshot };
1165
+ export { type BuildOptions, CANONICAL_PROJECT_NAME, type CategorizedChanges, type CreateOptions, type CreatePortalGitCredentialOptions, type CreatePortalProjectDependencies, type DefinitionMapping, type DevOptions, FILE_SYSTEM_ERRORS, type FileHash, type FileHashMap, type FileSystemError, type FileSystemErrorCode, type GitCredentialOutcome, GitError, type LocalNavigation, type LocalNavigationItem, type LocalProfile, type LocalScreen, type LocalTheme, type MappedResourceType, type PortalDeployOptions, type PortalGitCredential, type PortalGitSyncOptions, type PortalGitSyncResult, type PortalMappings, type ProjectConfig, type ScaffoldFromGitHubOptions, type SelectedPageTemplate, type Snapshot, type SnapshotDiff, TEMPLATES, TEMPLATE_REPO_URL, type TemplateName, type TemplatePaths, type TemplateVariables, type ValidationError, type WidgetCreateOptions, type WidgetPublishOptions, buildIdToSlugMap, buildNavigationIdToSlugMap, buildSnapshot, buildThemeIdToSlugMap, categorizeChanges, cloneCommand, computeFileHash, copyTemplate, copyTemplateSafe, createCommand, createDirectory, createDirectorySafe, createPortalGitCredential, createPortalProject, plugin as default, deployCommand, deriveScreenSlug, deriveSlug, diffAgainstSnapshot, directoryExists, doctorCommand, ensureGitAvailable, fileExists, getInstallCommand, getOriginUrl, getRunCommand, getSdkVersion, getSdkVersionSafe, getTemplatePaths, gitAheadBehindVsFetchHead, gitAutoCommit, gitClone, gitFetch, gitInit, gitMergeFastForward, gitMissingError, gitPush, hasUncommittedChanges, installDependencies, isGitAvailable, isGitRepo, pathExists, portalGitCredentialPath, promptProjectConfig, pullCommand, pushCommand, readFileSafe, readMappings, readSnapshot, removeMapping, resolveIdToSlug, resolveSlugToId, rewriteProjectName, runPackageManager, runPortalGitSync, scaffoldFromGitHub, slugFromPath, topLevelWidgetCommand, transformNavigation, transformNavigationItems, transformProfile, transformScreen, transformTheme, updateMapping, validateCrossReferences, versionCommand, widgetCommand, writeFileSafe, writeFluidrcProfile, writeMappings, writeSnapshot };
1451
1166
  //# sourceMappingURL=index.d.mts.map