@voidhash/mimic 0.0.2 → 0.0.3
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/.turbo/turbo-build.log +257 -42
- package/dist/Document.cjs +152 -0
- package/dist/Document.d.cts +67 -0
- package/dist/Document.d.cts.map +1 -0
- package/dist/Document.d.mts +68 -0
- package/dist/Document.d.mts.map +1 -0
- package/dist/Document.mjs +147 -0
- package/dist/Document.mjs.map +1 -0
- package/dist/EffectSchema.cjs +180 -0
- package/dist/EffectSchema.d.cts +84 -0
- package/dist/EffectSchema.d.cts.map +1 -0
- package/dist/EffectSchema.d.mts +84 -0
- package/dist/EffectSchema.d.mts.map +1 -0
- package/dist/EffectSchema.mjs +176 -0
- package/dist/EffectSchema.mjs.map +1 -0
- package/dist/FractionalIndex.cjs +365 -0
- package/dist/FractionalIndex.mjs +364 -0
- package/dist/FractionalIndex.mjs.map +1 -0
- package/dist/Operation.cjs +53 -0
- package/dist/Operation.d.cts +39 -0
- package/dist/Operation.d.cts.map +1 -0
- package/dist/Operation.d.mts +39 -0
- package/dist/Operation.d.mts.map +1 -0
- package/dist/Operation.mjs +46 -0
- package/dist/Operation.mjs.map +1 -0
- package/dist/OperationDefinition.cjs +13 -0
- package/dist/OperationDefinition.d.cts +12 -0
- package/dist/OperationDefinition.d.cts.map +1 -0
- package/dist/OperationDefinition.d.mts +12 -0
- package/dist/OperationDefinition.d.mts.map +1 -0
- package/dist/OperationDefinition.mjs +13 -0
- package/dist/OperationDefinition.mjs.map +1 -0
- package/dist/OperationPath.cjs +148 -0
- package/dist/OperationPath.d.cts +60 -0
- package/dist/OperationPath.d.cts.map +1 -0
- package/dist/OperationPath.d.mts +60 -0
- package/dist/OperationPath.d.mts.map +1 -0
- package/dist/OperationPath.mjs +138 -0
- package/dist/OperationPath.mjs.map +1 -0
- package/dist/{Presence-gWrmGBeu.cjs → Presence.cjs} +4 -39
- package/dist/{Presence-N8u7Eppr.d.mts → Presence.d.cts} +2 -2
- package/dist/Presence.d.cts.map +1 -0
- package/dist/{Presence-DKKP4v5X.d.cts → Presence.d.mts} +2 -2
- package/dist/Presence.d.mts.map +1 -0
- package/dist/{Presence-DdMVKcOv.mjs → Presence.mjs} +3 -28
- package/dist/Presence.mjs.map +1 -0
- package/dist/Primitive.cjs +52 -0
- package/dist/Primitive.d.cts +20 -0
- package/dist/Primitive.d.cts.map +1 -0
- package/dist/Primitive.d.mts +20 -0
- package/dist/Primitive.d.mts.map +1 -0
- package/dist/Primitive.mjs +48 -0
- package/dist/Primitive.mjs.map +1 -0
- package/dist/ProxyEnvironment.cjs +34 -0
- package/dist/ProxyEnvironment.d.cts +31 -0
- package/dist/ProxyEnvironment.d.cts.map +1 -0
- package/dist/ProxyEnvironment.d.mts +31 -0
- package/dist/ProxyEnvironment.d.mts.map +1 -0
- package/dist/ProxyEnvironment.mjs +29 -0
- package/dist/ProxyEnvironment.mjs.map +1 -0
- package/dist/Transaction.cjs +66 -0
- package/dist/Transaction.d.cts +56 -0
- package/dist/Transaction.d.cts.map +1 -0
- package/dist/Transaction.d.mts +56 -0
- package/dist/Transaction.d.mts.map +1 -0
- package/dist/Transaction.mjs +58 -0
- package/dist/Transaction.mjs.map +1 -0
- package/dist/Transform.cjs +11 -0
- package/dist/Transform.d.cts +21 -0
- package/dist/Transform.d.cts.map +1 -0
- package/dist/Transform.d.mts +21 -0
- package/dist/Transform.d.mts.map +1 -0
- package/dist/Transform.mjs +6 -0
- package/dist/Transform.mjs.map +1 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.cjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.cjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.cjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.cjs +18 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs +12 -0
- package/dist/_virtual/rolldown_runtime.cjs +43 -0
- package/dist/{chunk-CLMFDpHK.mjs → _virtual/rolldown_runtime.mjs} +1 -1
- package/dist/client/ClientDocument.cjs +590 -0
- package/dist/client/ClientDocument.d.cts +161 -0
- package/dist/client/ClientDocument.d.cts.map +1 -0
- package/dist/client/ClientDocument.d.mts +162 -0
- package/dist/client/ClientDocument.d.mts.map +1 -0
- package/dist/client/ClientDocument.mjs +586 -0
- package/dist/client/ClientDocument.mjs.map +1 -0
- package/dist/client/Rebase.cjs +204 -0
- package/dist/client/Rebase.d.cts +87 -0
- package/dist/client/Rebase.d.cts.map +1 -0
- package/dist/client/Rebase.d.mts +88 -0
- package/dist/client/Rebase.d.mts.map +1 -0
- package/dist/client/Rebase.mjs +198 -0
- package/dist/client/Rebase.mjs.map +1 -0
- package/dist/client/StateMonitor.cjs +133 -0
- package/dist/client/StateMonitor.d.cts +122 -0
- package/dist/client/StateMonitor.d.cts.map +1 -0
- package/dist/client/StateMonitor.d.mts +122 -0
- package/dist/client/StateMonitor.d.mts.map +1 -0
- package/dist/client/StateMonitor.mjs +129 -0
- package/dist/client/StateMonitor.mjs.map +1 -0
- package/dist/client/Transport.cjs +11 -0
- package/dist/client/Transport.d.cts +237 -0
- package/dist/client/Transport.d.cts.map +1 -0
- package/dist/client/Transport.d.mts +237 -0
- package/dist/client/Transport.d.mts.map +1 -0
- package/dist/client/Transport.mjs +6 -0
- package/dist/client/Transport.mjs.map +1 -0
- package/dist/client/WebSocketTransport.cjs +396 -0
- package/dist/client/WebSocketTransport.d.cts +29 -0
- package/dist/client/WebSocketTransport.d.cts.map +1 -0
- package/dist/client/WebSocketTransport.d.mts +29 -0
- package/dist/client/WebSocketTransport.d.mts.map +1 -0
- package/dist/client/WebSocketTransport.mjs +392 -0
- package/dist/client/WebSocketTransport.mjs.map +1 -0
- package/dist/client/errors.cjs +135 -0
- package/dist/client/errors.d.cts +87 -0
- package/dist/client/errors.d.cts.map +1 -0
- package/dist/client/errors.d.mts +87 -0
- package/dist/client/errors.d.mts.map +1 -0
- package/dist/client/errors.mjs +127 -0
- package/dist/client/errors.mjs.map +1 -0
- package/dist/client/index.cjs +22 -1424
- package/dist/client/index.d.cts +8 -692
- package/dist/client/index.d.mts +8 -692
- package/dist/client/index.mjs +9 -1413
- package/dist/index.cjs +20 -2973
- package/dist/index.d.cts +12 -419
- package/dist/index.d.mts +12 -419
- package/dist/index.mjs +13 -2968
- package/dist/primitives/Array.cjs +302 -0
- package/dist/primitives/Array.d.cts +95 -0
- package/dist/primitives/Array.d.cts.map +1 -0
- package/dist/primitives/Array.d.mts +95 -0
- package/dist/primitives/Array.d.mts.map +1 -0
- package/dist/primitives/Array.mjs +301 -0
- package/dist/primitives/Array.mjs.map +1 -0
- package/dist/primitives/Boolean.cjs +95 -0
- package/dist/primitives/Boolean.d.cts +44 -0
- package/dist/primitives/Boolean.d.cts.map +1 -0
- package/dist/primitives/Boolean.d.mts +44 -0
- package/dist/primitives/Boolean.d.mts.map +1 -0
- package/dist/primitives/Boolean.mjs +94 -0
- package/dist/primitives/Boolean.mjs.map +1 -0
- package/dist/primitives/Either.cjs +200 -0
- package/dist/primitives/Either.d.cts +113 -0
- package/dist/primitives/Either.d.cts.map +1 -0
- package/dist/primitives/Either.d.mts +113 -0
- package/dist/primitives/Either.d.mts.map +1 -0
- package/dist/primitives/Either.mjs +199 -0
- package/dist/primitives/Either.mjs.map +1 -0
- package/dist/primitives/Lazy.cjs +46 -0
- package/dist/primitives/Lazy.d.cts +46 -0
- package/dist/primitives/Lazy.d.cts.map +1 -0
- package/dist/primitives/Lazy.d.mts +46 -0
- package/dist/primitives/Lazy.d.mts.map +1 -0
- package/dist/primitives/Lazy.mjs +46 -0
- package/dist/primitives/Lazy.mjs.map +1 -0
- package/dist/primitives/Literal.cjs +91 -0
- package/dist/primitives/Literal.d.cts +46 -0
- package/dist/primitives/Literal.d.cts.map +1 -0
- package/dist/primitives/Literal.d.mts +46 -0
- package/dist/primitives/Literal.d.mts.map +1 -0
- package/dist/primitives/Literal.mjs +90 -0
- package/dist/primitives/Literal.mjs.map +1 -0
- package/dist/primitives/Number.cjs +115 -0
- package/dist/primitives/Number.d.cts +54 -0
- package/dist/primitives/Number.d.cts.map +1 -0
- package/dist/primitives/Number.d.mts +54 -0
- package/dist/primitives/Number.d.mts.map +1 -0
- package/dist/primitives/Number.mjs +114 -0
- package/dist/primitives/Number.mjs.map +1 -0
- package/dist/primitives/String.cjs +127 -0
- package/dist/primitives/String.d.cts +56 -0
- package/dist/primitives/String.d.cts.map +1 -0
- package/dist/primitives/String.d.mts +56 -0
- package/dist/primitives/String.d.mts.map +1 -0
- package/dist/primitives/String.mjs +126 -0
- package/dist/primitives/String.mjs.map +1 -0
- package/dist/primitives/Struct.cjs +207 -0
- package/dist/primitives/Struct.d.cts +96 -0
- package/dist/primitives/Struct.d.cts.map +1 -0
- package/dist/primitives/Struct.d.mts +97 -0
- package/dist/primitives/Struct.d.mts.map +1 -0
- package/dist/primitives/Struct.mjs +206 -0
- package/dist/primitives/Struct.mjs.map +1 -0
- package/dist/primitives/Tree.cjs +575 -0
- package/dist/primitives/Tree.d.cts +185 -0
- package/dist/primitives/Tree.d.cts.map +1 -0
- package/dist/primitives/Tree.d.mts +185 -0
- package/dist/primitives/Tree.d.mts.map +1 -0
- package/dist/primitives/Tree.mjs +574 -0
- package/dist/primitives/Tree.mjs.map +1 -0
- package/dist/primitives/TreeNode.cjs +73 -0
- package/dist/primitives/TreeNode.d.cts +92 -0
- package/dist/primitives/TreeNode.d.cts.map +1 -0
- package/dist/primitives/TreeNode.d.mts +93 -0
- package/dist/primitives/TreeNode.d.mts.map +1 -0
- package/dist/primitives/TreeNode.mjs +72 -0
- package/dist/primitives/TreeNode.mjs.map +1 -0
- package/dist/primitives/Union.cjs +170 -0
- package/dist/primitives/Union.d.cts +81 -0
- package/dist/primitives/Union.d.cts.map +1 -0
- package/dist/primitives/Union.d.mts +81 -0
- package/dist/primitives/Union.d.mts.map +1 -0
- package/dist/primitives/Union.mjs +169 -0
- package/dist/primitives/Union.mjs.map +1 -0
- package/dist/primitives/shared.cjs +60 -0
- package/dist/primitives/shared.d.cts +147 -0
- package/dist/primitives/shared.d.cts.map +1 -0
- package/dist/primitives/shared.d.mts +147 -0
- package/dist/primitives/shared.d.mts.map +1 -0
- package/dist/primitives/shared.mjs +58 -0
- package/dist/primitives/shared.mjs.map +1 -0
- package/dist/server/ServerDocument.cjs +110 -0
- package/dist/server/ServerDocument.d.cts +98 -0
- package/dist/server/ServerDocument.d.cts.map +1 -0
- package/dist/server/ServerDocument.d.mts +99 -0
- package/dist/server/ServerDocument.d.mts.map +1 -0
- package/dist/server/ServerDocument.mjs +106 -0
- package/dist/server/ServerDocument.mjs.map +1 -0
- package/dist/server/errors.cjs +85 -0
- package/dist/server/errors.d.cts +53 -0
- package/dist/server/errors.d.cts.map +1 -0
- package/dist/server/errors.d.mts +53 -0
- package/dist/server/errors.d.mts.map +1 -0
- package/dist/server/errors.mjs +81 -0
- package/dist/server/errors.mjs.map +1 -0
- package/dist/server/index.cjs +9 -185
- package/dist/server/index.d.cts +3 -148
- package/dist/server/index.d.mts +3 -148
- package/dist/server/index.mjs +3 -181
- package/dist/types/index.cjs +16 -0
- package/dist/types/index.d.cts +16 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.mts +16 -0
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/index.mjs +12 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/utils/tree-helpers.cjs +443 -0
- package/dist/utils/tree-helpers.d.cts +280 -0
- package/dist/utils/tree-helpers.d.cts.map +1 -0
- package/dist/utils/tree-helpers.d.mts +280 -0
- package/dist/utils/tree-helpers.d.mts.map +1 -0
- package/dist/utils/tree-helpers.mjs +439 -0
- package/dist/utils/tree-helpers.mjs.map +1 -0
- package/package.json +2 -2
- package/tsdown.config.ts +1 -1
- package/dist/Document-ChuFrTk1.cjs +0 -571
- package/dist/Document-CwiAFTIq.mjs +0 -438
- package/dist/Document-CwiAFTIq.mjs.map +0 -1
- package/dist/Presence-DKKP4v5X.d.cts.map +0 -1
- package/dist/Presence-DdMVKcOv.mjs.map +0 -1
- package/dist/Presence-N8u7Eppr.d.mts.map +0 -1
- package/dist/Primitive-DqQFc3Gu.d.mts +0 -1180
- package/dist/Primitive-DqQFc3Gu.d.mts.map +0 -1
- package/dist/Primitive-awpEjnKL.d.cts +0 -1180
- package/dist/Primitive-awpEjnKL.d.cts.map +0 -1
- package/dist/client/index.d.cts.map +0 -1
- package/dist/client/index.d.mts.map +0 -1
- package/dist/client/index.mjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/server/index.d.cts.map +0 -1
- package/dist/server/index.d.mts.map +0 -1
- package/dist/server/index.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Either.mjs","names":["OperationDefinition.make","Operation.fromDefinition","OperationPath.pathsOverlap","syntheticOp: Operation.Operation<any, any, any>"],"sources":["../../src/primitives/Either.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport * as OperationDefinition from \"../OperationDefinition\";\nimport * as Operation from \"../Operation\";\nimport * as OperationPath from \"../OperationPath\";\nimport * as ProxyEnvironment from \"../ProxyEnvironment\";\nimport * as Transform from \"../Transform\";\nimport type { Primitive, PrimitiveInternal, MaybeUndefined, InferState, NeedsValue } from \"./shared\";\nimport { ValidationError } from \"./shared\";\nimport { StringPrimitive } from \"./String\";\nimport { NumberPrimitive } from \"./Number\";\nimport { BooleanPrimitive } from \"./Boolean\";\nimport { LiteralPrimitive, LiteralValue } from \"./Literal\";\n\n// =============================================================================\n// Either Primitive - Simple Type Union\n// =============================================================================\n\ntype InferSetInput<TVariants extends readonly ScalarPrimitive[], TRequired extends boolean = false, THasDefault extends boolean = false> = NeedsValue<InferEitherState<TVariants>, TRequired, THasDefault>\ntype InferUpdateInput<TVariants extends readonly ScalarPrimitive[], TRequired extends boolean = false, THasDefault extends boolean = false> = NeedsValue<InferEitherState<TVariants>, TRequired, THasDefault>\n\n/**\n * Scalar primitives that can be used as variants in Either\n */\nexport type ScalarPrimitive =\n | StringPrimitive<any, any>\n | NumberPrimitive<any, any>\n | BooleanPrimitive<any, any>\n | LiteralPrimitive<any, any, any>;\n\n/**\n * Infer the union state type from a tuple of scalar primitives\n */\nexport type InferEitherState<TVariants extends readonly ScalarPrimitive[]> =\n InferState<TVariants[number]>;\n\n/**\n * Infer the union snapshot type from a tuple of scalar primitives\n */\nexport type InferEitherSnapshot<TVariants extends readonly ScalarPrimitive[]> =\n InferState<TVariants[number]>;\n\n/**\n * Match handlers for Either - optional handlers for each scalar type\n */\nexport interface EitherMatchHandlers<R> {\n string?: (value: string) => R;\n number?: (value: number) => R;\n boolean?: (value: boolean) => R;\n literal?: (value: LiteralValue) => R;\n}\n\n/**\n * Proxy for accessing Either values\n */\nexport interface EitherProxy<TVariants extends readonly ScalarPrimitive[], TRequired extends boolean = false, THasDefault extends boolean = false> {\n /** Gets the current value */\n get(): MaybeUndefined<InferEitherState<TVariants>, TRequired, THasDefault>;\n\n /** Sets the value to any of the allowed variant types */\n set(value: InferSetInput<TVariants, TRequired, THasDefault>): void;\n\n /** This is the same as set. Updates the value, generating an either.set operation */\n update(value: InferUpdateInput<TVariants, TRequired, THasDefault>): void;\n\n /** Pattern match on the value type */\n match<R>(handlers: EitherMatchHandlers<R>): R | undefined;\n\n /** Returns a readonly snapshot of the value for rendering */\n toSnapshot(): MaybeUndefined<InferEitherSnapshot<TVariants>, TRequired, THasDefault>;\n}\n\ninterface EitherPrimitiveSchema<TVariants extends readonly ScalarPrimitive[]> {\n readonly required: boolean;\n readonly defaultValue: InferEitherState<TVariants> | undefined;\n readonly variants: TVariants;\n}\n\nexport class EitherPrimitive<TVariants extends readonly ScalarPrimitive[], TRequired extends boolean = false, THasDefault extends boolean = false>\n implements Primitive<InferEitherState<TVariants>, EitherProxy<TVariants, TRequired, THasDefault>, TRequired, THasDefault, InferSetInput<TVariants, TRequired, THasDefault>, InferUpdateInput<TVariants, TRequired, THasDefault>>\n{\n readonly _tag = \"EitherPrimitive\" as const;\n readonly _State!: InferEitherState<TVariants>;\n readonly _Proxy!: EitherProxy<TVariants, TRequired, THasDefault>;\n readonly _TRequired!: TRequired;\n readonly _THasDefault!: THasDefault;\n readonly TUpdateInput!: InferUpdateInput<TVariants, TRequired, THasDefault>;\n readonly TSetInput!: InferSetInput<TVariants, TRequired, THasDefault>;\n\n private readonly _schema: EitherPrimitiveSchema<TVariants>;\n\n private readonly _opDefinitions = {\n set: OperationDefinition.make({\n kind: \"either.set\" as const,\n payload: Schema.Unknown,\n target: Schema.Unknown,\n apply: (payload) => payload,\n }),\n };\n\n constructor(schema: EitherPrimitiveSchema<TVariants>) {\n this._schema = schema;\n }\n\n /** Mark this either as required */\n required(): EitherPrimitive<TVariants, true, THasDefault> {\n return new EitherPrimitive({\n ...this._schema,\n required: true,\n });\n }\n\n /** Set a default value for this either */\n default(defaultValue: InferEitherState<TVariants>): EitherPrimitive<TVariants, TRequired, true> {\n return new EitherPrimitive({\n ...this._schema,\n defaultValue,\n });\n }\n\n /** Get the variants */\n get variants(): TVariants {\n return this._schema.variants;\n }\n\n /**\n * Determine the type category of a value based on the variants\n */\n private _getValueType(value: unknown): \"string\" | \"number\" | \"boolean\" | \"literal\" | undefined {\n const valueType = typeof value;\n\n // Check for literal matches first (they take priority)\n for (const variant of this._schema.variants) {\n if (variant._tag === \"LiteralPrimitive\") {\n const literalVariant = variant as LiteralPrimitive<any, any, any>;\n if (value === literalVariant.literal) {\n return \"literal\";\n }\n }\n }\n\n // Check for type matches\n if (valueType === \"string\") {\n for (const variant of this._schema.variants) {\n if (variant._tag === \"StringPrimitive\") {\n return \"string\";\n }\n }\n }\n\n if (valueType === \"number\") {\n for (const variant of this._schema.variants) {\n if (variant._tag === \"NumberPrimitive\") {\n return \"number\";\n }\n }\n }\n\n if (valueType === \"boolean\") {\n for (const variant of this._schema.variants) {\n if (variant._tag === \"BooleanPrimitive\") {\n return \"boolean\";\n }\n }\n }\n\n return undefined;\n }\n\n /**\n * Find the matching variant for a value.\n * For literals, matches exact value. For other types, matches by typeof.\n */\n private _findMatchingVariant(value: unknown): ScalarPrimitive | undefined {\n const valueType = typeof value;\n\n // Check for literal matches first (they take priority)\n for (const variant of this._schema.variants) {\n if (variant._tag === \"LiteralPrimitive\") {\n const literalVariant = variant as LiteralPrimitive<any, any, any>;\n if (value === literalVariant.literal) {\n return variant;\n }\n }\n }\n\n // Check for type matches\n if (valueType === \"string\") {\n for (const variant of this._schema.variants) {\n if (variant._tag === \"StringPrimitive\") {\n return variant;\n }\n }\n }\n\n if (valueType === \"number\") {\n for (const variant of this._schema.variants) {\n if (variant._tag === \"NumberPrimitive\") {\n return variant;\n }\n }\n }\n\n if (valueType === \"boolean\") {\n for (const variant of this._schema.variants) {\n if (variant._tag === \"BooleanPrimitive\") {\n return variant;\n }\n }\n }\n\n return undefined;\n }\n\n /**\n * Get the operation kind for a variant\n */\n private _getVariantOperationKind(variant: ScalarPrimitive): string {\n switch (variant._tag) {\n case \"StringPrimitive\":\n return \"string.set\";\n case \"NumberPrimitive\":\n return \"number.set\";\n case \"BooleanPrimitive\":\n return \"boolean.set\";\n case \"LiteralPrimitive\":\n return \"literal.set\";\n default:\n return \"unknown.set\";\n }\n }\n\n /**\n * Validate a value against the matching variant, including running its validators.\n * Throws ValidationError if the value doesn't match any variant or fails validation.\n */\n private _validateAndApplyToVariant(value: unknown, path: OperationPath.OperationPath): void {\n const matchingVariant = this._findMatchingVariant(value);\n \n if (!matchingVariant) {\n const allowedTypes = this._schema.variants.map((v) => v._tag).join(\", \");\n throw new ValidationError(\n `EitherPrimitive.set requires a value matching one of: ${allowedTypes}, got: ${typeof value}`\n );\n }\n\n // Create a synthetic operation for the variant's applyOperation\n const variantOpKind = this._getVariantOperationKind(matchingVariant);\n const syntheticOp: Operation.Operation<any, any, any> = {\n kind: variantOpKind,\n path: path,\n payload: value,\n };\n\n // Delegate to the variant's applyOperation which runs its validators\n // This will throw ValidationError if validation fails\n matchingVariant._internal.applyOperation(undefined, syntheticOp);\n }\n\n readonly _internal: PrimitiveInternal<InferEitherState<TVariants>, EitherProxy<TVariants, TRequired, THasDefault>> = {\n createProxy: (\n env: ProxyEnvironment.ProxyEnvironment,\n operationPath: OperationPath.OperationPath\n ): EitherProxy<TVariants, TRequired, THasDefault> => {\n const defaultValue = this._schema.defaultValue;\n\n return {\n get: (): MaybeUndefined<InferEitherState<TVariants>, TRequired, THasDefault> => {\n const state = env.getState(operationPath) as InferEitherState<TVariants> | undefined;\n return (state ?? defaultValue) as MaybeUndefined<InferEitherState<TVariants>, TRequired, THasDefault>;\n },\n set: (value: InferSetInput<TVariants, TRequired, THasDefault>) => {\n env.addOperation(\n Operation.fromDefinition(operationPath, this._opDefinitions.set, value)\n );\n },\n update: (value: InferUpdateInput<TVariants, TRequired, THasDefault>) => {\n env.addOperation(\n Operation.fromDefinition(operationPath, this._opDefinitions.set, value)\n );\n },\n match: <R,>(handlers: EitherMatchHandlers<R>): R | undefined => {\n const currentState = env.getState(operationPath) as InferEitherState<TVariants> | undefined;\n const effectiveState = currentState ?? defaultValue;\n if (effectiveState === undefined) return undefined;\n\n const valueType = this._getValueType(effectiveState);\n if (!valueType) return undefined;\n\n switch (valueType) {\n case \"string\":\n return handlers.string?.(effectiveState as string);\n case \"number\":\n return handlers.number?.(effectiveState as number);\n case \"boolean\":\n return handlers.boolean?.(effectiveState as boolean);\n case \"literal\":\n return handlers.literal?.(effectiveState as LiteralValue);\n default:\n return undefined;\n }\n },\n toSnapshot: (): MaybeUndefined<InferEitherSnapshot<TVariants>, TRequired, THasDefault> => {\n const state = env.getState(operationPath) as InferEitherState<TVariants> | undefined;\n return (state ?? defaultValue) as MaybeUndefined<InferEitherSnapshot<TVariants>, TRequired, THasDefault>;\n },\n };\n },\n\n applyOperation: (\n _state: InferEitherState<TVariants> | undefined,\n operation: Operation.Operation<any, any, any>\n ): InferEitherState<TVariants> => {\n if (operation.kind !== \"either.set\") {\n throw new ValidationError(`EitherPrimitive cannot apply operation of kind: ${operation.kind}`);\n }\n\n const payload = operation.payload;\n\n // Validate that the payload matches one of the variant types and passes its validators\n this._validateAndApplyToVariant(payload, operation.path);\n\n return payload as InferEitherState<TVariants>;\n },\n\n getInitialState: (): InferEitherState<TVariants> | undefined => {\n return this._schema.defaultValue;\n },\n\n transformOperation: (\n clientOp: Operation.Operation<any, any, any>,\n serverOp: Operation.Operation<any, any, any>\n ): Transform.TransformResult => {\n // If paths don't overlap, no transformation needed\n if (!OperationPath.pathsOverlap(clientOp.path, serverOp.path)) {\n return { type: \"transformed\", operation: clientOp };\n }\n\n // For same path, client wins (last-write-wins)\n return { type: \"transformed\", operation: clientOp };\n },\n };\n}\n\n/**\n * Creates a new EitherPrimitive with the given scalar variant types.\n * Validators defined on the variants are applied when validating values.\n *\n * @example\n * ```typescript\n * // String or number\n * const value = Either(String(), Number());\n *\n * // String, number, or boolean\n * const status = Either(String(), Number(), Boolean()).default(\"pending\");\n *\n * // With literal types\n * const mode = Either(Literal(\"auto\"), Literal(\"manual\"), Number());\n *\n * // With validators - validates string length and number range\n * const constrained = Either(\n * String().min(2).max(50),\n * Number().max(255)\n * );\n * ```\n */\nexport function Either<TVariants extends readonly ScalarPrimitive[]>(\n ...variants: TVariants\n): EitherPrimitive<TVariants, false, false> {\n if (variants.length === 0) {\n throw new ValidationError(\"Either requires at least one variant\");\n }\n\n return new EitherPrimitive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S,kBACnB,QAAO;;AAKb,MAAI,cAAc,WAChB;QAAK,MAAM,WAAW,KAAK,QAAQ,SACjC,KAAI,QAAQ,SAAS,mBACnB,QAAO;;;;;;CAWf,AAAQ,yBAAyB,SAAkC;AACjE,UAAQ,QAAQ,MAAhB;GACE,KAAK,kBACH,QAAO;GACT,KAAK,kBACH,QAAO;GACT,KAAK,mBACH,QAAO;GACT,KAAK,mBACH,QAAO;GACT,QACE,QAAO;;;;;;;CAQb,AAAQ,2BAA2B,OAAgB,MAAyC;EAC1F,MAAM,kBAAkB,KAAK,qBAAqB,MAAM;AAExD,MAAI,CAAC,gBAEH,OAAM,IAAI,gBACR,yDAFmB,KAAK,QAAQ,SAAS,KAAK,MAAM,EAAE,KAAK,CAAC,KAAK,KAAK,CAEA,SAAS,OAAO,QACvF;EAKH,MAAMC,cAAkD;GACtD,MAFoB,KAAK,yBAAyB,gBAAgB;GAG5D;GACN,SAAS;GACV;AAID,kBAAgB,UAAU,eAAe,QAAW,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;AA8GpE,SAAgB,OACd,GAAG,UACuC;AAC1C,KAAI,SAAS,WAAW,EACtB,OAAM,IAAI,gBAAgB,uCAAuC;AAGnE,QAAO,IAAI,gBAAgB;EACzB,UAAU;EACV,cAAc;EACd;EACD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const require_defineProperty = require('../_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/primitives/Lazy.ts
|
|
4
|
+
var LazyPrimitive = class {
|
|
5
|
+
constructor(thunk) {
|
|
6
|
+
require_defineProperty._defineProperty(this, "_tag", "LazyPrimitive");
|
|
7
|
+
require_defineProperty._defineProperty(this, "_State", void 0);
|
|
8
|
+
require_defineProperty._defineProperty(this, "_Proxy", void 0);
|
|
9
|
+
require_defineProperty._defineProperty(this, "_TRequired", void 0);
|
|
10
|
+
require_defineProperty._defineProperty(this, "_THasDefault", void 0);
|
|
11
|
+
require_defineProperty._defineProperty(this, "TSetInput", void 0);
|
|
12
|
+
require_defineProperty._defineProperty(this, "TUpdateInput", void 0);
|
|
13
|
+
require_defineProperty._defineProperty(this, "_thunk", void 0);
|
|
14
|
+
require_defineProperty._defineProperty(this, "_resolved", void 0);
|
|
15
|
+
require_defineProperty._defineProperty(this, "_internal", {
|
|
16
|
+
createProxy: (env, operationPath) => {
|
|
17
|
+
return this._resolve()._internal.createProxy(env, operationPath);
|
|
18
|
+
},
|
|
19
|
+
applyOperation: (state, operation) => {
|
|
20
|
+
return this._resolve()._internal.applyOperation(state, operation);
|
|
21
|
+
},
|
|
22
|
+
getInitialState: () => {
|
|
23
|
+
return this._resolve()._internal.getInitialState();
|
|
24
|
+
},
|
|
25
|
+
transformOperation: (clientOp, serverOp) => {
|
|
26
|
+
return this._resolve()._internal.transformOperation(clientOp, serverOp);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
this._thunk = thunk;
|
|
30
|
+
}
|
|
31
|
+
/** Resolve and cache the lazy primitive */
|
|
32
|
+
_resolve() {
|
|
33
|
+
if (this._resolved === void 0) this._resolved = this._thunk();
|
|
34
|
+
return this._resolved;
|
|
35
|
+
}
|
|
36
|
+
/** Mark this lazy primitive as required (delegates to resolved) */
|
|
37
|
+
required() {
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
/** Creates a new LazyPrimitive with the given thunk */
|
|
42
|
+
const Lazy = (thunk) => new LazyPrimitive(thunk);
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
exports.Lazy = Lazy;
|
|
46
|
+
exports.LazyPrimitive = LazyPrimitive;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AnyPrimitive, InferProxy, InferSetInput, InferSnapshot, InferState, InferUpdateInput, Primitive, PrimitiveInternal } from "./shared.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/primitives/Lazy.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Type to infer SetInput from a lazy thunk
|
|
7
|
+
*/
|
|
8
|
+
type InferLazySetInput<T extends () => AnyPrimitive> = InferSetInput<ReturnType<T>>;
|
|
9
|
+
/**
|
|
10
|
+
* Type to infer UpdateInput from a lazy thunk
|
|
11
|
+
*/
|
|
12
|
+
type InferLazyUpdateInput<T extends () => AnyPrimitive> = InferUpdateInput<ReturnType<T>>;
|
|
13
|
+
/**
|
|
14
|
+
* Type to infer state from a lazy thunk
|
|
15
|
+
*/
|
|
16
|
+
type InferLazyState<T extends () => AnyPrimitive> = InferState<ReturnType<T>>;
|
|
17
|
+
/**
|
|
18
|
+
* Type to infer proxy from a lazy thunk
|
|
19
|
+
*/
|
|
20
|
+
type InferLazyProxy<T extends () => AnyPrimitive> = InferProxy<ReturnType<T>>;
|
|
21
|
+
/**
|
|
22
|
+
* Type to infer snapshot from a lazy thunk
|
|
23
|
+
*/
|
|
24
|
+
type InferLazySnapshot<T extends () => AnyPrimitive> = InferSnapshot<ReturnType<T>>;
|
|
25
|
+
declare class LazyPrimitive<TThunk extends () => AnyPrimitive> implements Primitive<InferLazyState<TThunk>, InferLazyProxy<TThunk>, false, false, InferLazySetInput<TThunk>, InferLazyUpdateInput<TThunk>> {
|
|
26
|
+
readonly _tag: "LazyPrimitive";
|
|
27
|
+
readonly _State: InferLazyState<TThunk>;
|
|
28
|
+
readonly _Proxy: InferLazyProxy<TThunk>;
|
|
29
|
+
readonly _TRequired: false;
|
|
30
|
+
readonly _THasDefault: false;
|
|
31
|
+
readonly TSetInput: InferLazySetInput<TThunk>;
|
|
32
|
+
readonly TUpdateInput: InferLazyUpdateInput<TThunk>;
|
|
33
|
+
private readonly _thunk;
|
|
34
|
+
private _resolved;
|
|
35
|
+
constructor(thunk: TThunk);
|
|
36
|
+
/** Resolve and cache the lazy primitive */
|
|
37
|
+
private _resolve;
|
|
38
|
+
/** Mark this lazy primitive as required (delegates to resolved) */
|
|
39
|
+
required(): LazyPrimitive<TThunk>;
|
|
40
|
+
readonly _internal: PrimitiveInternal<InferLazyState<TThunk>, InferLazyProxy<TThunk>>;
|
|
41
|
+
}
|
|
42
|
+
/** Creates a new LazyPrimitive with the given thunk */
|
|
43
|
+
declare const Lazy: <TThunk extends () => AnyPrimitive>(thunk: TThunk) => LazyPrimitive<TThunk>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { InferLazyProxy, InferLazySetInput, InferLazySnapshot, InferLazyState, InferLazyUpdateInput, Lazy, LazyPrimitive };
|
|
46
|
+
//# sourceMappingURL=Lazy.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lazy.d.cts","names":[],"sources":["../../src/primitives/Lazy.ts"],"sourcesContent":[],"mappings":";;;;;;AAaA;AAA8C,KAAlC,iBAAkC,CAAA,UAAA,GAAA,GAAA,YAAA,CAAA,GAAgB,aAAhB,CAA8B,UAA9B,CAAyC,CAAzC,CAAA,CAAA;;;;AAA6B,KAK/D,oBAL+D,CAAA,UAAA,GAAA,GAK1B,YAL0B,CAAA,GAKV,gBALU,CAKO,UALP,CAKkB,CALlB,CAAA,CAAA;AAK3E;;;AAAkF,KAMtE,cANsE,CAAA,UAAA,GAAA,GAMvC,YANuC,CAAA,GAMvB,UANuB,CAMZ,UANY,CAMD,CANC,CAAA,CAAA;;;AAMlF;AAA2C,KAK/B,cAL+B,CAAA,UAAA,GAAA,GAKA,YALA,CAAA,GAKgB,UALhB,CAK2B,UAL3B,CAKsC,CALtC,CAAA,CAAA;;;;AAA0B,KAUzD,iBAVyD,CAAA,UAAA,GAAA,GAUvB,YAVuB,CAAA,GAUP,aAVO,CAUO,UAVP,CAUkB,CAVlB,CAAA,CAAA;AAKzD,cAOC,aAPa,CAAA,eAAA,GAAA,GAOsB,YAPtB,CAAA,YAQb,SARa,CAQH,cARG,CAQY,MARZ,CAAA,EAQqB,cARrB,CAQoC,MARpC,CAAA,EAAA,KAAA,EAAA,KAAA,EAQ2D,iBAR3D,CAQ6E,MAR7E,CAAA,EAQsF,oBARtF,CAQ2G,MAR3G,CAAA,CAAA,CAAA;EAAiB,SAAA,IAAA,EAAA,eAAA;EAAsC,SAAA,MAAA,EAW7D,cAX6D,CAW9C,MAX8C,CAAA;EAAX,SAAA,MAAA,EAYlD,cAZkD,CAYnC,MAZmC,CAAA;EAAX,SAAA,UAAA,EAAA,KAAA;EAAU,SAAA,YAAA,EAAA,KAAA;EAKzD,SAAA,SAAA,EAUW,iBAVM,CAUY,MAVZ,CAAA;EAAiB,SAAA,YAAA,EAWpB,oBAXoB,CAWC,MAXD,CAAA;EAAyC,iBAAA,MAAA;EAAX,QAAA,SAAA;EAAd,WAAA,CAAA,KAAA,EAgBzC,MAhByC;EAAa;EAE9D,QAAA,QAAa;EAAsB;EACV,QAAA,CAAA,CAAA,EA0BxB,aA1BwB,CA0BV,MA1BU,CAAA;EAAf,SAAA,SAAA,EAgCD,iBAhCC,CAgCiB,cAhCjB,CAgCgC,MAhChC,CAAA,EAgCyC,cAhCzC,CAgCwD,MAhCxD,CAAA,CAAA;;;AAAgF,cA+D1F,IA/D0F,EAAA,CAAA,eAAA,GAAA,GA+D7D,YA/D6D,CAAA,CAAA,KAAA,EA+DxC,MA/DwC,EAAA,GA+D/B,aA/D+B,CA+DjB,MA/DiB,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AnyPrimitive, InferProxy, InferSetInput, InferSnapshot, InferState, InferUpdateInput, Primitive, PrimitiveInternal } from "./shared.mjs";
|
|
2
|
+
import "../Primitive.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/primitives/Lazy.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Type to infer SetInput from a lazy thunk
|
|
7
|
+
*/
|
|
8
|
+
type InferLazySetInput<T extends () => AnyPrimitive> = InferSetInput<ReturnType<T>>;
|
|
9
|
+
/**
|
|
10
|
+
* Type to infer UpdateInput from a lazy thunk
|
|
11
|
+
*/
|
|
12
|
+
type InferLazyUpdateInput<T extends () => AnyPrimitive> = InferUpdateInput<ReturnType<T>>;
|
|
13
|
+
/**
|
|
14
|
+
* Type to infer state from a lazy thunk
|
|
15
|
+
*/
|
|
16
|
+
type InferLazyState<T extends () => AnyPrimitive> = InferState<ReturnType<T>>;
|
|
17
|
+
/**
|
|
18
|
+
* Type to infer proxy from a lazy thunk
|
|
19
|
+
*/
|
|
20
|
+
type InferLazyProxy<T extends () => AnyPrimitive> = InferProxy<ReturnType<T>>;
|
|
21
|
+
/**
|
|
22
|
+
* Type to infer snapshot from a lazy thunk
|
|
23
|
+
*/
|
|
24
|
+
type InferLazySnapshot<T extends () => AnyPrimitive> = InferSnapshot<ReturnType<T>>;
|
|
25
|
+
declare class LazyPrimitive<TThunk extends () => AnyPrimitive> implements Primitive<InferLazyState<TThunk>, InferLazyProxy<TThunk>, false, false, InferLazySetInput<TThunk>, InferLazyUpdateInput<TThunk>> {
|
|
26
|
+
readonly _tag: "LazyPrimitive";
|
|
27
|
+
readonly _State: InferLazyState<TThunk>;
|
|
28
|
+
readonly _Proxy: InferLazyProxy<TThunk>;
|
|
29
|
+
readonly _TRequired: false;
|
|
30
|
+
readonly _THasDefault: false;
|
|
31
|
+
readonly TSetInput: InferLazySetInput<TThunk>;
|
|
32
|
+
readonly TUpdateInput: InferLazyUpdateInput<TThunk>;
|
|
33
|
+
private readonly _thunk;
|
|
34
|
+
private _resolved;
|
|
35
|
+
constructor(thunk: TThunk);
|
|
36
|
+
/** Resolve and cache the lazy primitive */
|
|
37
|
+
private _resolve;
|
|
38
|
+
/** Mark this lazy primitive as required (delegates to resolved) */
|
|
39
|
+
required(): LazyPrimitive<TThunk>;
|
|
40
|
+
readonly _internal: PrimitiveInternal<InferLazyState<TThunk>, InferLazyProxy<TThunk>>;
|
|
41
|
+
}
|
|
42
|
+
/** Creates a new LazyPrimitive with the given thunk */
|
|
43
|
+
declare const Lazy: <TThunk extends () => AnyPrimitive>(thunk: TThunk) => LazyPrimitive<TThunk>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { InferLazyProxy, InferLazySetInput, InferLazySnapshot, InferLazyState, InferLazyUpdateInput, Lazy, LazyPrimitive };
|
|
46
|
+
//# sourceMappingURL=Lazy.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lazy.d.mts","names":[],"sources":["../../src/primitives/Lazy.ts"],"sourcesContent":[],"mappings":";;;;;;;AAaY,KAAA,iBAAiB,CAAA,UAAA,GAAA,GAAiB,YAAjB,CAAA,GAAiC,aAAjC,CAA+C,UAA/C,CAA0D,CAA1D,CAAA,CAAA;;;;AAAiC,KAKlD,oBALkD,CAAA,UAAA,GAAA,GAKb,YALa,CAAA,GAKG,gBALH,CAKoB,UALpB,CAK+B,CAL/B,CAAA,CAAA;;AAK9D;;AAA6F,KAMjF,cANiF,CAAA,UAAA,GAAA,GAMlD,YANkD,CAAA,GAMlC,UANkC,CAMvB,UANuB,CAMZ,CANY,CAAA,CAAA;;;;AAMjF,KAKA,cALc,CAAA,UAAA,GAAA,GAKiB,YALjB,CAAA,GAKiC,UALjC,CAK4C,UAL5C,CAKuD,CALvD,CAAA,CAAA;;;;AAAiC,KAU/C,iBAV+C,CAAA,UAAA,GAAA,GAUb,YAVa,CAAA,GAUG,aAVH,CAUiB,UAVjB,CAU4B,CAV5B,CAAA,CAAA;AAAU,cAYxD,aAZwD,CAAA,eAAA,GAAA,GAYrB,YAZqB,CAAA,YAaxD,SAbwD,CAa9C,cAb8C,CAa/B,MAb+B,CAAA,EAatB,cAbsB,CAaP,MAbO,CAAA,EAAA,KAAA,EAAA,KAAA,EAagB,iBAbhB,CAakC,MAblC,CAAA,EAa2C,oBAb3C,CAagE,MAbhE,CAAA,CAAA,CAAA;EAKzD,SAAA,IAAA,EAAA,eAAc;EAAiB,SAAA,MAAA,EAWvB,cAXuB,CAWR,MAXQ,CAAA;EAAsC,SAAA,MAAA,EAY7D,cAZ6D,CAY9C,MAZ8C,CAAA;EAAX,SAAA,UAAA,EAAA,KAAA;EAAX,SAAA,YAAA,EAAA,KAAA;EAAU,SAAA,SAAA,EAe9C,iBAf8C,CAe5B,MAf4B,CAAA;EAKzD,SAAA,YAAiB,EAWH,oBAXG,CAWkB,MAXlB,CAAA;EAAiB,iBAAA,MAAA;EAAyC,QAAA,SAAA;EAAX,WAAA,CAAA,KAAA,EAgBvD,MAhBuD;EAAd;EAAa,QAAA,QAAA;EAE9D;EAAmC,QAAA,CAAA,CAAA,EA2BlC,aA3BkC,CA2BpB,MA3BoB,CAAA;EACV,SAAA,SAAA,EAgChB,iBAhCgB,CAgCE,cAhCF,CAgCiB,MAhCjB,CAAA,EAgC0B,cAhC1B,CAgCyC,MAhCzC,CAAA,CAAA;;;AAAS,cA+DlC,IA/DkC,EAAA,CAAA,eAAA,GAAA,GA+DL,YA/DK,CAAA,CAAA,KAAA,EA+DgB,MA/DhB,EAAA,GA+DyB,aA/DzB,CA+DuC,MA/DvC,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { _defineProperty } from "../_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/primitives/Lazy.ts
|
|
4
|
+
var LazyPrimitive = class {
|
|
5
|
+
constructor(thunk) {
|
|
6
|
+
_defineProperty(this, "_tag", "LazyPrimitive");
|
|
7
|
+
_defineProperty(this, "_State", void 0);
|
|
8
|
+
_defineProperty(this, "_Proxy", void 0);
|
|
9
|
+
_defineProperty(this, "_TRequired", void 0);
|
|
10
|
+
_defineProperty(this, "_THasDefault", void 0);
|
|
11
|
+
_defineProperty(this, "TSetInput", void 0);
|
|
12
|
+
_defineProperty(this, "TUpdateInput", void 0);
|
|
13
|
+
_defineProperty(this, "_thunk", void 0);
|
|
14
|
+
_defineProperty(this, "_resolved", void 0);
|
|
15
|
+
_defineProperty(this, "_internal", {
|
|
16
|
+
createProxy: (env, operationPath) => {
|
|
17
|
+
return this._resolve()._internal.createProxy(env, operationPath);
|
|
18
|
+
},
|
|
19
|
+
applyOperation: (state, operation) => {
|
|
20
|
+
return this._resolve()._internal.applyOperation(state, operation);
|
|
21
|
+
},
|
|
22
|
+
getInitialState: () => {
|
|
23
|
+
return this._resolve()._internal.getInitialState();
|
|
24
|
+
},
|
|
25
|
+
transformOperation: (clientOp, serverOp) => {
|
|
26
|
+
return this._resolve()._internal.transformOperation(clientOp, serverOp);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
this._thunk = thunk;
|
|
30
|
+
}
|
|
31
|
+
/** Resolve and cache the lazy primitive */
|
|
32
|
+
_resolve() {
|
|
33
|
+
if (this._resolved === void 0) this._resolved = this._thunk();
|
|
34
|
+
return this._resolved;
|
|
35
|
+
}
|
|
36
|
+
/** Mark this lazy primitive as required (delegates to resolved) */
|
|
37
|
+
required() {
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
/** Creates a new LazyPrimitive with the given thunk */
|
|
42
|
+
const Lazy = (thunk) => new LazyPrimitive(thunk);
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Lazy, LazyPrimitive };
|
|
46
|
+
//# sourceMappingURL=Lazy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lazy.mjs","names":[],"sources":["../../src/primitives/Lazy.ts"],"sourcesContent":["import { Effect, Schema } from \"effect\";\nimport * as OperationDefinition from \"../OperationDefinition\";\nimport * as Operation from \"../Operation\";\nimport * as OperationPath from \"../OperationPath\";\nimport * as ProxyEnvironment from \"../ProxyEnvironment\";\nimport * as Transform from \"../Transform\";\nimport type { Primitive, PrimitiveInternal, AnyPrimitive, InferState, InferProxy, InferSnapshot, InferSetInput, InferUpdateInput } from \"../Primitive\";\nimport { ValidationError } from \"../Primitive\";\nimport { runValidators } from \"./shared\";\n\n/**\n * Type to infer SetInput from a lazy thunk\n */\nexport type InferLazySetInput<T extends () => AnyPrimitive> = InferSetInput<ReturnType<T>>;\n\n/**\n * Type to infer UpdateInput from a lazy thunk\n */\nexport type InferLazyUpdateInput<T extends () => AnyPrimitive> = InferUpdateInput<ReturnType<T>>;\n\n\n/**\n * Type to infer state from a lazy thunk\n */\nexport type InferLazyState<T extends () => AnyPrimitive> = InferState<ReturnType<T>>;\n\n/**\n * Type to infer proxy from a lazy thunk\n */\nexport type InferLazyProxy<T extends () => AnyPrimitive> = InferProxy<ReturnType<T>>;\n\n/**\n * Type to infer snapshot from a lazy thunk\n */\nexport type InferLazySnapshot<T extends () => AnyPrimitive> = InferSnapshot<ReturnType<T>>;\n\nexport class LazyPrimitive<TThunk extends () => AnyPrimitive>\n implements Primitive<InferLazyState<TThunk>, InferLazyProxy<TThunk>, false, false, InferLazySetInput<TThunk>, InferLazyUpdateInput<TThunk>>\n{\n readonly _tag = \"LazyPrimitive\" as const;\n readonly _State!: InferLazyState<TThunk>;\n readonly _Proxy!: InferLazyProxy<TThunk>;\n readonly _TRequired!: false;\n readonly _THasDefault!: false;\n readonly TSetInput!: InferLazySetInput<TThunk>;\n readonly TUpdateInput!: InferLazyUpdateInput<TThunk>;\n\n private readonly _thunk: TThunk;\n private _resolved: ReturnType<TThunk> | undefined;\n\n constructor(thunk: TThunk) {\n this._thunk = thunk;\n }\n\n /** Resolve and cache the lazy primitive */\n private _resolve(): ReturnType<TThunk> {\n if (this._resolved === undefined) {\n this._resolved = this._thunk() as ReturnType<TThunk>;\n }\n return this._resolved;\n }\n\n /** Mark this lazy primitive as required (delegates to resolved) */\n required(): LazyPrimitive<TThunk> {\n // Note: For lazy, we can't easily propagate required to the resolved primitive\n // without resolving it first. This is a limitation.\n return this;\n }\n\n readonly _internal: PrimitiveInternal<InferLazyState<TThunk>, InferLazyProxy<TThunk>> = {\n createProxy: (env: ProxyEnvironment.ProxyEnvironment, operationPath: OperationPath.OperationPath): InferLazyProxy<TThunk> => {\n const resolved = this._resolve();\n return resolved._internal.createProxy(env, operationPath) as InferLazyProxy<TThunk>;\n },\n\n applyOperation: (\n state: InferLazyState<TThunk> | undefined,\n operation: Operation.Operation<any, any, any>\n ): InferLazyState<TThunk> => {\n const resolved = this._resolve();\n return resolved._internal.applyOperation(state, operation) as InferLazyState<TThunk>;\n },\n\n getInitialState: (): InferLazyState<TThunk> | undefined => {\n const resolved = this._resolve();\n return resolved._internal.getInitialState() as InferLazyState<TThunk> | undefined;\n },\n\n transformOperation: (\n clientOp: Operation.Operation<any, any, any>,\n serverOp: Operation.Operation<any, any, any>\n ): Transform.TransformResult => {\n // Delegate to resolved primitive\n const resolved = this._resolve();\n return resolved._internal.transformOperation(clientOp, serverOp);\n },\n };\n}\n\n/** Creates a new LazyPrimitive with the given thunk */\nexport const Lazy = <TThunk extends () => AnyPrimitive>(thunk: TThunk): LazyPrimitive<TThunk> =>\n new LazyPrimitive(thunk);\n\n"],"mappings":";;;AAoCA,IAAa,gBAAb,MAEA;CAYE,YAAY,OAAe;wBAXlB,QAAO;wBACP;wBACA;wBACA;wBACA;wBACA;wBACA;wBAEQ;wBACT;wBAqBC,aAA+E;GACtF,cAAc,KAAwC,kBAAuE;AAE3H,WADiB,KAAK,UAAU,CAChB,UAAU,YAAY,KAAK,cAAc;;GAG3D,iBACE,OACA,cAC2B;AAE3B,WADiB,KAAK,UAAU,CAChB,UAAU,eAAe,OAAO,UAAU;;GAG5D,uBAA2D;AAEzD,WADiB,KAAK,UAAU,CAChB,UAAU,iBAAiB;;GAG7C,qBACE,UACA,aAC8B;AAG9B,WADiB,KAAK,UAAU,CAChB,UAAU,mBAAmB,UAAU,SAAS;;GAEnE;AA7CC,OAAK,SAAS;;;CAIhB,AAAQ,WAA+B;AACrC,MAAI,KAAK,cAAc,OACrB,MAAK,YAAY,KAAK,QAAQ;AAEhC,SAAO,KAAK;;;CAId,WAAkC;AAGhC,SAAO;;;;AAkCX,MAAa,QAA2C,UACtD,IAAI,cAAc,MAAM"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_defineProperty = require('../_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.cjs');
|
|
3
|
+
const require_objectSpread2 = require('../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.cjs');
|
|
4
|
+
const require_shared = require('./shared.cjs');
|
|
5
|
+
const require_OperationDefinition = require('../OperationDefinition.cjs');
|
|
6
|
+
const require_OperationPath = require('../OperationPath.cjs');
|
|
7
|
+
const require_Operation = require('../Operation.cjs');
|
|
8
|
+
let effect = require("effect");
|
|
9
|
+
|
|
10
|
+
//#region src/primitives/Literal.ts
|
|
11
|
+
var LiteralPrimitive = class LiteralPrimitive {
|
|
12
|
+
constructor(schema) {
|
|
13
|
+
require_defineProperty._defineProperty(this, "_tag", "LiteralPrimitive");
|
|
14
|
+
require_defineProperty._defineProperty(this, "_State", void 0);
|
|
15
|
+
require_defineProperty._defineProperty(this, "_Proxy", void 0);
|
|
16
|
+
require_defineProperty._defineProperty(this, "_TRequired", void 0);
|
|
17
|
+
require_defineProperty._defineProperty(this, "_THasDefault", void 0);
|
|
18
|
+
require_defineProperty._defineProperty(this, "TUpdateInput", void 0);
|
|
19
|
+
require_defineProperty._defineProperty(this, "TSetInput", void 0);
|
|
20
|
+
require_defineProperty._defineProperty(this, "_schema", void 0);
|
|
21
|
+
require_defineProperty._defineProperty(this, "_opDefinitions", { set: require_OperationDefinition.make({
|
|
22
|
+
kind: "literal.set",
|
|
23
|
+
payload: effect.Schema.Unknown,
|
|
24
|
+
target: effect.Schema.Unknown,
|
|
25
|
+
apply: (payload) => payload
|
|
26
|
+
}) });
|
|
27
|
+
require_defineProperty._defineProperty(this, "_internal", {
|
|
28
|
+
createProxy: (env, operationPath) => {
|
|
29
|
+
const defaultValue = this._schema.defaultValue;
|
|
30
|
+
return {
|
|
31
|
+
get: () => {
|
|
32
|
+
const state = env.getState(operationPath);
|
|
33
|
+
return state !== null && state !== void 0 ? state : defaultValue;
|
|
34
|
+
},
|
|
35
|
+
set: (value) => {
|
|
36
|
+
env.addOperation(require_Operation.fromDefinition(operationPath, this._opDefinitions.set, value));
|
|
37
|
+
},
|
|
38
|
+
update: (value) => {
|
|
39
|
+
env.addOperation(require_Operation.fromDefinition(operationPath, this._opDefinitions.set, value));
|
|
40
|
+
},
|
|
41
|
+
toSnapshot: () => {
|
|
42
|
+
const state = env.getState(operationPath);
|
|
43
|
+
return state !== null && state !== void 0 ? state : defaultValue;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
applyOperation: (_state, operation) => {
|
|
48
|
+
if (operation.kind !== "literal.set") throw new require_shared.ValidationError(`LiteralPrimitive cannot apply operation of kind: ${operation.kind}`);
|
|
49
|
+
const payload = operation.payload;
|
|
50
|
+
if (payload !== this._schema.literal) throw new require_shared.ValidationError(`LiteralPrimitive.set requires the exact literal value "${globalThis.String(this._schema.literal)}", got: "${globalThis.String(payload)}"`);
|
|
51
|
+
return payload;
|
|
52
|
+
},
|
|
53
|
+
getInitialState: () => {
|
|
54
|
+
return this._schema.defaultValue;
|
|
55
|
+
},
|
|
56
|
+
transformOperation: (clientOp, serverOp) => {
|
|
57
|
+
if (!require_OperationPath.pathsOverlap(clientOp.path, serverOp.path)) return {
|
|
58
|
+
type: "transformed",
|
|
59
|
+
operation: clientOp
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
type: "transformed",
|
|
63
|
+
operation: clientOp
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
this._schema = schema;
|
|
68
|
+
}
|
|
69
|
+
/** Mark this literal as required */
|
|
70
|
+
required() {
|
|
71
|
+
return new LiteralPrimitive(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, this._schema), {}, { required: true }));
|
|
72
|
+
}
|
|
73
|
+
/** Set a default value for this literal */
|
|
74
|
+
default(defaultValue) {
|
|
75
|
+
return new LiteralPrimitive(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, this._schema), {}, { defaultValue }));
|
|
76
|
+
}
|
|
77
|
+
/** Get the literal value this primitive represents */
|
|
78
|
+
get literal() {
|
|
79
|
+
return this._schema.literal;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
/** Creates a new LiteralPrimitive with the given literal value */
|
|
83
|
+
const Literal = (literal) => new LiteralPrimitive({
|
|
84
|
+
required: false,
|
|
85
|
+
defaultValue: void 0,
|
|
86
|
+
literal
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
exports.Literal = Literal;
|
|
91
|
+
exports.LiteralPrimitive = LiteralPrimitive;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { MaybeUndefined, NeedsValue, Primitive, PrimitiveInternal } from "./shared.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/primitives/Literal.d.ts
|
|
4
|
+
/** Valid literal types */
|
|
5
|
+
type LiteralValue = string | number | boolean | null;
|
|
6
|
+
type InferSetInput<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> = NeedsValue<T, TRequired, THasDefault>;
|
|
7
|
+
type InferUpdateInput<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> = NeedsValue<T, TRequired, THasDefault>;
|
|
8
|
+
interface LiteralProxy<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> {
|
|
9
|
+
/** Gets the current literal value */
|
|
10
|
+
get(): MaybeUndefined<T, TRequired, THasDefault>;
|
|
11
|
+
/** Sets the literal value (must match the exact literal type) */
|
|
12
|
+
set(value: InferSetInput<T, TRequired, THasDefault>): void;
|
|
13
|
+
/** This is the same as set. Updates the literal value, generating a literal.set operation */
|
|
14
|
+
update(value: InferUpdateInput<T, TRequired, THasDefault>): void;
|
|
15
|
+
/** Returns a readonly snapshot of the literal value for rendering */
|
|
16
|
+
toSnapshot(): MaybeUndefined<T, TRequired, THasDefault>;
|
|
17
|
+
}
|
|
18
|
+
interface LiteralPrimitiveSchema<T extends LiteralValue> {
|
|
19
|
+
readonly required: boolean;
|
|
20
|
+
readonly defaultValue: T | undefined;
|
|
21
|
+
readonly literal: T;
|
|
22
|
+
}
|
|
23
|
+
declare class LiteralPrimitive<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> implements Primitive<T, LiteralProxy<T, TRequired, THasDefault>, TRequired, THasDefault, InferSetInput<T, TRequired, THasDefault>, InferUpdateInput<T, TRequired, THasDefault>> {
|
|
24
|
+
readonly _tag: "LiteralPrimitive";
|
|
25
|
+
readonly _State: T;
|
|
26
|
+
readonly _Proxy: LiteralProxy<T, TRequired, THasDefault>;
|
|
27
|
+
readonly _TRequired: TRequired;
|
|
28
|
+
readonly _THasDefault: THasDefault;
|
|
29
|
+
readonly TUpdateInput: InferUpdateInput<T, TRequired, THasDefault>;
|
|
30
|
+
readonly TSetInput: InferSetInput<T, TRequired, THasDefault>;
|
|
31
|
+
private readonly _schema;
|
|
32
|
+
private readonly _opDefinitions;
|
|
33
|
+
constructor(schema: LiteralPrimitiveSchema<T>);
|
|
34
|
+
/** Mark this literal as required */
|
|
35
|
+
required(): LiteralPrimitive<T, true, THasDefault>;
|
|
36
|
+
/** Set a default value for this literal */
|
|
37
|
+
default(defaultValue: T): LiteralPrimitive<T, TRequired, true>;
|
|
38
|
+
/** Get the literal value this primitive represents */
|
|
39
|
+
get literal(): T;
|
|
40
|
+
readonly _internal: PrimitiveInternal<T, LiteralProxy<T, TRequired, THasDefault>>;
|
|
41
|
+
}
|
|
42
|
+
/** Creates a new LiteralPrimitive with the given literal value */
|
|
43
|
+
declare const Literal: <T extends LiteralValue>(literal: T) => LiteralPrimitive<T, false, false>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Literal, LiteralPrimitive, LiteralProxy, LiteralValue };
|
|
46
|
+
//# sourceMappingURL=Literal.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Literal.d.cts","names":[],"sources":["../../src/primitives/Literal.ts"],"sourcesContent":[],"mappings":";;;;KAWY,YAAA;AA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edsValue, Primitive, PrimitiveInternal } from "./shared.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/primitives/Literal.d.ts
|
|
4
|
+
/** Valid literal types */
|
|
5
|
+
type LiteralValue = string | number | boolean | null;
|
|
6
|
+
type InferSetInput<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> = NeedsValue<T, TRequired, THasDefault>;
|
|
7
|
+
type InferUpdateInput<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> = NeedsValue<T, TRequired, THasDefault>;
|
|
8
|
+
interface LiteralProxy<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> {
|
|
9
|
+
/** Gets the current literal value */
|
|
10
|
+
get(): MaybeUndefined<T, TRequired, THasDefault>;
|
|
11
|
+
/** Sets the literal value (must match the exact literal type) */
|
|
12
|
+
set(value: InferSetInput<T, TRequired, THasDefault>): void;
|
|
13
|
+
/** This is the same as set. Updates the literal value, generating a literal.set operation */
|
|
14
|
+
update(value: InferUpdateInput<T, TRequired, THasDefault>): void;
|
|
15
|
+
/** Returns a readonly snapshot of the literal value for rendering */
|
|
16
|
+
toSnapshot(): MaybeUndefined<T, TRequired, THasDefault>;
|
|
17
|
+
}
|
|
18
|
+
interface LiteralPrimitiveSchema<T extends LiteralValue> {
|
|
19
|
+
readonly required: boolean;
|
|
20
|
+
readonly defaultValue: T | undefined;
|
|
21
|
+
readonly literal: T;
|
|
22
|
+
}
|
|
23
|
+
declare class LiteralPrimitive<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> implements Primitive<T, LiteralProxy<T, TRequired, THasDefault>, TRequired, THasDefault, InferSetInput<T, TRequired, THasDefault>, InferUpdateInput<T, TRequired, THasDefault>> {
|
|
24
|
+
readonly _tag: "LiteralPrimitive";
|
|
25
|
+
readonly _State: T;
|
|
26
|
+
readonly _Proxy: LiteralProxy<T, TRequired, THasDefault>;
|
|
27
|
+
readonly _TRequired: TRequired;
|
|
28
|
+
readonly _THasDefault: THasDefault;
|
|
29
|
+
readonly TUpdateInput: InferUpdateInput<T, TRequired, THasDefault>;
|
|
30
|
+
readonly TSetInput: InferSetInput<T, TRequired, THasDefault>;
|
|
31
|
+
private readonly _schema;
|
|
32
|
+
private readonly _opDefinitions;
|
|
33
|
+
constructor(schema: LiteralPrimitiveSchema<T>);
|
|
34
|
+
/** Mark this literal as required */
|
|
35
|
+
required(): LiteralPrimitive<T, true, THasDefault>;
|
|
36
|
+
/** Set a default value for this literal */
|
|
37
|
+
default(defaultValue: T): LiteralPrimitive<T, TRequired, true>;
|
|
38
|
+
/** Get the literal value this primitive represents */
|
|
39
|
+
get literal(): T;
|
|
40
|
+
readonly _internal: PrimitiveInternal<T, LiteralProxy<T, TRequired, THasDefault>>;
|
|
41
|
+
}
|
|
42
|
+
/** Creates a new LiteralPrimitive with the given literal value */
|
|
43
|
+
declare const Literal: <T extends LiteralValue>(literal: T) => LiteralPrimitive<T, false, false>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Literal, LiteralPrimitive, LiteralProxy, LiteralValue };
|
|
46
|
+
//# sourceMappingURL=Literal.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Literal.d.mts","names":[],"sources":["../../src/primitives/Literal.ts"],"sourcesContent":[],"mappings":";;;;KAWY,YAAA;AAAZ,KAEK,aAFO,CAAY,UAEK,YAFL,EAAA,kBAAA,OAAA,GAAA,KAAA,EAAA,oBAAA,OAAA,GAAA,KAAA,CAAA,GAE6F,UAF7F,CAEwG,CAFxG,EAE2G,SAF3G,EAEsH,WAFtH,CAAA;AAAoC,KAGvD,gBADa,CAAA,UACc,YADd,EAAA,kBAAA,OAAA,GAAA,KAAA,EAAA,oBAAA,OAAA,GAAA,KAAA,CAAA,GACsG,UADtG,CACiH,CADjH,EACoH,SADpH,EAC+H,WAD/H,CAAA;AAAW,UAGZ,YAHY,CAAA,UAGW,YAHX,EAAA,kBAAA,OAAA,GAAA,KAAA,EAAA,oBAAA,OAAA,G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gB,WAnBhB,CAAA;EAA5B,SAAA,SAAA,EAoBU,aApBV,CAoBwB,CApBxB,EAoB2B,SApB3B,EAoBsC,WApBtC,CAAA;EAEoB,iBAAA,OAAA;EAAG,iBAAA,cAAA;EAAW,WAAA,CAAA,MAAA,EA+BzB,sBA/ByB,CA+BF,CA/BE,CAAA;EAA/B;EAEe,QAAA,CAAA,CAAA,EAkCjB,gBAlCiB,CAkCA,CAlCA,EAAA,IAAA,EAkCS,WAlCT,CAAA;EAAG;EAAW,OAAA,CAAA,YAAA,EA0CrB,CA1CqB,CAAA,EA0CjB,gBA1CiB,CA0CA,CA1CA,EA0CG,SA1CH,EAAA,IAAA,CAAA;EAA7B;EAAc,IAAA,OAAA,CAAA,CAAA,EAkDb,CAlDa;EAGpB,SAAA,SAAA,EAmDY,iBAnDU,CAmDQ,CAnDR,EAmDW,YAnDX,CAmDwB,CAnDxB,EAmD2B,SAnD3B,EAmDsC,WAnDtC,CAAA,CAAA;;;AAGZ,cA4GP,OA5GO,EAAA,CAAA,UA4Gc,YA5Gd,CAAA,CAAA,OAAA,EA4GqC,CA5GrC,EAAA,GA4GyC,gBA5GzC,CA4G0D,CA5G1D,EAAA,KAAA,EAAA,KAAA,CAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { _defineProperty } from "../_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs";
|
|
2
|
+
import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs";
|
|
3
|
+
import { ValidationError } from "./shared.mjs";
|
|
4
|
+
import { make } from "../OperationDefinition.mjs";
|
|
5
|
+
import { pathsOverlap } from "../OperationPath.mjs";
|
|
6
|
+
import { fromDefinition } from "../Operation.mjs";
|
|
7
|
+
import { Schema } from "effect";
|
|
8
|
+
|
|
9
|
+
//#region src/primitives/Literal.ts
|
|
10
|
+
var LiteralPrimitive = class LiteralPrimitive {
|
|
11
|
+
constructor(schema) {
|
|
12
|
+
_defineProperty(this, "_tag", "LiteralPrimitive");
|
|
13
|
+
_defineProperty(this, "_State", void 0);
|
|
14
|
+
_defineProperty(this, "_Proxy", void 0);
|
|
15
|
+
_defineProperty(this, "_TRequired", void 0);
|
|
16
|
+
_defineProperty(this, "_THasDefault", void 0);
|
|
17
|
+
_defineProperty(this, "TUpdateInput", void 0);
|
|
18
|
+
_defineProperty(this, "TSetInput", void 0);
|
|
19
|
+
_defineProperty(this, "_schema", void 0);
|
|
20
|
+
_defineProperty(this, "_opDefinitions", { set: make({
|
|
21
|
+
kind: "literal.set",
|
|
22
|
+
payload: Schema.Unknown,
|
|
23
|
+
target: Schema.Unknown,
|
|
24
|
+
apply: (payload) => payload
|
|
25
|
+
}) });
|
|
26
|
+
_defineProperty(this, "_internal", {
|
|
27
|
+
createProxy: (env, operationPath) => {
|
|
28
|
+
const defaultValue = this._schema.defaultValue;
|
|
29
|
+
return {
|
|
30
|
+
get: () => {
|
|
31
|
+
const state = env.getState(operationPath);
|
|
32
|
+
return state !== null && state !== void 0 ? state : defaultValue;
|
|
33
|
+
},
|
|
34
|
+
set: (value) => {
|
|
35
|
+
env.addOperation(fromDefinition(operationPath, this._opDefinitions.set, value));
|
|
36
|
+
},
|
|
37
|
+
update: (value) => {
|
|
38
|
+
env.addOperation(fromDefinition(operationPath, this._opDefinitions.set, value));
|
|
39
|
+
},
|
|
40
|
+
toSnapshot: () => {
|
|
41
|
+
const state = env.getState(operationPath);
|
|
42
|
+
return state !== null && state !== void 0 ? state : defaultValue;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
applyOperation: (_state, operation) => {
|
|
47
|
+
if (operation.kind !== "literal.set") throw new ValidationError(`LiteralPrimitive cannot apply operation of kind: ${operation.kind}`);
|
|
48
|
+
const payload = operation.payload;
|
|
49
|
+
if (payload !== this._schema.literal) throw new ValidationError(`LiteralPrimitive.set requires the exact literal value "${globalThis.String(this._schema.literal)}", got: "${globalThis.String(payload)}"`);
|
|
50
|
+
return payload;
|
|
51
|
+
},
|
|
52
|
+
getInitialState: () => {
|
|
53
|
+
return this._schema.defaultValue;
|
|
54
|
+
},
|
|
55
|
+
transformOperation: (clientOp, serverOp) => {
|
|
56
|
+
if (!pathsOverlap(clientOp.path, serverOp.path)) return {
|
|
57
|
+
type: "transformed",
|
|
58
|
+
operation: clientOp
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
type: "transformed",
|
|
62
|
+
operation: clientOp
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
this._schema = schema;
|
|
67
|
+
}
|
|
68
|
+
/** Mark this literal as required */
|
|
69
|
+
required() {
|
|
70
|
+
return new LiteralPrimitive(_objectSpread2(_objectSpread2({}, this._schema), {}, { required: true }));
|
|
71
|
+
}
|
|
72
|
+
/** Set a default value for this literal */
|
|
73
|
+
default(defaultValue) {
|
|
74
|
+
return new LiteralPrimitive(_objectSpread2(_objectSpread2({}, this._schema), {}, { defaultValue }));
|
|
75
|
+
}
|
|
76
|
+
/** Get the literal value this primitive represents */
|
|
77
|
+
get literal() {
|
|
78
|
+
return this._schema.literal;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
/** Creates a new LiteralPrimitive with the given literal value */
|
|
82
|
+
const Literal = (literal) => new LiteralPrimitive({
|
|
83
|
+
required: false,
|
|
84
|
+
defaultValue: void 0,
|
|
85
|
+
literal
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
export { Literal, LiteralPrimitive };
|
|
90
|
+
//# sourceMappingURL=Literal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Literal.mjs","names":["OperationDefinition.make","Operation.fromDefinition","OperationPath.pathsOverlap"],"sources":["../../src/primitives/Literal.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport * as OperationDefinition from \"../OperationDefinition\";\nimport * as Operation from \"../Operation\";\nimport * as OperationPath from \"../OperationPath\";\nimport * as ProxyEnvironment from \"../ProxyEnvironment\";\nimport * as Transform from \"../Transform\";\nimport type { Primitive, PrimitiveInternal, MaybeUndefined, AnyPrimitive, Validator, NeedsValue } from \"./shared\";\nimport { ValidationError, runValidators, isCompatibleOperation } from \"./shared\";\n\n\n/** Valid literal types */\nexport type LiteralValue = string | number | boolean | null;\n\ntype InferSetInput<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> = NeedsValue<T, TRequired, THasDefault>\ntype InferUpdateInput<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> = NeedsValue<T, TRequired, THasDefault>\n\nexport interface LiteralProxy<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> {\n /** Gets the current literal value */\n get(): MaybeUndefined<T, TRequired, THasDefault>;\n /** Sets the literal value (must match the exact literal type) */\n set(value: InferSetInput<T, TRequired, THasDefault>): void;\n /** This is the same as set. Updates the literal value, generating a literal.set operation */\n update(value: InferUpdateInput<T, TRequired, THasDefault>): void;\n /** Returns a readonly snapshot of the literal value for rendering */\n toSnapshot(): MaybeUndefined<T, TRequired, THasDefault>;\n}\n\ninterface LiteralPrimitiveSchema<T extends LiteralValue> {\n readonly required: boolean;\n readonly defaultValue: T | undefined;\n readonly literal: T;\n}\n\nexport class LiteralPrimitive<T extends LiteralValue, TRequired extends boolean = false, THasDefault extends boolean = false> implements Primitive<T, LiteralProxy<T, TRequired, THasDefault>, TRequired, THasDefault, InferSetInput<T, TRequired, THasDefault>, InferUpdateInput<T, TRequired, THasDefault>> {\n readonly _tag = \"LiteralPrimitive\" as const;\n readonly _State!: T;\n readonly _Proxy!: LiteralProxy<T, TRequired, THasDefault>;\n readonly _TRequired!: TRequired;\n readonly _THasDefault!: THasDefault;\n readonly TUpdateInput!: InferUpdateInput<T, TRequired, THasDefault>;\n readonly TSetInput!: InferSetInput<T, TRequired, THasDefault>;\n\n private readonly _schema: LiteralPrimitiveSchema<T>;\n\n private readonly _opDefinitions = {\n set: OperationDefinition.make({\n kind: \"literal.set\" as const,\n payload: Schema.Unknown,\n target: Schema.Unknown,\n apply: (payload) => payload,\n }),\n };\n\n constructor(schema: LiteralPrimitiveSchema<T>) {\n this._schema = schema;\n }\n\n /** Mark this literal as required */\n required(): LiteralPrimitive<T, true, THasDefault> {\n return new LiteralPrimitive({\n ...this._schema,\n required: true,\n });\n }\n\n /** Set a default value for this literal */\n default(defaultValue: T): LiteralPrimitive<T, TRequired, true> {\n return new LiteralPrimitive({\n ...this._schema,\n defaultValue,\n });\n }\n\n /** Get the literal value this primitive represents */\n get literal(): T {\n return this._schema.literal;\n }\n\n readonly _internal: PrimitiveInternal<T, LiteralProxy<T, TRequired, THasDefault>> = {\n createProxy: (env: ProxyEnvironment.ProxyEnvironment, operationPath: OperationPath.OperationPath): LiteralProxy<T, TRequired, THasDefault> => {\n const defaultValue = this._schema.defaultValue;\n return {\n get: (): MaybeUndefined<T, TRequired, THasDefault> => {\n const state = env.getState(operationPath) as T | undefined;\n return (state ?? defaultValue) as MaybeUndefined<T, TRequired, THasDefault>;\n },\n set: (value: InferSetInput<T, TRequired, THasDefault>) => {\n env.addOperation(\n Operation.fromDefinition(operationPath, this._opDefinitions.set, value)\n );\n },\n update: (value: InferUpdateInput<T, TRequired, THasDefault>) => {\n env.addOperation(\n Operation.fromDefinition(operationPath, this._opDefinitions.set, value)\n );\n },\n toSnapshot: (): MaybeUndefined<T, TRequired, THasDefault> => {\n const state = env.getState(operationPath) as T | undefined;\n return (state ?? defaultValue) as MaybeUndefined<T, TRequired, THasDefault>;\n },\n };\n },\n\n applyOperation: (_state: T | undefined, operation: Operation.Operation<any, any, any>): T => {\n if (operation.kind !== \"literal.set\") {\n throw new ValidationError(`LiteralPrimitive cannot apply operation of kind: ${operation.kind}`);\n }\n\n const payload = operation.payload;\n if (payload !== this._schema.literal) {\n throw new ValidationError(\n `LiteralPrimitive.set requires the exact literal value \"${globalThis.String(this._schema.literal)}\", got: \"${globalThis.String(payload)}\"`\n );\n }\n\n return payload as T;\n },\n\n getInitialState: (): T | undefined => {\n return this._schema.defaultValue;\n },\n\n transformOperation: (\n clientOp: Operation.Operation<any, any, any>,\n serverOp: Operation.Operation<any, any, any>\n ): Transform.TransformResult => {\n // If paths don't overlap, no transformation needed\n if (!OperationPath.pathsOverlap(clientOp.path, serverOp.path)) {\n return { type: \"transformed\", operation: clientOp };\n }\n\n // For same path, client wins (last-write-wins)\n return { type: \"transformed\", operation: clientOp };\n },\n };\n}\n\n/** Creates a new LiteralPrimitive with the given literal value */\nexport const Literal = <T extends LiteralValue>(literal: T): LiteralPrimitive<T, false, false> =>\n new LiteralPrimitive({ required: false, defaultValue: undefined, literal });\n\n"],"mappings":";;;;;;;;;AAiCA,IAAa,mBAAb,MAAa,iBAAiS;CAoB5S,YAAY,QAAmC;wBAnBtC,QAAO;wBACP;wBACA;wBACA;wBACA;wBACA;wBACA;wBAEQ;wBAEA,kBAAiB,EAChC,KAAKA,KAAyB;GAC5B,MAAM;GACN,SAAS,OAAO;GAChB,QAAQ,OAAO;GACf,QAAQ,YAAY;GACrB,CAAC,EACH;wBA2BQ,aAA2E;GAClF,cAAc,KAAwC,kBAAwF;IAC5I,MAAM,eAAe,KAAK,QAAQ;AAClC,WAAO;KACL,WAAsD;MACpD,MAAM,QAAQ,IAAI,SAAS,cAAc;AACzC,aAAQ,6CAAS;;KAEnB,MAAM,UAAoD;AACxD,UAAI,aACFC,eAAyB,eAAe,KAAK,eAAe,KAAK,MAAM,CACxE;;KAEH,SAAS,UAAuD;AAC9D,UAAI,aACFA,eAAyB,eAAe,KAAK,eAAe,KAAK,MAAM,CACxE;;KAEH,kBAA6D;MAC3D,MAAM,QAAQ,IAAI,SAAS,cAAc;AACzC,aAAQ,6CAAS;;KAEpB;;GAGH,iBAAiB,QAAuB,cAAqD;AAC3F,QAAI,UAAU,SAAS,cACrB,OAAM,IAAI,gBAAgB,oDAAoD,UAAU,OAAO;IAGjG,MAAM,UAAU,UAAU;AAC1B,QAAI,YAAY,KAAK,QAAQ,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