@powerhousedao/shared 6.2.3-dev.77 → 6.2.3-dev.79
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/action-id-DON1WCeY.d.ts +19 -0
- package/dist/action-id-DON1WCeY.d.ts.map +1 -0
- package/dist/clis/args/{access-token-3Hqv_U8I.mjs → access-token-D28cJ6Ov.mjs} +2 -2
- package/dist/clis/args/{access-token-3Hqv_U8I.mjs.map → access-token-D28cJ6Ov.mjs.map} +1 -1
- package/dist/clis/args/access-token.mjs +1 -1
- package/dist/clis/args/{common-BXabdhiO.mjs → common-CHSGBvxM.mjs} +29 -5
- package/dist/clis/args/common-CHSGBvxM.mjs.map +1 -0
- package/dist/clis/args/common.mjs +1 -1
- package/dist/clis/args/{connect-Bad05YS-.mjs → connect-CmErgUlp.mjs} +2 -2
- package/dist/clis/args/{connect-Bad05YS-.mjs.map → connect-CmErgUlp.mjs.map} +1 -1
- package/dist/clis/args/connect.mjs +1 -1
- package/dist/clis/args/{generate-BOItUNvP.mjs → generate-DLPqkD9L.mjs} +2 -2
- package/dist/clis/args/{generate-BOItUNvP.mjs.map → generate-DLPqkD9L.mjs.map} +1 -1
- package/dist/clis/args/generate.mjs +1 -1
- package/dist/clis/args/{help-QVFzsXQl.mjs → help-B16JXhxy.mjs} +25 -17
- package/dist/clis/args/help-B16JXhxy.mjs.map +1 -0
- package/dist/clis/args/{help-BeKM3Nce.d.mts → help-CmnOv3z3.d.mts} +14 -2
- package/dist/clis/args/help-CmnOv3z3.d.mts.map +1 -0
- package/dist/clis/args/help.d.mts +1 -1
- package/dist/clis/args/help.mjs +1 -1
- package/dist/clis/args/{host-Dzd_py0N.mjs → host-BRXA3WP5.mjs} +14 -2
- package/dist/clis/args/host-BRXA3WP5.mjs.map +1 -0
- package/dist/clis/args/{host-CblNFF4o.d.mts → host-BX7KQ0Fp.d.mts} +10 -2
- package/dist/clis/args/host-BX7KQ0Fp.d.mts.map +1 -0
- package/dist/clis/args/host.d.mts +2 -2
- package/dist/clis/args/host.mjs +2 -2
- package/dist/clis/args/index.d.mts +5 -4
- package/dist/clis/args/index.mjs +21 -20
- package/dist/clis/args/{init-xlCNZ8Oe.mjs → init-DYFFSkxI.mjs} +2 -2
- package/dist/clis/args/{init-xlCNZ8Oe.mjs.map → init-DYFFSkxI.mjs.map} +1 -1
- package/dist/clis/args/init.mjs +1 -1
- package/dist/clis/args/{inspect-UNQgtuR0.mjs → inspect-BniSlWn2.mjs} +2 -2
- package/dist/clis/args/{inspect-UNQgtuR0.mjs.map → inspect-BniSlWn2.mjs.map} +1 -1
- package/dist/clis/args/inspect.mjs +1 -1
- package/dist/clis/args/{install-F-27kF6m.mjs → install-sBi-hWv6.mjs} +2 -2
- package/dist/clis/args/{install-F-27kF6m.mjs.map → install-sBi-hWv6.mjs.map} +1 -1
- package/dist/clis/args/install.mjs +1 -1
- package/dist/clis/args/{list-Bkfn8Yuo.mjs → list-DcBHE_2X.mjs} +2 -2
- package/dist/clis/args/{list-Bkfn8Yuo.mjs.map → list-DcBHE_2X.mjs.map} +1 -1
- package/dist/clis/args/list.mjs +1 -1
- package/dist/clis/args/{login-CIFkQExi.mjs → login-C8lWLGqU.mjs} +2 -2
- package/dist/clis/args/{login-CIFkQExi.mjs.map → login-C8lWLGqU.mjs.map} +1 -1
- package/dist/clis/args/login.mjs +1 -1
- package/dist/clis/args/mcp-9ETsMr71.mjs +22 -0
- package/dist/clis/args/mcp-9ETsMr71.mjs.map +1 -0
- package/dist/clis/args/mcp-Cl5PPlkl.d.mts +16 -0
- package/dist/clis/args/mcp-Cl5PPlkl.d.mts.map +1 -0
- package/dist/clis/args/mcp.d.mts +3 -0
- package/dist/clis/args/mcp.mjs +2 -0
- package/dist/clis/args/{migrate-hHLa-0_q.mjs → migrate-39GBHGb-.mjs} +2 -2
- package/dist/clis/args/{migrate-hHLa-0_q.mjs.map → migrate-39GBHGb-.mjs.map} +1 -1
- package/dist/clis/args/migrate.mjs +1 -1
- package/dist/clis/args/{publish-DHqlGWmL.mjs → publish-Rtu9dx7q.mjs} +2 -2
- package/dist/clis/args/{publish-DHqlGWmL.mjs.map → publish-Rtu9dx7q.mjs.map} +1 -1
- package/dist/clis/args/publish.mjs +1 -1
- package/dist/clis/args/{registry-DIwES3l2.mjs → registry-Pt5yN9xS.mjs} +2 -2
- package/dist/clis/args/{registry-DIwES3l2.mjs.map → registry-Pt5yN9xS.mjs.map} +1 -1
- package/dist/clis/args/registry.mjs +1 -1
- package/dist/clis/args/{service-Cpjlyeu5.mjs → service-B3FHLTcp.mjs} +2 -2
- package/dist/clis/args/{service-Cpjlyeu5.mjs.map → service-B3FHLTcp.mjs.map} +1 -1
- package/dist/clis/args/service.mjs +1 -1
- package/dist/clis/args/{switchboard-CCaAtU56.mjs → switchboard-BXLSuEoC.mjs} +3 -3
- package/dist/clis/args/switchboard-BXLSuEoC.mjs.map +1 -0
- package/dist/clis/args/switchboard.mjs +1 -1
- package/dist/clis/args/{uninstall-3U0B8g5c.mjs → uninstall-ChFF846g.mjs} +2 -2
- package/dist/clis/args/{uninstall-3U0B8g5c.mjs.map → uninstall-ChFF846g.mjs.map} +1 -1
- package/dist/clis/args/uninstall.mjs +1 -1
- package/dist/clis/args/{unpublish-s9zUh6Gw.mjs → unpublish-MW7IKVH6.mjs} +2 -2
- package/dist/clis/args/{unpublish-s9zUh6Gw.mjs.map → unpublish-MW7IKVH6.mjs.map} +1 -1
- package/dist/clis/args/unpublish.mjs +1 -1
- package/dist/clis/args/{vetra-DkDaWFPi.d.mts → vetra-CviuwTcH.d.mts} +4 -1
- package/dist/clis/args/vetra-CviuwTcH.d.mts.map +1 -0
- package/dist/clis/args/{vetra-BCOpgM59.mjs → vetra-F4zGu_hG.mjs} +11 -2
- package/dist/clis/args/vetra-F4zGu_hG.mjs.map +1 -0
- package/dist/clis/args/vetra.d.mts +1 -1
- package/dist/clis/args/vetra.mjs +1 -1
- package/dist/clis/build-pieces.d.mts +1 -1
- package/dist/clis/command-names.d.mts +1 -1
- package/dist/clis/command-names.d.mts.map +1 -1
- package/dist/clis/command-names.mjs +1 -0
- package/dist/clis/command-names.mjs.map +1 -1
- package/dist/clis/constants.d.mts +2 -2
- package/dist/clis/constants.mjs +32 -9
- package/dist/clis/constants.mjs.map +1 -1
- package/dist/clis/index.d.mts +60 -7
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +90 -11
- package/dist/clis/index.mjs.map +1 -1
- package/dist/clis/project-env.d.mts +3 -0
- package/dist/clis/project-env.d.mts.map +1 -1
- package/dist/clis/project-env.mjs +9 -1
- package/dist/clis/project-env.mjs.map +1 -1
- package/dist/clis/{types-BNdhWTBs.d.mts → types-BKM2kIEW.d.mts} +37 -10
- package/dist/clis/types-BKM2kIEW.d.mts.map +1 -0
- package/dist/{config-loader-BWt0c0eU.js → config-loader-B7SqNz8z.js} +3 -2
- package/dist/config-loader-B7SqNz8z.js.map +1 -0
- package/dist/connect/config-loader.d.ts +1 -1
- package/dist/connect/config-loader.js +1 -1
- package/dist/connect/connect-config-schema.d.ts +1 -1
- package/dist/connect/connect-config-schema.js +4 -0
- package/dist/connect/connect-config-schema.js.map +1 -1
- package/dist/connect/index.d.ts +8 -2
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +13 -2
- package/dist/connect/index.js.map +1 -1
- package/dist/{connect-config-schema-1-O1CQ4v.d.ts → connect-config-schema-hSe_84zI.d.ts} +6 -1
- package/dist/connect-config-schema-hSe_84zI.d.ts.map +1 -0
- package/dist/constants-4Y5b-joA.d.ts +9 -0
- package/dist/constants-4Y5b-joA.d.ts.map +1 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/document-drive/index.d.ts +3 -3
- package/dist/document-drive/index.js +1 -1
- package/dist/document-model/action-id.d.ts +3 -0
- package/dist/document-model/action-id.js +59 -0
- package/dist/document-model/action-id.js.map +1 -0
- package/dist/document-model/dispatch.d.ts +25 -0
- package/dist/document-model/dispatch.d.ts.map +1 -0
- package/dist/document-model/dispatch.js +0 -0
- package/dist/document-model/errors.d.ts +1 -1
- package/dist/document-model/index.d.ts +4 -2
- package/dist/document-model/index.js +4 -5047
- package/dist/document-model/utils.d.ts +2 -1
- package/dist/document-model/utils.js +2 -1
- package/dist/document-model-D8Z3NUYl.js +5202 -0
- package/dist/document-model-D8Z3NUYl.js.map +1 -0
- package/dist/{index-69rWzMmt.d.ts → index-BzueQ7B3.d.ts} +2 -2
- package/dist/{index-69rWzMmt.d.ts.map → index-BzueQ7B3.d.ts.map} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/processors/index.d.ts +2 -2
- package/dist/processors/index.js +121 -77
- package/dist/processors/index.js.map +1 -1
- package/dist/processors/testing.d.ts +22 -0
- package/dist/processors/testing.d.ts.map +1 -0
- package/dist/processors/testing.js +77 -0
- package/dist/processors/testing.js.map +1 -0
- package/dist/{purge-v06m_oGz.js → purge-YMJM0Vl7.js} +25 -4
- package/dist/{purge-v06m_oGz.js.map → purge-YMJM0Vl7.js.map} +1 -1
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js +28 -4
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/manifest-slim.d.ts +2 -2
- package/dist/{types-NkUDXG7c.d.ts → types-B1HqOXqL.d.ts} +178 -57
- package/dist/types-B1HqOXqL.d.ts.map +1 -0
- package/dist/{types-B5-IgDft.d.ts → types-BoYyqmJ2.d.ts} +2 -2
- package/dist/{types-B5-IgDft.d.ts.map → types-BoYyqmJ2.d.ts.map} +1 -1
- package/dist/utils-BrKxCmKx.d.ts.map +1 -1
- package/dist/utils-CSF716ux.js.map +1 -1
- package/dist/utils-MrLmLEVr.js +78 -0
- package/dist/utils-MrLmLEVr.js.map +1 -0
- package/package.json +7 -1
- package/dist/clis/args/common-BXabdhiO.mjs.map +0 -1
- package/dist/clis/args/help-BeKM3Nce.d.mts.map +0 -1
- package/dist/clis/args/help-QVFzsXQl.mjs.map +0 -1
- package/dist/clis/args/host-CblNFF4o.d.mts.map +0 -1
- package/dist/clis/args/host-Dzd_py0N.mjs.map +0 -1
- package/dist/clis/args/switchboard-CCaAtU56.mjs.map +0 -1
- package/dist/clis/args/vetra-BCOpgM59.mjs.map +0 -1
- package/dist/clis/args/vetra-DkDaWFPi.d.mts.map +0 -1
- package/dist/clis/types-BNdhWTBs.d.mts.map +0 -1
- package/dist/config-loader-BWt0c0eU.js.map +0 -1
- package/dist/connect-config-schema-1-O1CQ4v.d.ts.map +0 -1
- package/dist/constants-CcaK3k1D.d.ts +0 -9
- package/dist/constants-CcaK3k1D.d.ts.map +0 -1
- package/dist/document-model/index.js.map +0 -1
- package/dist/types-NkUDXG7c.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./types-
|
|
1
|
+
import "./types-BoYyqmJ2.js";
|
|
2
2
|
import { SignaturePolicy } from "@powerhousedao/shared/document-model";
|
|
3
3
|
import { DocumentDriveLocalState, Node } from "@powerhousedao/shared/document-drive";
|
|
4
4
|
//#region document-drive/src/types.d.ts
|
|
@@ -33,4 +33,4 @@ declare function shortGitSha(sha: string): string;
|
|
|
33
33
|
//#endregion
|
|
34
34
|
export { GenerateNodesCopyIdGenerator as a, DriveInput as i, buildTreeUrl as n, GenerateNodesCopySrc as o, shortGitSha as r, SharingType as s, GITHUB_REPO_URL as t };
|
|
35
35
|
export {};
|
|
36
|
-
//# sourceMappingURL=index-
|
|
36
|
+
//# sourceMappingURL=index-BzueQ7B3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-BzueQ7B3.d.ts","names":[],"sources":["../document-drive/src/types.ts","../git.ts"],"mappings":";;;;KAMY;EACV,OAAO;EACP,aAAa;EACb,qBAAqB;;KAGX,gCAAgC,YAAY,SAAS;KAErD;EACV;IACE;IACA;;EAEF;EACA;EACA;EACA,QAAQ,QAAQ;;EAEhB;KAAsB;;;EAEtB,kBAAkB;;KAGR;;;cC7BC;iBAEG,aAAa;iBAKb,YAAY"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as AnalyticsSeriesInput, c as CompoundAnalyticsExpression, d as ConversionMetric, f as IAnalyticsStore, i as AnalyticsSeries, l as CompoundAnalyticsInputs, n as AnalyticsOperand, o as AnalyticsSeriesQuery, p as MultiCurrencyConversion, r as AnalyticsQuery, s as AnalyticsUpdateCallback, t as AnalyticsDimension, u as CompoundAnalyticsQuery } from "./types-Bsp8VL2y.js";
|
|
2
|
-
import { $ as ServiceActions, $a as
|
|
3
|
-
import { i as PACKAGES_DEPENDENCIES, n as APPS_DEPENDENCIES, r as CLIS_DEPENDENCIES, t as ALL_POWERHOUSE_DEPENDENCIES } from "./constants-
|
|
4
|
-
import { $ as LegacySynchronizationUnit, A as TriggerData, B as PackagePage, C as RemoveTriggerInput, D as SetSharingTypeInput, E as SetDriveNameInput, F as PACKAGE_MODULE_TYPES, G as RegistryPackageSource, H as RegistryPackage, I as PackageFacets, J as DriveDocumentModelModule, K as RegistryPackageStatus, L as PackageInfo, M as TriggerType, N as UpdateFileInput, O as TransmitterType, P as UpdateNodeInput, Q as LegacyAddFileInput, R as PackageListItem, S as RemoveListenerInput, T as SetDriveIconInput, U as RegistryPackageList, V as Page, W as RegistryPackageMap, X as DocumentDriveDocument, Y as DocumentDriveAction, Z as LegacyAddFileAction, _ as ListenerInput, _t as SetDriveNameAction, a as CopyNodeInput, at as DocumentDriveNodeOperations, b as PullResponderTriggerData, c as DocumentDriveLocalState, ct as UpdateNodeAction, d as FolderNode, dt as DocumentDriveDriveAction, et as AddFileAction, f as Listener, ft as DocumentDriveDriveOperations, g as ListenerFilterInput, gt as SetDriveIconAction, h as ListenerFilter, ht as SetAvailableOfflineAction, i as AddTriggerInput, it as DocumentDriveNodeAction, j as TriggerInput, k as Trigger, lt as AddListenerAction, m as ListenerCallInfoInput, mt as RemoveTriggerAction, n as AddFolderInput, nt as CopyNodeAction, o as DeleteNodeInput, ot as MoveNodeAction, p as ListenerCallInfo, pt as RemoveListenerAction, q as DocumentDrivePHState, r as AddListenerInput, rt as DeleteNodeAction, s as DocumentDriveGlobalState, st as UpdateFileAction, t as AddFileInput, tt as AddFolderAction, u as FileNode, ut as AddTriggerAction, v as MoveNodeInput, vt as SetSharingTypeAction, w as SetAvailableOfflineInput, x as PullResponderTriggerDataInput, y as Node, z as PackageModuleType } from "./types-
|
|
5
|
-
import { a as GenerateNodesCopyIdGenerator, i as DriveInput, n as buildTreeUrl, o as GenerateNodesCopySrc, r as shortGitSha, s as SharingType, t as GITHUB_REPO_URL } from "./index-
|
|
6
|
-
export { ALL_POWERHOUSE_DEPENDENCIES, APPS_DEPENDENCIES, type ActionErrorCallback, type ActionSignatureContext, type ActionSigningHandler, type ActionVerificationHandler, type Actions, type AddChangeLogItemAction, type AddChangeLogItemInput, type AddFileAction, type AddFileInput, type AddFolderAction, type AddFolderInput, type AddListenerAction, type AddListenerInput, type AddModuleAction, type AddModuleInput, type AddOperationAction, type AddOperationErrorAction, type AddOperationErrorInput, type AddOperationExampleAction, type AddOperationExampleInput, type AddOperationInput, type AddRelationshipAction, type AddRelationshipActionInput, type AddStateExampleAction, type AddStateExampleInput, type AddTriggerAction, type AddTriggerInput, type AnalyticsDimension, type AnalyticsOperand, type AnalyticsQuery, type AnalyticsSeries, type AnalyticsSeriesInput, type AnalyticsSeriesQuery, type AnalyticsUpdateCallback, type AssertIsDocumentOfType, type AssertIsStateOfType, type Author, CLIS_DEPENDENCIES, type CodeExample, type CompoundAnalyticsExpression, type CompoundAnalyticsInputs, type CompoundAnalyticsQuery, type ConfigEntry, type ConfigEntryType, type ConversionMetric, type CopyChildDocumentInput, type CopyChildDocumentSignal, type CopyNodeAction, type CopyNodeInput, type CreateChildDocumentInput, type CreateChildDocumentSignal, type CreateDocument, type CreateDocumentAction, type CreateDocumentActionInput, type CreateState, type DeleteChangeLogItemAction, type DeleteChangeLogItemInput, type DeleteChildDocumentInput, type DeleteChildDocumentSignal, type DeleteDocumentAction, type DeleteDocumentActionInput, type DeleteModuleAction, type DeleteModuleInput, type DeleteNodeAction, type DeleteNodeInput, type DeleteOperationAction, type DeleteOperationErrorAction, type DeleteOperationErrorInput, type DeleteOperationExampleAction, type DeleteOperationExampleInput, type DeleteOperationInput, type DeleteStateExampleAction, type DeleteStateExampleInput, type DocumentAction, type DocumentDispatch, type DocumentDriveAction, type DocumentDriveDocument, type DocumentDriveDriveAction, type DocumentDriveDriveOperations, type DocumentDriveGlobalState, type DocumentDriveLocalState, type DocumentDriveNodeAction, type DocumentDriveNodeOperations, type DocumentDrivePHState, type DocumentModelAction, type DocumentModelDocument, type DocumentModelDocumentModelModule, type DocumentModelGlobalState, type DocumentModelHeaderAction, type DocumentModelHeaderOperations, type DocumentModelInput, type DocumentModelLib, type DocumentModelLocalState, type DocumentModelModule, type DocumentModelModuleAction, type DocumentModelModuleOperations, type DocumentModelOperationAction, type DocumentModelOperationErrorAction, type DocumentModelOperationErrorOperations, type DocumentModelOperationExampleAction, type DocumentModelOperationExampleOperations, type DocumentModelOperationOperations, type DocumentModelPHState, type DocumentModelStateAction, type DocumentModelStateOperations, type DocumentModelUtils, type DocumentModelVersioningAction, type DocumentModelVersioningOperations, type DocumentOperationsIgnoreMap, type DocumentSpecification, type DriveDocumentModelModule, type DriveInput, type DrivePreserveStrategies, type DrivePreserveStrategy, type ENSInfo, type EditorDispatch, type EditorModule, type EditorProps, type Exact, type FileInput, type FileNode, type FolderNode, GITHUB_REPO_URL, type GenerateNodesCopyIdGenerator, type GenerateNodesCopySrc, type GetDocumentOptions, type HostedEditorProps, type IAction, type IAnalyticsStore, type ID, type IDocument, type IOperation, type IProcessor, type IProcessorDispatch, type IProcessorHostModuleBase, type IProcessorManager, type ISignal, type ISignalResult, type ISigner, type Incremental, type InputMaybe, type IsDocumentOfType, type IsStateOfType, type LegacyAddFileAction, type LegacyAddFileInput, type LegacySynchronizationUnit, type Listener, type ListenerCallInfo, type ListenerCallInfoInput, type ListenerFilter, type ListenerFilterInput, type ListenerInput, type LoadFromFile, type LoadFromInput, type LogLevel, type LogLevels, type MakeEmpty, type MakeMaybe, type MakeOptional, type Manifest, type MappedOperation, type Maybe, type MinimalBackupData, type ModuleSpecification, type MoveNodeAction, type MoveNodeInput, type MoveOperationAction, type MoveOperationInput, type MultiCurrencyConversion, type Mutation, type MutationAddChangeLogItemInputArgs, type MutationAddModuleArgs, type MutationAddOperationArgs, type MutationAddOperationErrorArgs, type MutationAddOperationExampleArgs, type MutationAddStateExampleArgs, type MutationDeleteChangeLogItemInputArgs, type MutationDeleteModuleArgs, type MutationDeleteOperationArgs, type MutationDeleteOperationErrorArgs, type MutationDeleteOperationExampleArgs, type MutationDeleteStateExampleArgs, type MutationMoveOperationArgs, type MutationRedoArgs, type MutationReorderChangeLogItemsInputArgs, type MutationReorderModuleOperationsArgs, type MutationReorderModulesArgs, type MutationReorderOperationErrorsArgs, type MutationReorderOperationExamplesArgs, type MutationReorderStateExamplesArgs, type MutationSetAuthorNameArgs, type MutationSetAuthorWebsiteArgs, type MutationSetInitialStateArgs, type MutationSetModelDescriptionArgs, type MutationSetModelExtensionArgs, type MutationSetModelIdArgs, type MutationSetModelNameArgs, type MutationSetModuleDescriptionArgs, type MutationSetModuleNameArgs, type MutationSetNameArgs, type MutationSetOperationDescriptionArgs, type MutationSetOperationErrorCodeArgs, type MutationSetOperationErrorDescriptionArgs, type MutationSetOperationErrorNameArgs, type MutationSetOperationErrorTemplateArgs, type MutationSetOperationNameArgs, type MutationSetOperationReducerArgs, type MutationSetOperationSchemaArgs, type MutationSetOperationTemplateArgs, type MutationSetStateSchemaArgs, type MutationUndoArgs, type MutationUpdateChangeLogItemInputArgs, type MutationUpdateOperationExampleArgs, type MutationUpdateStateExampleArgs, type NOOPAction, type Node, type OperationErrorSpecification, type OperationIndex, type OperationSpecification, type OperationsByScope, PACKAGES_DEPENDENCIES, type PACKAGE_MODULE_TYPES, type PHBackground, type PHBackgroundLayer, type PHBackgroundLayers, type PHConnectAi, type PHConnectApp, type PHConnectBranding, type PHConnectCompositionEntry, type PHConnectDefaultDrive, type PHConnectDefaultDriveLocal, type PHConnectDefaultDriveRemote, type PHConnectDriveSection, type PHConnectDriveSections, type PHConnectDrives, type PHConnectExplorerIcons, type PHConnectHome, type PHConnectInstance, type PHConnectLoader, type PHConnectOpenPanel, type PHConnectPackages, type PHConnectPwa, type PHConnectPwaCacheStrategy, type PHConnectPwaFileHandler, type PHConnectPwaIcon, type PHConnectPwaManifest, type PHConnectPwaRuntimeCaching, type PHConnectPwaUrlPattern, type PHConnectReactor, type PHConnectReactorFeatureFlags, type PHConnectRenown, type PHConnectRenownAdapters, type PHConnectRuntimeConfig, type PHConnectSentry, type PHEdges, type PHImageRef, type PHLength, type PHPackageProvider, type PHReactorClientMode, type PHReactorRenown, type PHRenownPrivyAdapterConfig, type PHRenownRainbowAdapterConfig, type PHSchemedColor, type PHSchemedImage, type PackageFacets, type PackageInfo, type PackageListItem, type PackageManagerArgs, type PackageModuleType, type PackagePage, type Page, type ParsedCmdResult, type PartialRecord, type PartialState, type PathValidation, type PhAiToolAnnotations, type PhAiToolDescriptor, type PieceModule, type PowerhouseConfig, type PowerhouseModule, type PowerhousePackage, type ProcessorApp, type ProcessorApps, type ProcessorDeletePropagation, type ProcessorDispatchCreateResult, type ProcessorDispatchResult, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, type ProcessorPhase, type ProcessorRecord, type ProcessorRerunOptions, type ProcessorStatus, type Publisher, type PullResponderTriggerData, type PullResponderTriggerDataInput, type PurgeDocumentAction, type PurgeDocumentActionInput, type Query, type Redo, type RedoAction, type RedoActionInput, type Reducer, type ReducerOptions, type RegistryPackage, type RegistryPackageList, type RegistryPackageMap, type RegistryPackageSource, type RegistryPackageStatus, type ReleaseNewVersionAction, type RemoveListenerAction, type RemoveListenerInput, type RemoveRelationshipAction, type RemoveRelationshipActionInput, type RemoveTriggerAction, type RemoveTriggerInput, type ReorderChangeLogItemsAction, type ReorderChangeLogItemsInput, type ReorderModuleOperationsAction, type ReorderModuleOperationsInput, type ReorderModulesAction, type ReorderModulesInput, type ReorderOperationErrorsAction, type ReorderOperationErrorsInput, type ReorderOperationExamplesAction, type ReorderOperationExamplesInput, type ReorderStateExamplesAction, type ReorderStateExamplesInput, type ReplayDocumentOptions, type ReplayStateMode, type RevisionsFilter, type SaveToFile, type SaveToFileHandle, type Scalars, type SchemaNOOPAction, type SchemaRedoAction, type SchemaSetNameAction, type SchemaSetPreferredEditorAction, type SchemaUndoAction, type ScopeState, type ServiceAction, type ServiceActions, type SetAuthorNameAction, type SetAuthorNameInput, type SetAuthorWebsiteAction, type SetAuthorWebsiteInput, type SetAvailableOfflineAction, type SetAvailableOfflineInput, type SetDriveIconAction, type SetDriveIconInput, type SetDriveNameAction, type SetDriveNameInput, type SetInitialStateAction, type SetInitialStateInput, type SetModelDescriptionAction, type SetModelDescriptionInput, type SetModelExtensionAction, type SetModelExtensionInput, type SetModelIdAction, type SetModelIdInput, type SetModelNameAction, type SetModelNameInput, type SetModuleDescriptionAction, type SetModuleDescriptionInput, type SetModuleNameAction, type SetModuleNameInput, type SetNameAction, type SetNameActionInput, type SetNameOperation, type SetOperationDescriptionAction, type SetOperationDescriptionInput, type SetOperationErrorCodeAction, type SetOperationErrorCodeInput, type SetOperationErrorDescriptionAction, type SetOperationErrorDescriptionInput, type SetOperationErrorNameAction, type SetOperationErrorNameInput, type SetOperationErrorTemplateAction, type SetOperationErrorTemplateInput, type SetOperationNameAction, type SetOperationNameInput, type SetOperationReducerAction, type SetOperationReducerInput, type SetOperationSchemaAction, type SetOperationSchemaInput, type SetOperationScopeAction, type SetOperationScopeInput, type SetOperationTemplateAction, type SetOperationTemplateInput, type SetPreferredEditorAction, type SetPreferredEditorActionInput, type SetPreferredEditorOperation, type SetSharingTypeAction, type SetSharingTypeInput, type SetStateSchemaAction, type SetStateSchemaInput, type Set_Name, type Set_PreferredEditor, type SharingType, type Signal, type SignalDispatch, type SignalResult, type SignalResults, type SignalType, type SignatureVerificationHandler, type SigningParameters, type SkipHeaderOperationIndex, type SkipHeaderOperations, type State, type StateReducer, type SubgraphModule, type TrackedProcessor, type TransmitterType, type Trigger, type TriggerData, type TriggerInput, type TriggerType, type Undo, type UndoAction, type UndoActionInput, type UndoRedoAction, type UpdateChangeLogItemAction, type UpdateChangeLogItemInput, type UpdateFileAction, type UpdateFileInput, type UpdateNodeAction, type UpdateNodeInput, type UpdateOperationExampleAction, type UpdateOperationExampleInput, type UpdateRelationshipAction, type UpdateRelationshipActionInput, type UpdateStateExampleAction, type UpdateStateExampleInput, type UpgradeDocumentAction, type UpgradeDocumentActionInput, type User, type ValidationError, buildTreeUrl, shortGitSha };
|
|
2
|
+
import { $ as ServiceActions, $a as UpdateOperationExampleInput, $i as SetModelNameInput, $n as ModuleSpecification, $r as PartialState, $t as DocumentModelAction, A as PHConnectPwaUrlPattern, Aa as SetStateSchemaAction, Ai as RevisionsFilter, An as FileInput, Ar as MutationSetModuleDescriptionArgs, At as CreateDocument, B as PHPackageProvider, Ba as SigningParameters, Bi as SetAuthorNameAction, Bn as Incremental, Bo as ProcessorFactory, Br as MutationSetOperationSchemaArgs, Bt as DeleteModuleAction, C as PHConnectPackages, Ca as SetOperationScopeAction, Ci as ReorderOperationErrorsAction, Cn as DocumentOperationsIgnoreMap, Cr as MutationSetAuthorNameArgs, Ct as CodeExample, D as PHConnectPwaIcon, Da as SetPreferredEditorAction, Di as ReorderStateExamplesAction, Dn as EditorModule, Dr as MutationSetModelExtensionArgs, Dt as CopyChildDocumentSignal, E as PHConnectPwaFileHandler, Ea as SetOperationTemplateInput, Ei as ReorderOperationExamplesInput, En as EditorDispatch, Er as MutationSetModelDescriptionArgs, Et as CopyChildDocumentInput, F as PHConnectRuntimeConfig, Fa as SignalDispatch, Fi as SchemaRedoAction, Fn as IDocument, Fo as ProcessorApp, Fr as MutationSetOperationErrorDescriptionArgs, Ft as DeleteChangeLogItemInput, G as PHSchemedColor, Ga as SubgraphModule, Gi as SetInitialStateInput, Gn as LoadFromInput, Go as ProcessorRerunOptions, Gr as MutationUpdateOperationExampleArgs, Gt as DeleteOperationExampleAction, H as PHReactorRenown, Ha as SkipHeaderOperations, Hi as SetAuthorWebsiteAction, Hn as IsDocumentOfType, Ho as ProcessorFilter, Hr as MutationSetStateSchemaArgs, Ht as DeleteOperationAction, I as PHConnectSentry, Ia as SignalResult, Ii as SchemaSetNameAction, In as IOperation, Io as ProcessorApps, Ir as MutationSetOperationErrorNameArgs, It as DeleteChildDocumentInput, J as ParsedCmdResult, Ja as UndoActionInput, Ji as SetModelExtensionAction, Jn as MakeOptional, Jo as TrackedProcessor, Jr as OperationErrorSpecification, Jt as DeleteStateExampleAction, K as PHSchemedImage, Ka as Undo, Ki as SetModelDescriptionAction, Kn as MakeEmpty, Ko as ProcessorStatus, Kr as MutationUpdateStateExampleArgs, Kt as DeleteOperationExampleInput, L as PHEdges, La as SignalResults, Li as SchemaSetPreferredEditorAction, Ln as ISignal, Lo as ProcessorDeletePropagation, Lr as MutationSetOperationErrorTemplateArgs, Lt as DeleteChildDocumentSignal, M as PHConnectReactorFeatureFlags, Ma as Set_Name, Mi as SaveToFileHandle, Mn as HostedEditorProps, Mo as IProcessorDispatch, Mr as MutationSetNameArgs, Mt as CreateDocumentActionInput, N as PHConnectRenown, Na as Set_PreferredEditor, Ni as Scalars, Nn as IAction, No as IProcessorHostModuleBase, Nr as MutationSetOperationDescriptionArgs, Nt as CreateState, O as PHConnectPwaManifest, Oa as SetPreferredEditorActionInput, Oi as ReorderStateExamplesInput, On as EditorProps, Or as MutationSetModelIdArgs, Ot as CreateChildDocumentInput, P as PHConnectRenownAdapters, Pa as Signal, Pi as SchemaNOOPAction, Pn as ID, Po as IProcessorManager, Pr as MutationSetOperationErrorCodeArgs, Pt as DeleteChangeLogItemAction, Q as ServiceAction, Qa as UpdateOperationExampleAction, Qi as SetModelNameAction, Qn as MinimalBackupData, Qr as PartialRecord, Qt as DocumentDispatch, R as PHImageRef, Ra as SignalType, Ri as SchemaUndoAction, Rn as ISignalResult, Ro as ProcessorDispatchCreateResult, Rr as MutationSetOperationNameArgs, Rt as DeleteDocumentAction, S as PHConnectOpenPanel, Sa as SetOperationSchemaInput, Si as ReorderModulesInput, Sn as DocumentModelVersioningOperations, Sr as MutationReorderStateExamplesArgs, St as Author, T as PHConnectPwaCacheStrategy, Ta as SetOperationTemplateAction, Ti as ReorderOperationExamplesAction, Tn as ENSInfo, Tr as MutationSetInitialStateArgs, Tt as ConfigEntryType, U as PHRenownPrivyAdapterConfig, Ua as State, Ui as SetAuthorWebsiteInput, Un as IsStateOfType, Uo as ProcessorPhase, Ur as MutationUndoArgs, Ut as DeleteOperationErrorAction, V as PHReactorClientMode, Va as SkipHeaderOperationIndex, Vi as SetAuthorNameInput, Vn as InputMaybe, Vo as ProcessorFactoryBuilder, Vr as MutationSetOperationTemplateArgs, Vt as DeleteModuleInput, W as PHRenownRainbowAdapterConfig, Wa as StateReducer, Wi as SetInitialStateAction, Wn as LoadFromFile, Wo as ProcessorRecord, Wr as MutationUpdateChangeLogItemInputArgs, Wt as DeleteOperationErrorInput, X as PowerhouseConfig, Xa as UpdateChangeLogItemAction, Xi as SetModelIdAction, Xn as MappedOperation, Xr as OperationSpecification, Xt as DispatchOutcome, Y as PathValidation, Ya as UndoRedoAction, Yi as SetModelExtensionInput, Yn as Manifest, Yr as OperationIndex, Yt as DeleteStateExampleInput, Z as PowerhousePackage, Za as UpdateChangeLogItemInput, Zi as SetModelIdInput, Zn as Maybe, Zr as OperationsByScope, Zt as DocumentAction, _ as PHConnectDrives, _a as SetOperationNameAction, _i as ReorderChangeLogItemsAction, _n as DocumentModelPHState, _r as MutationReorderChangeLogItemsInputArgs, _t as AddRelationshipActionInput, a as PHBackground, aa as SetNameActionInput, ai as PurgeDocumentAction, an as DocumentModelInput, ao as UpgradeDocumentActionInput, ar as MutationAddOperationArgs, at as Actions, b as PHConnectInstance, ba as SetOperationReducerInput, bi as ReorderModuleOperationsInput, bn as DocumentModelUtils, br as MutationReorderOperationErrorsArgs, bt as AssertIsDocumentOfType, c as PHConnectAi, ca as SetOperationDescriptionInput, ci as Redo, cn as DocumentModelModule, cr as MutationAddStateExampleArgs, ct as AddModuleAction, d as PHConnectCompositionEntry, da as SetOperationErrorDescriptionAction, di as Reducer, dn as DocumentModelOperationAction, dr as MutationDeleteOperationArgs, dt as AddOperationErrorAction, ea as SetModuleDescriptionAction, ei as PhAiToolAnnotations, en as DocumentModelDocument, eo as UpdateRelationshipAction, er as MoveOperationAction, f as PHConnectDefaultDrive, fa as SetOperationErrorDescriptionInput, fi as ReducerOptions, fn as DocumentModelOperationErrorAction, fr as MutationDeleteOperationErrorArgs, ft as AddOperationErrorInput, g as PHConnectDriveSections, ga as SetOperationErrorTemplateInput, gi as RemoveRelationshipActionInput, gn as DocumentModelOperationOperations, gr as MutationRedoArgs, gt as AddRelationshipAction, h as PHConnectDriveSection, ha as SetOperationErrorTemplateAction, hi as RemoveRelationshipAction, hn as DocumentModelOperationExampleOperations, hr as MutationMoveOperationArgs, ht as AddOperationInput, i as LogLevels, ia as SetNameAction, ii as Publisher, in as DocumentModelHeaderOperations, io as UpgradeDocumentAction, ir as MutationAddModuleArgs, it as ActionVerificationHandler, j as PHConnectReactor, ja as SetStateSchemaInput, ji as SaveToFile, jn as GetDocumentOptions, jo as IProcessor, jr as MutationSetModuleNameArgs, jt as CreateDocumentAction, k as PHConnectPwaRuntimeCaching, ka as SetPreferredEditorOperation, ki as ReplayDocumentOptions, kn as Exact, kr as MutationSetModelNameArgs, kt as CreateChildDocumentSignal, l as PHConnectApp, la as SetOperationErrorCodeAction, li as RedoAction, ln as DocumentModelModuleAction, lr as MutationDeleteChangeLogItemInputArgs, lt as AddModuleInput, m as PHConnectDefaultDriveRemote, ma as SetOperationErrorNameInput, mi as ReleaseNewVersionAction, mn as DocumentModelOperationExampleAction, mr as MutationDeleteStateExampleArgs, mt as AddOperationExampleInput, n as DrivePreserveStrategy, na as SetModuleNameAction, ni as PieceModule, nn as DocumentModelGlobalState, no as UpdateStateExampleAction, nr as Mutation, nt as ActionSignatureContext, o as PHBackgroundLayer, oa as SetNameOperation, oi as PurgeDocumentActionInput, on as DocumentModelLib, oo as User, or as MutationAddOperationErrorArgs, ot as AddChangeLogItemAction, p as PHConnectDefaultDriveLocal, pa as SetOperationErrorNameAction, pi as RejectedAction, pn as DocumentModelOperationErrorOperations, pr as MutationDeleteOperationExampleArgs, pt as AddOperationExampleAction, q as PackageManagerArgs, qa as UndoAction, qi as SetModelDescriptionInput, qn as MakeMaybe, qo as ReplayStateMode, qr as NOOPAction, qt as DeleteOperationInput, r as LogLevel, ra as SetModuleNameInput, ri as PowerhouseModule, rn as DocumentModelHeaderAction, ro as UpdateStateExampleInput, rr as MutationAddChangeLogItemInputArgs, rt as ActionSigningHandler, s as PHBackgroundLayers, sa as SetOperationDescriptionAction, si as Query, sn as DocumentModelLocalState, so as ValidationError, sr as MutationAddOperationExampleArgs, st as AddChangeLogItemInput, t as DrivePreserveStrategies, ta as SetModuleDescriptionInput, ti as PhAiToolDescriptor, tn as DocumentModelDocumentModelModule, to as UpdateRelationshipActionInput, tr as MoveOperationInput, tt as ActionErrorCallback, u as PHConnectBranding, ua as SetOperationErrorCodeInput, ui as RedoActionInput, un as DocumentModelModuleOperations, ur as MutationDeleteModuleArgs, ut as AddOperationAction, v as PHConnectExplorerIcons, va as SetOperationNameInput, vi as ReorderChangeLogItemsInput, vn as DocumentModelStateAction, vr as MutationReorderModuleOperationsArgs, vt as AddStateExampleAction, w as PHConnectPwa, wa as SetOperationScopeInput, wi as ReorderOperationErrorsInput, wn as DocumentSpecification, wr as MutationSetAuthorWebsiteArgs, wt as ConfigEntry, x as PHConnectLoader, xa as SetOperationSchemaAction, xi as ReorderModulesAction, xn as DocumentModelVersioningAction, xr as MutationReorderOperationExamplesArgs, xt as AssertIsStateOfType, y as PHConnectHome, ya as SetOperationReducerAction, yi as ReorderModuleOperationsAction, yn as DocumentModelStateOperations, yr as MutationReorderModulesArgs, yt as AddStateExampleInput, z as PHLength, za as SignatureVerificationHandler, zi as ScopeState, zn as ISigner, zo as ProcessorDispatchResult, zr as MutationSetOperationReducerArgs, zt as DeleteDocumentActionInput } from "./types-B1HqOXqL.js";
|
|
3
|
+
import { i as PACKAGES_DEPENDENCIES, n as APPS_DEPENDENCIES, r as CLIS_DEPENDENCIES, t as ALL_POWERHOUSE_DEPENDENCIES } from "./constants-4Y5b-joA.js";
|
|
4
|
+
import { $ as LegacySynchronizationUnit, A as TriggerData, B as PackagePage, C as RemoveTriggerInput, D as SetSharingTypeInput, E as SetDriveNameInput, F as PACKAGE_MODULE_TYPES, G as RegistryPackageSource, H as RegistryPackage, I as PackageFacets, J as DriveDocumentModelModule, K as RegistryPackageStatus, L as PackageInfo, M as TriggerType, N as UpdateFileInput, O as TransmitterType, P as UpdateNodeInput, Q as LegacyAddFileInput, R as PackageListItem, S as RemoveListenerInput, T as SetDriveIconInput, U as RegistryPackageList, V as Page, W as RegistryPackageMap, X as DocumentDriveDocument, Y as DocumentDriveAction, Z as LegacyAddFileAction, _ as ListenerInput, _t as SetDriveNameAction, a as CopyNodeInput, at as DocumentDriveNodeOperations, b as PullResponderTriggerData, c as DocumentDriveLocalState, ct as UpdateNodeAction, d as FolderNode, dt as DocumentDriveDriveAction, et as AddFileAction, f as Listener, ft as DocumentDriveDriveOperations, g as ListenerFilterInput, gt as SetDriveIconAction, h as ListenerFilter, ht as SetAvailableOfflineAction, i as AddTriggerInput, it as DocumentDriveNodeAction, j as TriggerInput, k as Trigger, lt as AddListenerAction, m as ListenerCallInfoInput, mt as RemoveTriggerAction, n as AddFolderInput, nt as CopyNodeAction, o as DeleteNodeInput, ot as MoveNodeAction, p as ListenerCallInfo, pt as RemoveListenerAction, q as DocumentDrivePHState, r as AddListenerInput, rt as DeleteNodeAction, s as DocumentDriveGlobalState, st as UpdateFileAction, t as AddFileInput, tt as AddFolderAction, u as FileNode, ut as AddTriggerAction, v as MoveNodeInput, vt as SetSharingTypeAction, w as SetAvailableOfflineInput, x as PullResponderTriggerDataInput, y as Node, z as PackageModuleType } from "./types-BoYyqmJ2.js";
|
|
5
|
+
import { a as GenerateNodesCopyIdGenerator, i as DriveInput, n as buildTreeUrl, o as GenerateNodesCopySrc, r as shortGitSha, s as SharingType, t as GITHUB_REPO_URL } from "./index-BzueQ7B3.js";
|
|
6
|
+
export { ALL_POWERHOUSE_DEPENDENCIES, APPS_DEPENDENCIES, type ActionErrorCallback, type ActionSignatureContext, type ActionSigningHandler, type ActionVerificationHandler, type Actions, type AddChangeLogItemAction, type AddChangeLogItemInput, type AddFileAction, type AddFileInput, type AddFolderAction, type AddFolderInput, type AddListenerAction, type AddListenerInput, type AddModuleAction, type AddModuleInput, type AddOperationAction, type AddOperationErrorAction, type AddOperationErrorInput, type AddOperationExampleAction, type AddOperationExampleInput, type AddOperationInput, type AddRelationshipAction, type AddRelationshipActionInput, type AddStateExampleAction, type AddStateExampleInput, type AddTriggerAction, type AddTriggerInput, type AnalyticsDimension, type AnalyticsOperand, type AnalyticsQuery, type AnalyticsSeries, type AnalyticsSeriesInput, type AnalyticsSeriesQuery, type AnalyticsUpdateCallback, type AssertIsDocumentOfType, type AssertIsStateOfType, type Author, CLIS_DEPENDENCIES, type CodeExample, type CompoundAnalyticsExpression, type CompoundAnalyticsInputs, type CompoundAnalyticsQuery, type ConfigEntry, type ConfigEntryType, type ConversionMetric, type CopyChildDocumentInput, type CopyChildDocumentSignal, type CopyNodeAction, type CopyNodeInput, type CreateChildDocumentInput, type CreateChildDocumentSignal, type CreateDocument, type CreateDocumentAction, type CreateDocumentActionInput, type CreateState, type DeleteChangeLogItemAction, type DeleteChangeLogItemInput, type DeleteChildDocumentInput, type DeleteChildDocumentSignal, type DeleteDocumentAction, type DeleteDocumentActionInput, type DeleteModuleAction, type DeleteModuleInput, type DeleteNodeAction, type DeleteNodeInput, type DeleteOperationAction, type DeleteOperationErrorAction, type DeleteOperationErrorInput, type DeleteOperationExampleAction, type DeleteOperationExampleInput, type DeleteOperationInput, type DeleteStateExampleAction, type DeleteStateExampleInput, type DispatchOutcome, type DocumentAction, type DocumentDispatch, type DocumentDriveAction, type DocumentDriveDocument, type DocumentDriveDriveAction, type DocumentDriveDriveOperations, type DocumentDriveGlobalState, type DocumentDriveLocalState, type DocumentDriveNodeAction, type DocumentDriveNodeOperations, type DocumentDrivePHState, type DocumentModelAction, type DocumentModelDocument, type DocumentModelDocumentModelModule, type DocumentModelGlobalState, type DocumentModelHeaderAction, type DocumentModelHeaderOperations, type DocumentModelInput, type DocumentModelLib, type DocumentModelLocalState, type DocumentModelModule, type DocumentModelModuleAction, type DocumentModelModuleOperations, type DocumentModelOperationAction, type DocumentModelOperationErrorAction, type DocumentModelOperationErrorOperations, type DocumentModelOperationExampleAction, type DocumentModelOperationExampleOperations, type DocumentModelOperationOperations, type DocumentModelPHState, type DocumentModelStateAction, type DocumentModelStateOperations, type DocumentModelUtils, type DocumentModelVersioningAction, type DocumentModelVersioningOperations, type DocumentOperationsIgnoreMap, type DocumentSpecification, type DriveDocumentModelModule, type DriveInput, type DrivePreserveStrategies, type DrivePreserveStrategy, type ENSInfo, type EditorDispatch, type EditorModule, type EditorProps, type Exact, type FileInput, type FileNode, type FolderNode, GITHUB_REPO_URL, type GenerateNodesCopyIdGenerator, type GenerateNodesCopySrc, type GetDocumentOptions, type HostedEditorProps, type IAction, type IAnalyticsStore, type ID, type IDocument, type IOperation, type IProcessor, type IProcessorDispatch, type IProcessorHostModuleBase, type IProcessorManager, type ISignal, type ISignalResult, type ISigner, type Incremental, type InputMaybe, type IsDocumentOfType, type IsStateOfType, type LegacyAddFileAction, type LegacyAddFileInput, type LegacySynchronizationUnit, type Listener, type ListenerCallInfo, type ListenerCallInfoInput, type ListenerFilter, type ListenerFilterInput, type ListenerInput, type LoadFromFile, type LoadFromInput, type LogLevel, type LogLevels, type MakeEmpty, type MakeMaybe, type MakeOptional, type Manifest, type MappedOperation, type Maybe, type MinimalBackupData, type ModuleSpecification, type MoveNodeAction, type MoveNodeInput, type MoveOperationAction, type MoveOperationInput, type MultiCurrencyConversion, type Mutation, type MutationAddChangeLogItemInputArgs, type MutationAddModuleArgs, type MutationAddOperationArgs, type MutationAddOperationErrorArgs, type MutationAddOperationExampleArgs, type MutationAddStateExampleArgs, type MutationDeleteChangeLogItemInputArgs, type MutationDeleteModuleArgs, type MutationDeleteOperationArgs, type MutationDeleteOperationErrorArgs, type MutationDeleteOperationExampleArgs, type MutationDeleteStateExampleArgs, type MutationMoveOperationArgs, type MutationRedoArgs, type MutationReorderChangeLogItemsInputArgs, type MutationReorderModuleOperationsArgs, type MutationReorderModulesArgs, type MutationReorderOperationErrorsArgs, type MutationReorderOperationExamplesArgs, type MutationReorderStateExamplesArgs, type MutationSetAuthorNameArgs, type MutationSetAuthorWebsiteArgs, type MutationSetInitialStateArgs, type MutationSetModelDescriptionArgs, type MutationSetModelExtensionArgs, type MutationSetModelIdArgs, type MutationSetModelNameArgs, type MutationSetModuleDescriptionArgs, type MutationSetModuleNameArgs, type MutationSetNameArgs, type MutationSetOperationDescriptionArgs, type MutationSetOperationErrorCodeArgs, type MutationSetOperationErrorDescriptionArgs, type MutationSetOperationErrorNameArgs, type MutationSetOperationErrorTemplateArgs, type MutationSetOperationNameArgs, type MutationSetOperationReducerArgs, type MutationSetOperationSchemaArgs, type MutationSetOperationTemplateArgs, type MutationSetStateSchemaArgs, type MutationUndoArgs, type MutationUpdateChangeLogItemInputArgs, type MutationUpdateOperationExampleArgs, type MutationUpdateStateExampleArgs, type NOOPAction, type Node, type OperationErrorSpecification, type OperationIndex, type OperationSpecification, type OperationsByScope, PACKAGES_DEPENDENCIES, type PACKAGE_MODULE_TYPES, type PHBackground, type PHBackgroundLayer, type PHBackgroundLayers, type PHConnectAi, type PHConnectApp, type PHConnectBranding, type PHConnectCompositionEntry, type PHConnectDefaultDrive, type PHConnectDefaultDriveLocal, type PHConnectDefaultDriveRemote, type PHConnectDriveSection, type PHConnectDriveSections, type PHConnectDrives, type PHConnectExplorerIcons, type PHConnectHome, type PHConnectInstance, type PHConnectLoader, type PHConnectOpenPanel, type PHConnectPackages, type PHConnectPwa, type PHConnectPwaCacheStrategy, type PHConnectPwaFileHandler, type PHConnectPwaIcon, type PHConnectPwaManifest, type PHConnectPwaRuntimeCaching, type PHConnectPwaUrlPattern, type PHConnectReactor, type PHConnectReactorFeatureFlags, type PHConnectRenown, type PHConnectRenownAdapters, type PHConnectRuntimeConfig, type PHConnectSentry, type PHEdges, type PHImageRef, type PHLength, type PHPackageProvider, type PHReactorClientMode, type PHReactorRenown, type PHRenownPrivyAdapterConfig, type PHRenownRainbowAdapterConfig, type PHSchemedColor, type PHSchemedImage, type PackageFacets, type PackageInfo, type PackageListItem, type PackageManagerArgs, type PackageModuleType, type PackagePage, type Page, type ParsedCmdResult, type PartialRecord, type PartialState, type PathValidation, type PhAiToolAnnotations, type PhAiToolDescriptor, type PieceModule, type PowerhouseConfig, type PowerhouseModule, type PowerhousePackage, type ProcessorApp, type ProcessorApps, type ProcessorDeletePropagation, type ProcessorDispatchCreateResult, type ProcessorDispatchResult, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, type ProcessorPhase, type ProcessorRecord, type ProcessorRerunOptions, type ProcessorStatus, type Publisher, type PullResponderTriggerData, type PullResponderTriggerDataInput, type PurgeDocumentAction, type PurgeDocumentActionInput, type Query, type Redo, type RedoAction, type RedoActionInput, type Reducer, type ReducerOptions, type RegistryPackage, type RegistryPackageList, type RegistryPackageMap, type RegistryPackageSource, type RegistryPackageStatus, type RejectedAction, type ReleaseNewVersionAction, type RemoveListenerAction, type RemoveListenerInput, type RemoveRelationshipAction, type RemoveRelationshipActionInput, type RemoveTriggerAction, type RemoveTriggerInput, type ReorderChangeLogItemsAction, type ReorderChangeLogItemsInput, type ReorderModuleOperationsAction, type ReorderModuleOperationsInput, type ReorderModulesAction, type ReorderModulesInput, type ReorderOperationErrorsAction, type ReorderOperationErrorsInput, type ReorderOperationExamplesAction, type ReorderOperationExamplesInput, type ReorderStateExamplesAction, type ReorderStateExamplesInput, type ReplayDocumentOptions, type ReplayStateMode, type RevisionsFilter, type SaveToFile, type SaveToFileHandle, type Scalars, type SchemaNOOPAction, type SchemaRedoAction, type SchemaSetNameAction, type SchemaSetPreferredEditorAction, type SchemaUndoAction, type ScopeState, type ServiceAction, type ServiceActions, type SetAuthorNameAction, type SetAuthorNameInput, type SetAuthorWebsiteAction, type SetAuthorWebsiteInput, type SetAvailableOfflineAction, type SetAvailableOfflineInput, type SetDriveIconAction, type SetDriveIconInput, type SetDriveNameAction, type SetDriveNameInput, type SetInitialStateAction, type SetInitialStateInput, type SetModelDescriptionAction, type SetModelDescriptionInput, type SetModelExtensionAction, type SetModelExtensionInput, type SetModelIdAction, type SetModelIdInput, type SetModelNameAction, type SetModelNameInput, type SetModuleDescriptionAction, type SetModuleDescriptionInput, type SetModuleNameAction, type SetModuleNameInput, type SetNameAction, type SetNameActionInput, type SetNameOperation, type SetOperationDescriptionAction, type SetOperationDescriptionInput, type SetOperationErrorCodeAction, type SetOperationErrorCodeInput, type SetOperationErrorDescriptionAction, type SetOperationErrorDescriptionInput, type SetOperationErrorNameAction, type SetOperationErrorNameInput, type SetOperationErrorTemplateAction, type SetOperationErrorTemplateInput, type SetOperationNameAction, type SetOperationNameInput, type SetOperationReducerAction, type SetOperationReducerInput, type SetOperationSchemaAction, type SetOperationSchemaInput, type SetOperationScopeAction, type SetOperationScopeInput, type SetOperationTemplateAction, type SetOperationTemplateInput, type SetPreferredEditorAction, type SetPreferredEditorActionInput, type SetPreferredEditorOperation, type SetSharingTypeAction, type SetSharingTypeInput, type SetStateSchemaAction, type SetStateSchemaInput, type Set_Name, type Set_PreferredEditor, type SharingType, type Signal, type SignalDispatch, type SignalResult, type SignalResults, type SignalType, type SignatureVerificationHandler, type SigningParameters, type SkipHeaderOperationIndex, type SkipHeaderOperations, type State, type StateReducer, type SubgraphModule, type TrackedProcessor, type TransmitterType, type Trigger, type TriggerData, type TriggerInput, type TriggerType, type Undo, type UndoAction, type UndoActionInput, type UndoRedoAction, type UpdateChangeLogItemAction, type UpdateChangeLogItemInput, type UpdateFileAction, type UpdateFileInput, type UpdateNodeAction, type UpdateNodeInput, type UpdateOperationExampleAction, type UpdateOperationExampleInput, type UpdateRelationshipAction, type UpdateRelationshipActionInput, type UpdateStateExampleAction, type UpdateStateExampleInput, type UpgradeDocumentAction, type UpgradeDocumentActionInput, type User, type ValidationError, buildTreeUrl, shortGitSha };
|
|
7
7
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $o as
|
|
2
|
-
export { type AuthorizerResult, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, DOCUMENT_ID_COLUMNS, ExtractProcessorSchemaOrSelf, HashAlgorithms, IBaseRelationalDb, type IHttpScope, type IProcessor, type IProcessorDispatch, type IProcessorHostModuleBase, type IProcessorManager, IRelationalDb, IRelationalDbProcessor, IRelationalQueryBuilder, IRelationalQueryMethods, type IWebhookEndpoints, type IWebhookScope, type NodeRouteSpec, PROCESSOR_APPS, type ProcessorApp, type ProcessorApps, type ProcessorDeletePropagation, type ProcessorDispatchCreateResult, type ProcessorDispatchResult, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, type ProcessorPhase, type ProcessorRecord, type ProcessorRerunOptions, type ProcessorStatus, RelationalDbProcessor, RelationalDbProcessorClass, type ReplayStateMode, type RouteActor, type RouteAuth, type RouteAuthorizer, type RouteBody, type RouteContext, type RouteHandler, type RouteMethod, type RouteOptions, type RouteSpec, type RouteTransport, type RouteUser, type ScopedRouteHandle, type TrackedProcessor, type WebhookEndpointInfo, type WebhookField, type WebhookHashAlgorithm, type WebhookPolicy, type WebhookReply, type WebhookRequest, type WebhookScheme, type WebhookSignatureEncoding, type WebhookSpec, type WebhookVerification, createNamespacedDb, createNamespacedQueryBuilder, createRelationalDb, deletedDocumentId, hashNamespace, namespaceSchemaOf, relationalDbToQueryBuilder };
|
|
1
|
+
import { $o as NodeRouteSpec, Ao as RelationalDbProcessorClass, Bo as ProcessorFactory, Co as HashAlgorithms, Do as IRelationalQueryBuilder, Eo as IRelationalDbProcessor, Fo as ProcessorApp, Go as ProcessorRerunOptions, Ho as ProcessorFilter, Io as ProcessorApps, Jo as TrackedProcessor, Ko as ProcessorStatus, Lo as ProcessorDeletePropagation, Mo as IProcessorDispatch, No as IProcessorHostModuleBase, Oo as IRelationalQueryMethods, Po as IProcessorManager, Qo as IWebhookScope, Ro as ProcessorDispatchCreateResult, So as ExtractProcessorSchemaOrSelf, Ss as deletedDocumentId, To as IRelationalDb, Uo as ProcessorPhase, Vo as ProcessorFactoryBuilder, Wo as ProcessorRecord, Xo as IHttpScope, Yo as AuthorizerResult, Zo as IWebhookEndpoints, _o as createRelationalDb, _s as WebhookRequest, as as RouteHandler, bo as relationalDbToQueryBuilder, bs as WebhookSpec, co as CodegenState, cs as RouteSpec, dg as PROCESSOR_APPS, do as PackageLoadFailure, ds as ScopedRouteHandle, es as RouteActor, fo as SETTLED_CODEGEN_STATES, fs as WebhookEndpointInfo, go as createNamespacedQueryBuilder, gs as WebhookReply, ho as createNamespacedDb, hs as WebhookPolicy, is as RouteContext, jo as IProcessor, ko as RelationalDbProcessor, lg as DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, lo as CodegenStatus, ls as RouteTransport, mo as isSettledCodegenState, ms as WebhookHashAlgorithm, ns as RouteAuthorizer, os as RouteMethod, po as getCodegenStatusRegistry, ps as WebhookField, qo as ReplayStateMode, rs as RouteBody, ss as RouteOptions, ts as RouteAuth, ug as DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, uo as CodegenStatusRegistry, us as RouteUser, vo as hashNamespace, vs as WebhookScheme, wo as IBaseRelationalDb, xo as DOCUMENT_ID_COLUMNS, xs as WebhookVerification, yo as namespaceSchemaOf, ys as WebhookSignatureEncoding, zo as ProcessorDispatchResult } from "../types-B1HqOXqL.js";
|
|
2
|
+
export { type AuthorizerResult, CodegenState, CodegenStatus, CodegenStatusRegistry, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, DOCUMENT_ID_COLUMNS, ExtractProcessorSchemaOrSelf, HashAlgorithms, IBaseRelationalDb, type IHttpScope, type IProcessor, type IProcessorDispatch, type IProcessorHostModuleBase, type IProcessorManager, IRelationalDb, IRelationalDbProcessor, IRelationalQueryBuilder, IRelationalQueryMethods, type IWebhookEndpoints, type IWebhookScope, type NodeRouteSpec, PROCESSOR_APPS, PackageLoadFailure, type ProcessorApp, type ProcessorApps, type ProcessorDeletePropagation, type ProcessorDispatchCreateResult, type ProcessorDispatchResult, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, type ProcessorPhase, type ProcessorRecord, type ProcessorRerunOptions, type ProcessorStatus, RelationalDbProcessor, RelationalDbProcessorClass, type ReplayStateMode, type RouteActor, type RouteAuth, type RouteAuthorizer, type RouteBody, type RouteContext, type RouteHandler, type RouteMethod, type RouteOptions, type RouteSpec, type RouteTransport, type RouteUser, SETTLED_CODEGEN_STATES, type ScopedRouteHandle, type TrackedProcessor, type WebhookEndpointInfo, type WebhookField, type WebhookHashAlgorithm, type WebhookPolicy, type WebhookReply, type WebhookRequest, type WebhookScheme, type WebhookSignatureEncoding, type WebhookSpec, type WebhookVerification, createNamespacedDb, createNamespacedQueryBuilder, createRelationalDb, deletedDocumentId, getCodegenStatusRegistry, hashNamespace, isSettledCodegenState, namespaceSchemaOf, relationalDbToQueryBuilder };
|
|
3
3
|
export {};
|
package/dist/processors/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../purge-
|
|
1
|
+
import "../purge-YMJM0Vl7.js";
|
|
2
|
+
import { a as namespaceSchemaOf, i as hashNamespace, n as createNamespacedQueryBuilder, o as relationalDbToQueryBuilder, r as createRelationalDb, t as createNamespacedDb } from "../utils-MrLmLEVr.js";
|
|
2
3
|
import { sql } from "kysely";
|
|
3
|
-
import fnv1a from "@sindresorhus/fnv1a";
|
|
4
4
|
//#region processors/constants.ts
|
|
5
5
|
const PROCESSOR_APPS = ["connect", "switchboard"];
|
|
6
6
|
const DEFAULT_RELATIONAL_PROCESSOR_DB_NAME = "relational-db";
|
|
@@ -15,80 +15,6 @@ function deletedDocumentId(op) {
|
|
|
15
15
|
return typeof documentId === "string" ? documentId : op.context.documentId;
|
|
16
16
|
}
|
|
17
17
|
//#endregion
|
|
18
|
-
//#region processors/relational/utils.ts
|
|
19
|
-
const SUPPORTED_SIZES = [
|
|
20
|
-
32,
|
|
21
|
-
64,
|
|
22
|
-
128,
|
|
23
|
-
256,
|
|
24
|
-
512,
|
|
25
|
-
1024
|
|
26
|
-
];
|
|
27
|
-
const LOG2_26 = Math.log2(26);
|
|
28
|
-
/**
|
|
29
|
-
* Hashes a string to a lowercase base-26 string.
|
|
30
|
-
* @param str The string to hash.
|
|
31
|
-
* @param length The length of the hash. Defaults to 10.
|
|
32
|
-
* @param algorithm The hashing algorithm to use. Defaults to "fnv1a".
|
|
33
|
-
* @returns The hashed string.
|
|
34
|
-
*/
|
|
35
|
-
function hashNamespace(str, length = 10) {
|
|
36
|
-
const requiredBits = Math.ceil(length * LOG2_26);
|
|
37
|
-
const bitSize = SUPPORTED_SIZES.find((size) => size && size >= requiredBits) ?? 1024;
|
|
38
|
-
return toBase26(fnv1a(str, { size: bitSize }), length);
|
|
39
|
-
}
|
|
40
|
-
function toBase26(num, length = 10) {
|
|
41
|
-
const alphabet = "abcdefghijklmnopqrstuvwxyz";
|
|
42
|
-
let out = "";
|
|
43
|
-
while (num > 0n && out.length < length) {
|
|
44
|
-
out = alphabet[Number(num % 26n)] + out;
|
|
45
|
-
num /= 26n;
|
|
46
|
-
}
|
|
47
|
-
return out.padStart(length, "a");
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Creates a RelationalDb instance with namespace support.
|
|
51
|
-
* @param baseDb The base RelationalDb instance to enhance.
|
|
52
|
-
* @param baseOptions The default options for namespace creation. Hashes namespace by default.
|
|
53
|
-
* @returns The enhanced RelationalDb instance.
|
|
54
|
-
*/
|
|
55
|
-
function createRelationalDb(baseDb, baseOptions) {
|
|
56
|
-
const relationalDb = baseDb;
|
|
57
|
-
relationalDb.createNamespace = (namespace, options) => createNamespacedDb(baseDb, namespace, options ?? baseOptions);
|
|
58
|
-
relationalDb.queryNamespace = (namespace, options) => createNamespacedQueryBuilder(baseDb, namespace, options ?? baseOptions);
|
|
59
|
-
return relationalDb;
|
|
60
|
-
}
|
|
61
|
-
async function createNamespacedDb(db, namespace, options) {
|
|
62
|
-
const hashValue = options?.hashNamespace ?? true ? hashNamespace(namespace) : namespace;
|
|
63
|
-
await db.schema.createSchema(hashValue).ifNotExists().execute();
|
|
64
|
-
const schemaRelationalDb = db.withSchema(hashValue);
|
|
65
|
-
Object.defineProperty(schemaRelationalDb, NAMESPACE_SCHEMA, { value: hashValue });
|
|
66
|
-
return schemaRelationalDb;
|
|
67
|
-
}
|
|
68
|
-
const NAMESPACE_SCHEMA = Symbol.for("ph.relational.namespaceSchema");
|
|
69
|
-
/** The schema behind a handle from `createNamespace`; undefined otherwise. */
|
|
70
|
-
function namespaceSchemaOf(db) {
|
|
71
|
-
return db[NAMESPACE_SCHEMA];
|
|
72
|
-
}
|
|
73
|
-
function createNamespacedQueryBuilder(db, namespace, options) {
|
|
74
|
-
const hashValue = options?.hashNamespace ?? true ? hashNamespace(namespace) : namespace;
|
|
75
|
-
return relationalDbToQueryBuilder(db.withSchema(hashValue));
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Returns a query builder for a RelationalDb instance.
|
|
79
|
-
* @param query The RelationalDb instance to convert.
|
|
80
|
-
* @returns The IRelationalQueryBuilder instance.
|
|
81
|
-
*/
|
|
82
|
-
function relationalDbToQueryBuilder(query) {
|
|
83
|
-
return {
|
|
84
|
-
selectFrom: query.selectFrom.bind(query),
|
|
85
|
-
selectNoFrom: query.selectNoFrom.bind(query),
|
|
86
|
-
with: query.with.bind(query),
|
|
87
|
-
withRecursive: query.withRecursive.bind(query),
|
|
88
|
-
withSchema: (schema) => relationalDbToQueryBuilder(query.withSchema(schema))
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
//#endregion
|
|
92
18
|
//#region processors/relational/types.ts
|
|
93
19
|
/** Columns {@link RelationalDbProcessor.deleteDocumentRows} matches. */
|
|
94
20
|
const DOCUMENT_ID_COLUMNS = ["document_id", "documentId"];
|
|
@@ -181,6 +107,124 @@ var RelationalDbProcessor = class {
|
|
|
181
107
|
}
|
|
182
108
|
};
|
|
183
109
|
//#endregion
|
|
184
|
-
|
|
110
|
+
//#region processors/codegen-status.ts
|
|
111
|
+
const SETTLED_CODEGEN_STATES = [
|
|
112
|
+
"done",
|
|
113
|
+
"failed",
|
|
114
|
+
"skipped"
|
|
115
|
+
];
|
|
116
|
+
function isSettledCodegenState(state) {
|
|
117
|
+
return SETTLED_CODEGEN_STATES.includes(state);
|
|
118
|
+
}
|
|
119
|
+
/** Vetra's codegen status per document, and failed package loads. The codegen
|
|
120
|
+
* processor, the package loader and reactor-mcp share it in one process. */
|
|
121
|
+
var CodegenStatusRegistry = class {
|
|
122
|
+
#documentTypes = /* @__PURE__ */ new Set();
|
|
123
|
+
#statuses = /* @__PURE__ */ new Map();
|
|
124
|
+
#loadFailures = /* @__PURE__ */ new Map();
|
|
125
|
+
#listeners = /* @__PURE__ */ new Set();
|
|
126
|
+
/** Records that a codegen processor generates code for `documentTypes`. */
|
|
127
|
+
watch(documentTypes) {
|
|
128
|
+
for (const type of documentTypes) this.#documentTypes.add(type);
|
|
129
|
+
this.#notify();
|
|
130
|
+
}
|
|
131
|
+
/** Whether a codegen processor runs in this process. */
|
|
132
|
+
get active() {
|
|
133
|
+
return this.#documentTypes.size > 0;
|
|
134
|
+
}
|
|
135
|
+
get documentTypes() {
|
|
136
|
+
return [...this.#documentTypes];
|
|
137
|
+
}
|
|
138
|
+
watches(documentType) {
|
|
139
|
+
return this.#documentTypes.has(documentType);
|
|
140
|
+
}
|
|
141
|
+
/** Replaces a document's status; `name` carries over unless given. */
|
|
142
|
+
set(status) {
|
|
143
|
+
const name = status.name ?? this.#statuses.get(status.documentId)?.name;
|
|
144
|
+
const next = {
|
|
145
|
+
documentId: status.documentId,
|
|
146
|
+
documentType: status.documentType,
|
|
147
|
+
...name !== void 0 && { name },
|
|
148
|
+
state: status.state,
|
|
149
|
+
...status.message !== void 0 && { message: status.message },
|
|
150
|
+
...status.files !== void 0 && { files: status.files },
|
|
151
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
152
|
+
};
|
|
153
|
+
this.#statuses.set(status.documentId, next);
|
|
154
|
+
this.#notify();
|
|
155
|
+
return next;
|
|
156
|
+
}
|
|
157
|
+
get(documentId) {
|
|
158
|
+
return this.#statuses.get(documentId);
|
|
159
|
+
}
|
|
160
|
+
/** Most recently updated first. */
|
|
161
|
+
list() {
|
|
162
|
+
return [...this.#statuses.values()].sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
163
|
+
}
|
|
164
|
+
delete(documentId) {
|
|
165
|
+
if (this.#statuses.delete(documentId)) this.#notify();
|
|
166
|
+
}
|
|
167
|
+
/** Records a failed load of `kind` from `pkg`; no `failure` clears it. */
|
|
168
|
+
reportLoad(pkg, kind, failure) {
|
|
169
|
+
const key = `${pkg}\u0000${kind}`;
|
|
170
|
+
if (failure === void 0) {
|
|
171
|
+
if (this.#loadFailures.delete(key)) this.#notify();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
this.#loadFailures.set(key, {
|
|
175
|
+
package: pkg,
|
|
176
|
+
kind,
|
|
177
|
+
message: failure,
|
|
178
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
179
|
+
});
|
|
180
|
+
this.#notify();
|
|
181
|
+
}
|
|
182
|
+
loadFailures() {
|
|
183
|
+
return [...this.#loadFailures.values()];
|
|
184
|
+
}
|
|
185
|
+
/** Whether `documentId`'s job, or every job when omitted, has settled. */
|
|
186
|
+
settled(documentId) {
|
|
187
|
+
return (documentId === void 0 ? this.list() : [this.get(documentId)].filter((s) => s !== void 0)).every((status) => isSettledCodegenState(status.state));
|
|
188
|
+
}
|
|
189
|
+
/** Resolves to whether the jobs settled within `timeoutMs`. */
|
|
190
|
+
waitUntilSettled(documentId, timeoutMs) {
|
|
191
|
+
if (this.settled(documentId)) return Promise.resolve(true);
|
|
192
|
+
return new Promise((resolve) => {
|
|
193
|
+
const finish = (settled) => {
|
|
194
|
+
clearTimeout(timer);
|
|
195
|
+
unsubscribe();
|
|
196
|
+
resolve(settled);
|
|
197
|
+
};
|
|
198
|
+
const timer = setTimeout(() => finish(false), timeoutMs);
|
|
199
|
+
const unsubscribe = this.subscribe(() => {
|
|
200
|
+
if (this.settled(documentId)) finish(true);
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
subscribe(listener) {
|
|
205
|
+
this.#listeners.add(listener);
|
|
206
|
+
return () => {
|
|
207
|
+
this.#listeners.delete(listener);
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/** Forgets everything; for tests. */
|
|
211
|
+
clear() {
|
|
212
|
+
this.#documentTypes.clear();
|
|
213
|
+
this.#statuses.clear();
|
|
214
|
+
this.#loadFailures.clear();
|
|
215
|
+
this.#notify();
|
|
216
|
+
}
|
|
217
|
+
#notify() {
|
|
218
|
+
for (const listener of this.#listeners) listener();
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const REGISTRY_KEY = Symbol.for("@powerhousedao/shared/codegen-status");
|
|
222
|
+
/** The process's codegen status registry. */
|
|
223
|
+
function getCodegenStatusRegistry() {
|
|
224
|
+
const holder = globalThis;
|
|
225
|
+
return holder[REGISTRY_KEY] ??= new CodegenStatusRegistry();
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
export { CodegenStatusRegistry, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, DOCUMENT_ID_COLUMNS, PROCESSOR_APPS, RelationalDbProcessor, SETTLED_CODEGEN_STATES, createNamespacedDb, createNamespacedQueryBuilder, createRelationalDb, deletedDocumentId, getCodegenStatusRegistry, hashNamespace, isSettledCodegenState, namespaceSchemaOf, relationalDbToQueryBuilder };
|
|
185
229
|
|
|
186
230
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../processors/constants.ts","../../processors/deletion.ts","../../processors/relational/utils.ts","../../processors/relational/types.ts"],"sourcesContent":["export const PROCESSOR_APPS = [\"connect\", \"switchboard\"] as const;\nexport const DEFAULT_RELATIONAL_PROCESSOR_DB_NAME = \"relational-db\";\nexport const DEFAULT_ANALYTICS_PROCESSOR_DB_NAME = \"analytics-db\";\n","import type { OperationWithContext } from \"../document-model/index.js\";\nimport { PURGE_DOCUMENT } from \"../document-model/purge.js\";\n\n/** The id a DELETE_DOCUMENT or PURGE_DOCUMENT removes; undefined otherwise. */\nexport function deletedDocumentId(\n op: OperationWithContext,\n): string | undefined {\n const { type, input } = op.operation.action;\n if (type !== \"DELETE_DOCUMENT\" && type !== PURGE_DOCUMENT) return undefined;\n const documentId = (input as { documentId?: unknown } | undefined)\n ?.documentId;\n return typeof documentId === \"string\" ? documentId : op.context.documentId;\n}\n","import type { Options } from \"@sindresorhus/fnv1a\";\nimport fnv1a from \"@sindresorhus/fnv1a\";\nimport type {\n IBaseRelationalDb,\n IRelationalDb,\n IRelationalQueryBuilder,\n} from \"./types.js\";\n\nconst SUPPORTED_SIZES: Options[\"size\"][] = [32, 64, 128, 256, 512, 1024];\nconst LOG2_26 = Math.log2(26); //\n/**\n * Hashes a string to a lowercase base-26 string.\n * @param str The string to hash.\n * @param length The length of the hash. Defaults to 10.\n * @param algorithm The hashing algorithm to use. Defaults to \"fnv1a\".\n * @returns The hashed string.\n */\nexport function hashNamespace(str: string, length = 10) {\n const requiredBits = Math.ceil(length * LOG2_26);\n const bitSize =\n SUPPORTED_SIZES.find((size) => size && size >= requiredBits) ?? 1024;\n const hash = fnv1a(str, { size: bitSize });\n return toBase26(hash, length);\n}\n\n// converts hash to lowercase letters\nfunction toBase26(num: bigint, length = 10): string {\n const alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n let out = \"\";\n while (num > 0n && out.length < length) {\n out = alphabet[Number(num % 26n)] + out;\n num /= 26n;\n }\n return out.padStart(length, \"a\"); // optional padding\n}\n\n/**\n * Creates a RelationalDb instance with namespace support.\n * @param baseDb The base RelationalDb instance to enhance.\n * @param baseOptions The default options for namespace creation. Hashes namespace by default.\n * @returns The enhanced RelationalDb instance.\n */\nexport function createRelationalDb<Schema>(\n baseDb: IBaseRelationalDb<Schema>,\n baseOptions?: NamespaceOptions,\n): IRelationalDb<Schema> {\n const relationalDb = baseDb as IRelationalDb<Schema>;\n\n relationalDb.createNamespace = <NamespaceSchema>(\n namespace: string,\n options?: NamespaceOptions,\n ) =>\n createNamespacedDb<NamespaceSchema>(\n baseDb,\n namespace,\n options ?? baseOptions,\n );\n\n relationalDb.queryNamespace = <NamespaceSchema>(\n namespace: string,\n options?: NamespaceOptions,\n ) =>\n createNamespacedQueryBuilder<NamespaceSchema>(\n baseDb,\n namespace,\n options ?? baseOptions,\n );\n\n return relationalDb;\n}\n\ntype NamespaceOptions = {\n hashNamespace?: boolean;\n};\n\nexport async function createNamespacedDb<Schema>(\n db: IBaseRelationalDb<any>,\n namespace: string,\n options?: NamespaceOptions,\n): Promise<IRelationalDb<Schema>> {\n // hash the namespace to avoid too long namespaces\n const shouldHash = options?.hashNamespace ?? true;\n const hashValue = shouldHash ? hashNamespace(namespace) : namespace;\n await db.schema.createSchema(hashValue).ifNotExists().execute();\n const schemaRelationalDb = db.withSchema(hashValue);\n Object.defineProperty(schemaRelationalDb, NAMESPACE_SCHEMA, {\n value: hashValue,\n });\n return schemaRelationalDb as IRelationalDb<Schema>;\n}\n\nconst NAMESPACE_SCHEMA = Symbol.for(\"ph.relational.namespaceSchema\");\n\n/** The schema behind a handle from `createNamespace`; undefined otherwise. */\nexport function namespaceSchemaOf(db: object): string | undefined {\n return (db as { [NAMESPACE_SCHEMA]?: string })[NAMESPACE_SCHEMA];\n}\n\nexport function createNamespacedQueryBuilder<Schema>(\n db: IBaseRelationalDb<any>,\n namespace: string,\n options?: NamespaceOptions,\n): IRelationalQueryBuilder<Schema> {\n const shouldHash = options?.hashNamespace ?? true;\n const hashValue = shouldHash ? hashNamespace(namespace) : namespace;\n const namespacedDb = db.withSchema(hashValue) as IRelationalDb<Schema>;\n return relationalDbToQueryBuilder(namespacedDb);\n}\n\n/**\n * Returns a query builder for a RelationalDb instance.\n * @param query The RelationalDb instance to convert.\n * @returns The IRelationalQueryBuilder instance.\n */\nexport function relationalDbToQueryBuilder<TSchema>(\n query: IBaseRelationalDb<TSchema>,\n): IRelationalQueryBuilder<TSchema> {\n return {\n selectFrom: query.selectFrom.bind(query),\n selectNoFrom: query.selectNoFrom.bind(query),\n with: query.with.bind(query),\n withRecursive: query.withRecursive.bind(query),\n withSchema: (schema: string) =>\n relationalDbToQueryBuilder<TSchema>(query.withSchema(schema)),\n };\n}\n","import type { OperationWithContext } from \"@powerhousedao/shared/document-model\";\nimport { sql, type Kysely, type QueryCreator } from \"kysely\";\nimport type { IProcessor, ProcessorFilter } from \"../types.js\";\nimport { namespaceSchemaOf, relationalDbToQueryBuilder } from \"./utils.js\";\n\n/** Columns {@link RelationalDbProcessor.deleteDocumentRows} matches. */\nexport const DOCUMENT_ID_COLUMNS = [\"document_id\", \"documentId\"] as const;\n\nexport type IRelationalQueryMethods =\n | \"selectFrom\"\n | \"selectNoFrom\"\n | \"with\"\n | \"withRecursive\";\n\nexport type IRelationalQueryBuilder<Schema = unknown> = Pick<\n QueryCreator<Schema>,\n IRelationalQueryMethods\n> & {\n withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;\n};\n\nexport type HashAlgorithms = \"fnv1a\";\nexport type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;\n\n/**\n * The standardized relational database interface for relational db processors.\n * This abstraction provides type-safe database operations while hiding the underlying\n * database framework implementation details.\n **/\nexport type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {\n createNamespace<NamespaceSchema>(\n namespace: string,\n ): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;\n queryNamespace<NamespaceSchema>(\n namespace: string,\n ): IRelationalQueryBuilder<NamespaceSchema>;\n};\n\nexport type ExtractProcessorSchemaOrSelf<TProcessor> =\n TProcessor extends RelationalDbProcessor<infer TSchema>\n ? TSchema\n : TProcessor;\n\nexport type RelationalDbProcessorClass<TSchema> =\n typeof RelationalDbProcessor<TSchema>;\n\nexport interface IRelationalDbProcessor<\n TDatabaseSchema = unknown,\n> extends IProcessor {\n namespace: string;\n query: IRelationalQueryBuilder<TDatabaseSchema>;\n filter: ProcessorFilter;\n initAndUpgrade(): Promise<void>;\n}\n\nconst IS_RELATIONAL_DB_PROCESSOR = Symbol.for(\"ph.IS_RELATIONAL_DB_PROCESSOR\");\n\n/**\n * Base class for relational db processors that require a relational database storage.\n * This class abstracts database initialization, migration management, and resource cleanup,\n * allowing derived classes to focus on business logic.\n */\nexport abstract class RelationalDbProcessor<\n TDatabaseSchema = unknown,\n> implements IRelationalDbProcessor<TDatabaseSchema> {\n constructor(\n protected _namespace: string,\n protected _filter: ProcessorFilter,\n protected relationalDb: IRelationalDb<TDatabaseSchema>,\n /** The drive the factory created this processor for. */\n protected _driveId?: string,\n ) {}\n\n static [IS_RELATIONAL_DB_PROCESSOR] = true;\n\n /**\n * Returns the namespace for a given drive id.\n * This method can be overridden by derived classes to provide a custom namespace.\n */\n static getNamespace(driveId: string): string {\n return `${this.name}_${driveId.replaceAll(\"-\", \"_\")}`;\n }\n\n static query<Schema>(\n this: RelationalDbProcessorClass<Schema>,\n driveId: string,\n db: IRelationalDb<any>,\n ): IRelationalQueryBuilder<Schema> {\n return db.queryNamespace(this.getNamespace(driveId));\n }\n\n /**\n * Processes a list of operations with context.\n * Called when operations match this processor's filter.\n */\n abstract onOperations(operations: OperationWithContext[]): Promise<void>;\n\n /**\n * Returns the filter for the processor.\n * This method can be overridden by derived classes to provide a custom filter.\n */\n get filter(): ProcessorFilter {\n return this._filter;\n }\n\n /**\n * Returns the namespace used by the processor.\n */\n get namespace(): string {\n return this._namespace;\n }\n\n /** Processors writing one namespace are cleared together. */\n get clearScope(): string {\n return this._namespace;\n }\n\n /** Drops the namespace and its tables, then migrates it afresh. */\n async clear(): Promise<void> {\n await this.dropNamespace();\n await this.relationalDb.schema\n .createSchema(this.namespaceSchema())\n .ifNotExists()\n .execute();\n await this.initAndUpgrade();\n }\n\n get query(): IRelationalQueryBuilder<TDatabaseSchema> {\n return relationalDbToQueryBuilder(this.relationalDb);\n }\n\n /** True for this processor's drive when its namespace is that drive's alone. */\n protected isNamespaceDrive(documentId: string): boolean {\n const driveId = this._driveId;\n if (driveId === undefined || documentId !== driveId) return false;\n const processorClass = this.constructor as typeof RelationalDbProcessor;\n if (processorClass.getNamespace(driveId) !== this._namespace) return false;\n return processorClass.getNamespace(`${driveId}-other`) !== this._namespace;\n }\n\n /** Deletes a document's rows from every table with a document-id column. */\n protected async deleteDocumentRows(documentId: string): Promise<void> {\n const schema = this.namespaceSchema();\n const columns = await sql<{ table_name: string; column_name: string }>`\n select c.table_name, c.column_name\n from information_schema.columns c\n join information_schema.tables t\n on t.table_schema = c.table_schema and t.table_name = c.table_name\n where c.table_schema = ${schema}\n and t.table_type = 'BASE TABLE'\n and c.column_name in (${sql.join([...DOCUMENT_ID_COLUMNS])})\n order by c.table_name, c.column_name\n `.execute(this.relationalDb);\n const db = this.relationalDb as unknown as Kysely<any>;\n for (const { table_name, column_name } of columns.rows) {\n await db\n .deleteFrom(table_name)\n .where(column_name, \"=\", documentId)\n .execute();\n }\n }\n\n /** Drops this processor's namespace and every table in it. */\n protected async dropNamespace(): Promise<void> {\n await this.relationalDb.schema\n .dropSchema(this.namespaceSchema())\n .ifExists()\n .cascade()\n .execute();\n }\n\n private namespaceSchema(): string {\n const schema = namespaceSchemaOf(this.relationalDb);\n if (schema === undefined) {\n throw new Error(\n `Namespace '${this._namespace}' was not opened with createNamespace`,\n );\n }\n return schema;\n }\n\n /**\n * Abstract method that derived classes must implement.\n * This method is meant to be called on subclasses to initialize and upgrade the database.\n */\n abstract initAndUpgrade(): Promise<void>;\n\n /**\n * Called when the processor is disconnected.\n * This method is meant to be overridden by subclasses to clean up resources.\n */\n abstract onDisconnect(): Promise<void>;\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../processors/constants.ts","../../processors/deletion.ts","../../processors/relational/types.ts","../../processors/codegen-status.ts"],"sourcesContent":["export const PROCESSOR_APPS = [\"connect\", \"switchboard\"] as const;\nexport const DEFAULT_RELATIONAL_PROCESSOR_DB_NAME = \"relational-db\";\nexport const DEFAULT_ANALYTICS_PROCESSOR_DB_NAME = \"analytics-db\";\n","import type { OperationWithContext } from \"../document-model/index.js\";\nimport { PURGE_DOCUMENT } from \"../document-model/purge.js\";\n\n/** The id a DELETE_DOCUMENT or PURGE_DOCUMENT removes; undefined otherwise. */\nexport function deletedDocumentId(\n op: OperationWithContext,\n): string | undefined {\n const { type, input } = op.operation.action;\n if (type !== \"DELETE_DOCUMENT\" && type !== PURGE_DOCUMENT) return undefined;\n const documentId = (input as { documentId?: unknown } | undefined)\n ?.documentId;\n return typeof documentId === \"string\" ? documentId : op.context.documentId;\n}\n","import type { OperationWithContext } from \"@powerhousedao/shared/document-model\";\nimport { sql, type Kysely, type QueryCreator } from \"kysely\";\nimport type { IProcessor, ProcessorFilter } from \"../types.js\";\nimport { namespaceSchemaOf, relationalDbToQueryBuilder } from \"./utils.js\";\n\n/** Columns {@link RelationalDbProcessor.deleteDocumentRows} matches. */\nexport const DOCUMENT_ID_COLUMNS = [\"document_id\", \"documentId\"] as const;\n\nexport type IRelationalQueryMethods =\n | \"selectFrom\"\n | \"selectNoFrom\"\n | \"with\"\n | \"withRecursive\";\n\nexport type IRelationalQueryBuilder<Schema = unknown> = Pick<\n QueryCreator<Schema>,\n IRelationalQueryMethods\n> & {\n withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;\n};\n\nexport type HashAlgorithms = \"fnv1a\";\nexport type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;\n\n/**\n * The standardized relational database interface for relational db processors.\n * This abstraction provides type-safe database operations while hiding the underlying\n * database framework implementation details.\n **/\nexport type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {\n createNamespace<NamespaceSchema>(\n namespace: string,\n ): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;\n queryNamespace<NamespaceSchema>(\n namespace: string,\n ): IRelationalQueryBuilder<NamespaceSchema>;\n};\n\nexport type ExtractProcessorSchemaOrSelf<TProcessor> =\n TProcessor extends RelationalDbProcessor<infer TSchema>\n ? TSchema\n : TProcessor;\n\nexport type RelationalDbProcessorClass<TSchema> =\n typeof RelationalDbProcessor<TSchema>;\n\nexport interface IRelationalDbProcessor<\n TDatabaseSchema = unknown,\n> extends IProcessor {\n namespace: string;\n query: IRelationalQueryBuilder<TDatabaseSchema>;\n filter: ProcessorFilter;\n initAndUpgrade(): Promise<void>;\n}\n\nconst IS_RELATIONAL_DB_PROCESSOR = Symbol.for(\"ph.IS_RELATIONAL_DB_PROCESSOR\");\n\n/**\n * Base class for relational db processors that require a relational database storage.\n * This class abstracts database initialization, migration management, and resource cleanup,\n * allowing derived classes to focus on business logic.\n */\nexport abstract class RelationalDbProcessor<\n TDatabaseSchema = unknown,\n> implements IRelationalDbProcessor<TDatabaseSchema> {\n constructor(\n protected _namespace: string,\n protected _filter: ProcessorFilter,\n protected relationalDb: IRelationalDb<TDatabaseSchema>,\n /** The drive the factory created this processor for. */\n protected _driveId?: string,\n ) {}\n\n static [IS_RELATIONAL_DB_PROCESSOR] = true;\n\n /**\n * Returns the namespace for a given drive id.\n * This method can be overridden by derived classes to provide a custom namespace.\n */\n static getNamespace(driveId: string): string {\n return `${this.name}_${driveId.replaceAll(\"-\", \"_\")}`;\n }\n\n static query<Schema>(\n this: RelationalDbProcessorClass<Schema>,\n driveId: string,\n db: IRelationalDb<any>,\n ): IRelationalQueryBuilder<Schema> {\n return db.queryNamespace(this.getNamespace(driveId));\n }\n\n /**\n * Processes a list of operations with context.\n * Called when operations match this processor's filter.\n */\n abstract onOperations(operations: OperationWithContext[]): Promise<void>;\n\n /**\n * Returns the filter for the processor.\n * This method can be overridden by derived classes to provide a custom filter.\n */\n get filter(): ProcessorFilter {\n return this._filter;\n }\n\n /**\n * Returns the namespace used by the processor.\n */\n get namespace(): string {\n return this._namespace;\n }\n\n /** Processors writing one namespace are cleared together. */\n get clearScope(): string {\n return this._namespace;\n }\n\n /** Drops the namespace and its tables, then migrates it afresh. */\n async clear(): Promise<void> {\n await this.dropNamespace();\n await this.relationalDb.schema\n .createSchema(this.namespaceSchema())\n .ifNotExists()\n .execute();\n await this.initAndUpgrade();\n }\n\n get query(): IRelationalQueryBuilder<TDatabaseSchema> {\n return relationalDbToQueryBuilder(this.relationalDb);\n }\n\n /** True for this processor's drive when its namespace is that drive's alone. */\n protected isNamespaceDrive(documentId: string): boolean {\n const driveId = this._driveId;\n if (driveId === undefined || documentId !== driveId) return false;\n const processorClass = this.constructor as typeof RelationalDbProcessor;\n if (processorClass.getNamespace(driveId) !== this._namespace) return false;\n return processorClass.getNamespace(`${driveId}-other`) !== this._namespace;\n }\n\n /** Deletes a document's rows from every table with a document-id column. */\n protected async deleteDocumentRows(documentId: string): Promise<void> {\n const schema = this.namespaceSchema();\n const columns = await sql<{ table_name: string; column_name: string }>`\n select c.table_name, c.column_name\n from information_schema.columns c\n join information_schema.tables t\n on t.table_schema = c.table_schema and t.table_name = c.table_name\n where c.table_schema = ${schema}\n and t.table_type = 'BASE TABLE'\n and c.column_name in (${sql.join([...DOCUMENT_ID_COLUMNS])})\n order by c.table_name, c.column_name\n `.execute(this.relationalDb);\n const db = this.relationalDb as unknown as Kysely<any>;\n for (const { table_name, column_name } of columns.rows) {\n await db\n .deleteFrom(table_name)\n .where(column_name, \"=\", documentId)\n .execute();\n }\n }\n\n /** Drops this processor's namespace and every table in it. */\n protected async dropNamespace(): Promise<void> {\n await this.relationalDb.schema\n .dropSchema(this.namespaceSchema())\n .ifExists()\n .cascade()\n .execute();\n }\n\n private namespaceSchema(): string {\n const schema = namespaceSchemaOf(this.relationalDb);\n if (schema === undefined) {\n throw new Error(\n `Namespace '${this._namespace}' was not opened with createNamespace`,\n );\n }\n return schema;\n }\n\n /**\n * Abstract method that derived classes must implement.\n * This method is meant to be called on subclasses to initialize and upgrade the database.\n */\n abstract initAndUpgrade(): Promise<void>;\n\n /**\n * Called when the processor is disconnected.\n * This method is meant to be overridden by subclasses to clean up resources.\n */\n abstract onDisconnect(): Promise<void>;\n}\n","/** Where a codegen job for one document stands; `done`, `failed` and `skipped` are settled. */\nexport type CodegenState =\n | \"queued\"\n | \"running\"\n | \"waiting-for-install\"\n | \"done\"\n | \"failed\"\n | \"skipped\";\n\nexport const SETTLED_CODEGEN_STATES: readonly CodegenState[] = [\n \"done\",\n \"failed\",\n \"skipped\",\n];\n\nexport type CodegenStatus = {\n documentId: string;\n documentType: string;\n /** The module's name, once the job has read the document. */\n name?: string;\n state: CodegenState;\n /** Why it was skipped or failed, or what it waits for. */\n message?: string;\n /** Project files the job wrote, relative to the project. */\n files?: string[];\n /** ISO timestamp of the last change. */\n updatedAt: string;\n};\n\n/** A package module the reactor failed to load, e.g. broken generated code. */\nexport type PackageLoadFailure = {\n package: string;\n /** What was loaded: \"document models\", \"subgraphs\", \"processors\", ... */\n kind: string;\n message: string;\n updatedAt: string;\n};\n\nexport function isSettledCodegenState(state: CodegenState): boolean {\n return SETTLED_CODEGEN_STATES.includes(state);\n}\n\n/** Vetra's codegen status per document, and failed package loads. The codegen\n * processor, the package loader and reactor-mcp share it in one process. */\nexport class CodegenStatusRegistry {\n #documentTypes = new Set<string>();\n #statuses = new Map<string, CodegenStatus>();\n #loadFailures = new Map<string, PackageLoadFailure>();\n #listeners = new Set<() => void>();\n\n /** Records that a codegen processor generates code for `documentTypes`. */\n watch(documentTypes: readonly string[]): void {\n for (const type of documentTypes) this.#documentTypes.add(type);\n this.#notify();\n }\n\n /** Whether a codegen processor runs in this process. */\n get active(): boolean {\n return this.#documentTypes.size > 0;\n }\n\n get documentTypes(): string[] {\n return [...this.#documentTypes];\n }\n\n watches(documentType: string): boolean {\n return this.#documentTypes.has(documentType);\n }\n\n /** Replaces a document's status; `name` carries over unless given. */\n set(\n status: Omit<CodegenStatus, \"updatedAt\" | \"name\"> & { name?: string },\n ): CodegenStatus {\n const name = status.name ?? this.#statuses.get(status.documentId)?.name;\n const next: CodegenStatus = {\n documentId: status.documentId,\n documentType: status.documentType,\n ...(name !== undefined && { name }),\n state: status.state,\n ...(status.message !== undefined && { message: status.message }),\n ...(status.files !== undefined && { files: status.files }),\n updatedAt: new Date().toISOString(),\n };\n this.#statuses.set(status.documentId, next);\n this.#notify();\n return next;\n }\n\n get(documentId: string): CodegenStatus | undefined {\n return this.#statuses.get(documentId);\n }\n\n /** Most recently updated first. */\n list(): CodegenStatus[] {\n return [...this.#statuses.values()].sort((a, b) =>\n b.updatedAt.localeCompare(a.updatedAt),\n );\n }\n\n delete(documentId: string): void {\n if (this.#statuses.delete(documentId)) this.#notify();\n }\n\n /** Records a failed load of `kind` from `pkg`; no `failure` clears it. */\n reportLoad(pkg: string, kind: string, failure?: string): void {\n const key = `${pkg}\\u0000${kind}`;\n if (failure === undefined) {\n if (this.#loadFailures.delete(key)) this.#notify();\n return;\n }\n this.#loadFailures.set(key, {\n package: pkg,\n kind,\n message: failure,\n updatedAt: new Date().toISOString(),\n });\n this.#notify();\n }\n\n loadFailures(): PackageLoadFailure[] {\n return [...this.#loadFailures.values()];\n }\n\n /** Whether `documentId`'s job, or every job when omitted, has settled. */\n settled(documentId?: string): boolean {\n const statuses =\n documentId === undefined\n ? this.list()\n : [this.get(documentId)].filter((s) => s !== undefined);\n return statuses.every((status) => isSettledCodegenState(status.state));\n }\n\n /** Resolves to whether the jobs settled within `timeoutMs`. */\n waitUntilSettled(\n documentId: string | undefined,\n timeoutMs: number,\n ): Promise<boolean> {\n if (this.settled(documentId)) return Promise.resolve(true);\n return new Promise((resolve) => {\n const finish = (settled: boolean) => {\n clearTimeout(timer);\n unsubscribe();\n resolve(settled);\n };\n const timer = setTimeout(() => finish(false), timeoutMs);\n const unsubscribe = this.subscribe(() => {\n if (this.settled(documentId)) finish(true);\n });\n });\n }\n\n subscribe(listener: () => void): () => void {\n this.#listeners.add(listener);\n return () => {\n this.#listeners.delete(listener);\n };\n }\n\n /** Forgets everything; for tests. */\n clear(): void {\n this.#documentTypes.clear();\n this.#statuses.clear();\n this.#loadFailures.clear();\n this.#notify();\n }\n\n #notify(): void {\n for (const listener of this.#listeners) listener();\n }\n}\n\n// On globalThis, so two copies of this package in one process share it.\nconst REGISTRY_KEY = Symbol.for(\"@powerhousedao/shared/codegen-status\");\n\n/** The process's codegen status registry. */\nexport function getCodegenStatusRegistry(): CodegenStatusRegistry {\n const holder = globalThis as { [REGISTRY_KEY]?: CodegenStatusRegistry };\n return (holder[REGISTRY_KEY] ??= new CodegenStatusRegistry());\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { So as ExtractProcessorSchemaOrSelf, To as IRelationalDb } from "../types-B1HqOXqL.js";
|
|
2
|
+
import { OperationWithContext, PHDocument } from "@powerhousedao/shared/document-model";
|
|
3
|
+
//#region processors/testing.d.ts
|
|
4
|
+
/** An in-memory PGlite database, as a host's `module.relationalDb`. `destroy()` closes it. */
|
|
5
|
+
export declare function createTestRelationalDb(): IRelationalDb;
|
|
6
|
+
/** Opens `namespace` as a processor factory does and runs a migration's `up` in it. */
|
|
7
|
+
export declare function runProcessorMigrations<Schema>(db: IRelationalDb, namespace: string, up: (db: IRelationalDb<any>) => Promise<void>): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<Schema>>>;
|
|
8
|
+
/** A document's operations as a processor's `onOperations` receives them. */
|
|
9
|
+
export declare function operationsWithContext(document: PHDocument, scopes?: string[]): OperationWithContext[];
|
|
10
|
+
/** One operation for a processor test, without a reducer to produce it. */
|
|
11
|
+
export declare function testOperation(options: {
|
|
12
|
+
documentId: string;
|
|
13
|
+
documentType: string;
|
|
14
|
+
type: string;
|
|
15
|
+
input?: unknown;
|
|
16
|
+
scope?: string;
|
|
17
|
+
index?: number;
|
|
18
|
+
timestampUtcMs?: string;
|
|
19
|
+
}): OperationWithContext;
|
|
20
|
+
//#endregion
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","names":[],"sources":["../../processors/testing.ts"],"mappings":";;;;wBAegB,0BAA0B;;wBAYpB,uBAAuB,QAC3C,IAAI,eACJ,mBACA,KAAK,IAAI,uBAAuB,gBAC/B,QAAQ,cAAc,6BAA6B;;wBAOtC,sBACd,UAAU,YACV,oBACC;;wBAuBa,cAAc;EAC5B;EACA;EACA;EACA;EACA;EACA;EACA;IACE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { r as createRelationalDb } from "../utils-MrLmLEVr.js";
|
|
2
|
+
import { Kysely } from "kysely";
|
|
3
|
+
import { PGlite } from "@electric-sql/pglite";
|
|
4
|
+
import { PGliteDialect } from "kysely-pglite-dialect";
|
|
5
|
+
//#region processors/testing.ts
|
|
6
|
+
/** An in-memory PGlite database, as a host's `module.relationalDb`. `destroy()` closes it. */
|
|
7
|
+
function createTestRelationalDb() {
|
|
8
|
+
const pglite = new PGlite();
|
|
9
|
+
const kysely = new Kysely({ dialect: new PGliteDialect(pglite) });
|
|
10
|
+
const destroy = kysely.destroy.bind(kysely);
|
|
11
|
+
kysely.destroy = async () => {
|
|
12
|
+
await destroy();
|
|
13
|
+
await pglite.close();
|
|
14
|
+
};
|
|
15
|
+
return createRelationalDb(kysely);
|
|
16
|
+
}
|
|
17
|
+
/** Opens `namespace` as a processor factory does and runs a migration's `up` in it. */
|
|
18
|
+
async function runProcessorMigrations(db, namespace, up) {
|
|
19
|
+
const store = await db.createNamespace(namespace);
|
|
20
|
+
await up(store);
|
|
21
|
+
return store;
|
|
22
|
+
}
|
|
23
|
+
/** A document's operations as a processor's `onOperations` receives them. */
|
|
24
|
+
function operationsWithContext(document, scopes = Object.keys(document.operations)) {
|
|
25
|
+
const operations = scopes.flatMap((scope) => (document.operations[scope] ?? []).map((operation) => ({
|
|
26
|
+
operation,
|
|
27
|
+
context: {
|
|
28
|
+
documentId: document.header.id,
|
|
29
|
+
documentType: document.header.documentType,
|
|
30
|
+
scope,
|
|
31
|
+
branch: "main",
|
|
32
|
+
ordinal: 0
|
|
33
|
+
}
|
|
34
|
+
})));
|
|
35
|
+
operations.sort((a, b) => a.operation.timestampUtcMs.localeCompare(b.operation.timestampUtcMs));
|
|
36
|
+
return operations.map((entry, index) => ({
|
|
37
|
+
...entry,
|
|
38
|
+
context: {
|
|
39
|
+
...entry.context,
|
|
40
|
+
ordinal: index + 1
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
/** One operation for a processor test, without a reducer to produce it. */
|
|
45
|
+
function testOperation(options) {
|
|
46
|
+
const scope = options.scope ?? "global";
|
|
47
|
+
const timestampUtcMs = options.timestampUtcMs ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
48
|
+
const index = options.index ?? 0;
|
|
49
|
+
const action = {
|
|
50
|
+
id: `${options.documentId}-${scope}-${index}`,
|
|
51
|
+
type: options.type,
|
|
52
|
+
input: options.input ?? {},
|
|
53
|
+
scope,
|
|
54
|
+
timestampUtcMs
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
operation: {
|
|
58
|
+
id: action.id,
|
|
59
|
+
index,
|
|
60
|
+
skip: 0,
|
|
61
|
+
timestampUtcMs,
|
|
62
|
+
hash: "",
|
|
63
|
+
action
|
|
64
|
+
},
|
|
65
|
+
context: {
|
|
66
|
+
documentId: options.documentId,
|
|
67
|
+
documentType: options.documentType,
|
|
68
|
+
scope,
|
|
69
|
+
branch: "main",
|
|
70
|
+
ordinal: index + 1
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { createTestRelationalDb, operationsWithContext, runProcessorMigrations, testOperation };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","names":[],"sources":["../../processors/testing.ts"],"sourcesContent":["import { PGlite } from \"@electric-sql/pglite\";\nimport type {\n Action,\n OperationWithContext,\n PHDocument,\n} from \"@powerhousedao/shared/document-model\";\nimport { Kysely } from \"kysely\";\nimport { PGliteDialect } from \"kysely-pglite-dialect\";\nimport type {\n ExtractProcessorSchemaOrSelf,\n IRelationalDb,\n} from \"./relational/types.js\";\nimport { createRelationalDb } from \"./relational/utils.js\";\n\n/** An in-memory PGlite database, as a host's `module.relationalDb`. `destroy()` closes it. */\nexport function createTestRelationalDb(): IRelationalDb {\n const pglite = new PGlite();\n const kysely = new Kysely<unknown>({ dialect: new PGliteDialect(pglite) });\n const destroy = kysely.destroy.bind(kysely);\n kysely.destroy = async () => {\n await destroy();\n await pglite.close();\n };\n return createRelationalDb(kysely);\n}\n\n/** Opens `namespace` as a processor factory does and runs a migration's `up` in it. */\nexport async function runProcessorMigrations<Schema>(\n db: IRelationalDb,\n namespace: string,\n up: (db: IRelationalDb<any>) => Promise<void>,\n): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<Schema>>> {\n const store = await db.createNamespace<Schema>(namespace);\n await up(store);\n return store;\n}\n\n/** A document's operations as a processor's `onOperations` receives them. */\nexport function operationsWithContext(\n document: PHDocument,\n scopes: string[] = Object.keys(document.operations),\n): OperationWithContext[] {\n const operations = scopes.flatMap((scope) =>\n (document.operations[scope] ?? []).map((operation) => ({\n operation,\n context: {\n documentId: document.header.id,\n documentType: document.header.documentType,\n scope,\n branch: \"main\",\n ordinal: 0,\n },\n })),\n );\n operations.sort((a, b) =>\n a.operation.timestampUtcMs.localeCompare(b.operation.timestampUtcMs),\n );\n return operations.map((entry, index) => ({\n ...entry,\n context: { ...entry.context, ordinal: index + 1 },\n }));\n}\n\n/** One operation for a processor test, without a reducer to produce it. */\nexport function testOperation(options: {\n documentId: string;\n documentType: string;\n type: string;\n input?: unknown;\n scope?: string;\n index?: number;\n timestampUtcMs?: string;\n}): OperationWithContext {\n const scope = options.scope ?? \"global\";\n const timestampUtcMs = options.timestampUtcMs ?? new Date().toISOString();\n const index = options.index ?? 0;\n const action: Action = {\n id: `${options.documentId}-${scope}-${index}`,\n type: options.type,\n input: options.input ?? {},\n scope,\n timestampUtcMs,\n };\n return {\n operation: {\n id: action.id,\n index,\n skip: 0,\n timestampUtcMs,\n hash: \"\",\n action,\n },\n context: {\n documentId: options.documentId,\n documentType: options.documentType,\n scope,\n branch: \"main\",\n ordinal: index + 1,\n },\n };\n}\n"],"mappings":";;;;;;AAeA,SAAgB,yBAAwC;CACtD,MAAM,SAAS,IAAI,OAAO;CAC1B,MAAM,SAAS,IAAI,OAAgB,EAAE,SAAS,IAAI,cAAc,MAAM,EAAE,CAAC;CACzE,MAAM,UAAU,OAAO,QAAQ,KAAK,MAAM;CAC1C,OAAO,UAAU,YAAY;EAC3B,MAAM,QAAQ;EACd,MAAM,OAAO,MAAM;CACrB;CACA,OAAO,mBAAmB,MAAM;AAClC;;AAGA,eAAsB,uBACpB,IACA,WACA,IAC8D;CAC9D,MAAM,QAAQ,MAAM,GAAG,gBAAwB,SAAS;CACxD,MAAM,GAAG,KAAK;CACd,OAAO;AACT;;AAGA,SAAgB,sBACd,UACA,SAAmB,OAAO,KAAK,SAAS,UAAU,GAC1B;CACxB,MAAM,aAAa,OAAO,SAAS,WAChC,SAAS,WAAW,UAAU,CAAC,EAAA,CAAG,KAAK,eAAe;EACrD;EACA,SAAS;GACP,YAAY,SAAS,OAAO;GAC5B,cAAc,SAAS,OAAO;GAC9B;GACA,QAAQ;GACR,SAAS;EACX;CACF,EAAE,CACJ;CACA,WAAW,MAAM,GAAG,MAClB,EAAE,UAAU,eAAe,cAAc,EAAE,UAAU,cAAc,CACrE;CACA,OAAO,WAAW,KAAK,OAAO,WAAW;EACvC,GAAG;EACH,SAAS;GAAE,GAAG,MAAM;GAAS,SAAS,QAAQ;EAAE;CAClD,EAAE;AACJ;;AAGA,SAAgB,cAAc,SAQL;CACvB,MAAM,QAAQ,QAAQ,SAAS;CAC/B,MAAM,iBAAiB,QAAQ,mCAAkB,IAAI,KAAK,EAAA,CAAE,YAAY;CACxE,MAAM,QAAQ,QAAQ,SAAS;CAC/B,MAAM,SAAiB;EACrB,IAAI,GAAG,QAAQ,WAAW,GAAG,MAAM,GAAG;EACtC,MAAM,QAAQ;EACd,OAAO,QAAQ,SAAS,CAAC;EACzB;EACA;CACF;CACA,OAAO;EACL,WAAW;GACT,IAAI,OAAO;GACX;GACA,MAAM;GACN;GACA,MAAM;GACN;EACF;EACA,SAAS;GACP,YAAY,QAAQ;GACpB,cAAc,QAAQ;GACtB;GACA,QAAQ;GACR,SAAS,QAAQ;EACnB;CACF;AACF"}
|