qsharp-lang 1.27.1-dev → 1.27.3-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -22
- package/dist/cancellation.js +3 -1
- package/dist/compiler/compiler.d.ts +1 -1
- package/dist/compiler/compiler.js +1 -0
- package/dist/compiler/events.d.ts +1 -1
- package/dist/compiler/events.js +4 -4
- package/dist/compiler/{worker-browser.js → worker.js} +3 -2
- package/dist/data-structures/legacyCircuitUpdate.js +1 -1
- package/dist/debug-service/debug-service.d.ts +2 -2
- package/dist/debug-service/debug-service.js +2 -0
- package/dist/debug-service/{worker-browser.js → worker.js} +3 -2
- package/dist/diagnostics.js +1 -0
- package/dist/language-service/language-service.d.ts +2 -2
- package/dist/language-service/language-service.js +4 -1
- package/dist/language-service/{worker-browser.js → worker.js} +3 -2
- package/dist/main.d.ts +33 -11
- package/dist/main.js +115 -31
- package/dist/node.d.ts +1 -0
- package/dist/node.js +10 -0
- package/dist/project.js +1 -0
- package/dist/utils.js +2 -2
- package/dist/workers/{browser.d.ts → main.d.ts} +3 -10
- package/dist/workers/{common.js → main.js} +40 -139
- package/dist/workers/{common.d.ts → types.d.ts} +3 -26
- package/dist/workers/types.js +3 -0
- package/dist/workers/worker.d.ts +9 -0
- package/dist/workers/worker.js +176 -0
- package/docs/Microsoft.Quantum.Core/IsRangeEmpty.md +1 -1
- package/docs/Microsoft.Quantum.Core/Length.md +1 -1
- package/docs/Microsoft.Quantum.Core/RangeEnd.md +1 -1
- package/docs/Microsoft.Quantum.Core/RangeStart.md +1 -1
- package/docs/Microsoft.Quantum.Core/Repeated.md +1 -1
- package/docs/Microsoft.Quantum.Core/index.md +1 -1
- package/docs/Std.Arithmetic/AddLE.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfEqualL.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfEqualLE.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfGreaterL.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfGreaterLE.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfGreaterOrEqualL.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfGreaterOrEqualLE.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfLessL.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfLessLE.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfLessOrEqualL.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfLessOrEqualLE.md +1 -1
- package/docs/Std.Arithmetic/FourierTDIncByLE.md +1 -1
- package/docs/Std.Arithmetic/IncByI.md +1 -1
- package/docs/Std.Arithmetic/IncByIUsingIncByLE.md +1 -1
- package/docs/Std.Arithmetic/IncByL.md +1 -1
- package/docs/Std.Arithmetic/IncByLE.md +1 -1
- package/docs/Std.Arithmetic/IncByLEUsingAddLE.md +1 -1
- package/docs/Std.Arithmetic/IncByLUsingIncByLE.md +1 -1
- package/docs/Std.Arithmetic/LookAheadDKRSAddLE.md +1 -1
- package/docs/Std.Arithmetic/MAJ.md +1 -1
- package/docs/Std.Arithmetic/ReflectAboutInteger.md +1 -1
- package/docs/Std.Arithmetic/RippleCarryCGAddLE.md +1 -1
- package/docs/Std.Arithmetic/RippleCarryCGIncByLE.md +1 -1
- package/docs/Std.Arithmetic/RippleCarryTTKIncByLE.md +1 -1
- package/docs/Std.Arithmetic/index.md +1 -1
- package/docs/Std.Arrays/All.md +1 -1
- package/docs/Std.Arrays/Any.md +1 -1
- package/docs/Std.Arrays/Chunks.md +1 -1
- package/docs/Std.Arrays/CircularlyShifted.md +1 -1
- package/docs/Std.Arrays/ColumnAt.md +1 -1
- package/docs/Std.Arrays/Count.md +1 -1
- package/docs/Std.Arrays/Diagonal.md +1 -1
- package/docs/Std.Arrays/DrawMany.md +1 -1
- package/docs/Std.Arrays/Enumerated.md +1 -1
- package/docs/Std.Arrays/Excluding.md +1 -1
- package/docs/Std.Arrays/Filtered.md +1 -1
- package/docs/Std.Arrays/FlatMapped.md +1 -1
- package/docs/Std.Arrays/Flattened.md +1 -1
- package/docs/Std.Arrays/Fold.md +1 -1
- package/docs/Std.Arrays/ForEach.md +1 -1
- package/docs/Std.Arrays/Head.md +1 -1
- package/docs/Std.Arrays/HeadAndRest.md +1 -1
- package/docs/Std.Arrays/IndexOf.md +1 -1
- package/docs/Std.Arrays/IndexRange.md +1 -1
- package/docs/Std.Arrays/Interleaved.md +1 -1
- package/docs/Std.Arrays/IsEmpty.md +1 -1
- package/docs/Std.Arrays/IsRectangularArray.md +1 -1
- package/docs/Std.Arrays/IsSorted.md +1 -1
- package/docs/Std.Arrays/IsSquareArray.md +1 -1
- package/docs/Std.Arrays/Mapped.md +1 -1
- package/docs/Std.Arrays/MappedByIndex.md +1 -1
- package/docs/Std.Arrays/MappedOverRange.md +1 -1
- package/docs/Std.Arrays/Most.md +1 -1
- package/docs/Std.Arrays/MostAndTail.md +1 -1
- package/docs/Std.Arrays/Padded.md +1 -1
- package/docs/Std.Arrays/Partitioned.md +1 -1
- package/docs/Std.Arrays/Rest.md +1 -1
- package/docs/Std.Arrays/Reversed.md +1 -1
- package/docs/Std.Arrays/SequenceI.md +1 -1
- package/docs/Std.Arrays/SequenceL.md +1 -1
- package/docs/Std.Arrays/Sorted.md +1 -1
- package/docs/Std.Arrays/Subarray.md +1 -1
- package/docs/Std.Arrays/Swapped.md +1 -1
- package/docs/Std.Arrays/Tail.md +1 -1
- package/docs/Std.Arrays/Transposed.md +1 -1
- package/docs/Std.Arrays/Unzipped.md +1 -1
- package/docs/Std.Arrays/Where.md +1 -1
- package/docs/Std.Arrays/Windows.md +1 -1
- package/docs/Std.Arrays/Zipped.md +1 -1
- package/docs/Std.Arrays/index.md +1 -1
- package/docs/Std.Canon/ApplyCNOTChain.md +1 -1
- package/docs/Std.Canon/ApplyControlledOnBitString.md +1 -1
- package/docs/Std.Canon/ApplyControlledOnInt.md +1 -1
- package/docs/Std.Canon/ApplyOperationPowerA.md +1 -1
- package/docs/Std.Canon/ApplyOperationPowerCA.md +1 -1
- package/docs/Std.Canon/ApplyP.md +1 -1
- package/docs/Std.Canon/ApplyPauli.md +1 -1
- package/docs/Std.Canon/ApplyPauliFromBitString.md +1 -1
- package/docs/Std.Canon/ApplyPauliFromInt.md +1 -1
- package/docs/Std.Canon/ApplyQFT.md +1 -1
- package/docs/Std.Canon/ApplyQPE.md +1 -1
- package/docs/Std.Canon/ApplyToEach.md +1 -1
- package/docs/Std.Canon/ApplyToEachA.md +1 -1
- package/docs/Std.Canon/ApplyToEachC.md +1 -1
- package/docs/Std.Canon/ApplyToEachCA.md +1 -1
- package/docs/Std.Canon/ApplyXorInPlace.md +1 -1
- package/docs/Std.Canon/ApplyXorInPlaceL.md +1 -1
- package/docs/Std.Canon/CX.md +1 -1
- package/docs/Std.Canon/CY.md +1 -1
- package/docs/Std.Canon/CZ.md +1 -1
- package/docs/Std.Canon/Fst.md +1 -1
- package/docs/Std.Canon/MapPauliAxis.md +1 -1
- package/docs/Std.Canon/Relabel.md +1 -1
- package/docs/Std.Canon/Snd.md +1 -1
- package/docs/Std.Canon/SwapReverseRegister.md +1 -1
- package/docs/Std.Canon/index.md +1 -1
- package/docs/Std.Convert/BigIntAsBoolArray.md +1 -1
- package/docs/Std.Convert/BigIntAsInt.md +1 -1
- package/docs/Std.Convert/BoolArrayAsBigInt.md +1 -1
- package/docs/Std.Convert/BoolArrayAsInt.md +1 -1
- package/docs/Std.Convert/BoolArrayAsResultArray.md +1 -1
- package/docs/Std.Convert/BoolAsResult.md +1 -1
- package/docs/Std.Convert/ComplexAsComplexPolar.md +1 -1
- package/docs/Std.Convert/ComplexPolarAsComplex.md +1 -1
- package/docs/Std.Convert/DoubleAsStringWithPrecision.md +1 -1
- package/docs/Std.Convert/IntAsBigInt.md +1 -1
- package/docs/Std.Convert/IntAsBoolArray.md +1 -1
- package/docs/Std.Convert/IntAsDouble.md +1 -1
- package/docs/Std.Convert/ResultArrayAsBoolArray.md +1 -1
- package/docs/Std.Convert/ResultArrayAsInt.md +1 -1
- package/docs/Std.Convert/ResultAsBool.md +1 -1
- package/docs/Std.Convert/index.md +1 -1
- package/docs/Std.Core/Complex.md +1 -1
- package/docs/Std.Core/Length.md +1 -1
- package/docs/Std.Core/Repeated.md +1 -1
- package/docs/Std.Core/index.md +1 -1
- package/docs/Std.Diagnostics/ApplyIdleNoise.md +1 -1
- package/docs/Std.Diagnostics/BitFlipNoise.md +1 -1
- package/docs/Std.Diagnostics/CheckAllZero.md +1 -1
- package/docs/Std.Diagnostics/CheckOperationsAreEqual.md +1 -1
- package/docs/Std.Diagnostics/CheckZero.md +1 -1
- package/docs/Std.Diagnostics/ConfigurePauliNoise.md +1 -1
- package/docs/Std.Diagnostics/ConfigureQubitLoss.md +1 -1
- package/docs/Std.Diagnostics/DepolarizingNoise.md +1 -1
- package/docs/Std.Diagnostics/DumpMachine.md +1 -1
- package/docs/Std.Diagnostics/DumpOperation.md +1 -1
- package/docs/Std.Diagnostics/DumpRegister.md +1 -1
- package/docs/Std.Diagnostics/Fact.md +1 -1
- package/docs/Std.Diagnostics/NoNoise.md +1 -1
- package/docs/Std.Diagnostics/PhaseFlipNoise.md +1 -1
- package/docs/Std.Diagnostics/PostSelectZ.md +1 -1
- package/docs/Std.Diagnostics/StartCountingFunction.md +1 -1
- package/docs/Std.Diagnostics/StartCountingOperation.md +1 -1
- package/docs/Std.Diagnostics/StartCountingQubits.md +1 -1
- package/docs/Std.Diagnostics/StopCountingFunction.md +1 -1
- package/docs/Std.Diagnostics/StopCountingOperation.md +1 -1
- package/docs/Std.Diagnostics/StopCountingQubits.md +1 -1
- package/docs/Std.Diagnostics/index.md +1 -1
- package/docs/Std.Intrinsic/AND.md +1 -1
- package/docs/Std.Intrinsic/ApplyUnitary.md +1 -1
- package/docs/Std.Intrinsic/CCNOT.md +1 -1
- package/docs/Std.Intrinsic/CNOT.md +1 -1
- package/docs/Std.Intrinsic/Exp.md +1 -1
- package/docs/Std.Intrinsic/H.md +1 -1
- package/docs/Std.Intrinsic/I.md +1 -1
- package/docs/Std.Intrinsic/M.md +1 -1
- package/docs/Std.Intrinsic/Measure.md +1 -1
- package/docs/Std.Intrinsic/Message.md +1 -1
- package/docs/Std.Intrinsic/R.md +1 -1
- package/docs/Std.Intrinsic/R1.md +1 -1
- package/docs/Std.Intrinsic/R1Frac.md +1 -1
- package/docs/Std.Intrinsic/RFrac.md +1 -1
- package/docs/Std.Intrinsic/Reset.md +1 -1
- package/docs/Std.Intrinsic/ResetAll.md +1 -1
- package/docs/Std.Intrinsic/Rx.md +1 -1
- package/docs/Std.Intrinsic/Rxx.md +1 -1
- package/docs/Std.Intrinsic/Ry.md +1 -1
- package/docs/Std.Intrinsic/Ryy.md +1 -1
- package/docs/Std.Intrinsic/Rz.md +1 -1
- package/docs/Std.Intrinsic/Rzz.md +1 -1
- package/docs/Std.Intrinsic/S.md +1 -1
- package/docs/Std.Intrinsic/SWAP.md +1 -1
- package/docs/Std.Intrinsic/SX.md +1 -1
- package/docs/Std.Intrinsic/T.md +1 -1
- package/docs/Std.Intrinsic/X.md +1 -1
- package/docs/Std.Intrinsic/Y.md +1 -1
- package/docs/Std.Intrinsic/Z.md +1 -1
- package/docs/Std.Intrinsic/index.md +1 -1
- package/docs/Std.Logical/Xor.md +1 -1
- package/docs/Std.Logical/index.md +1 -1
- package/docs/Std.Math/AbsComplex.md +1 -1
- package/docs/Std.Math/AbsComplexPolar.md +1 -1
- package/docs/Std.Math/AbsD.md +1 -1
- package/docs/Std.Math/AbsI.md +1 -1
- package/docs/Std.Math/AbsL.md +1 -1
- package/docs/Std.Math/AbsSquaredComplex.md +1 -1
- package/docs/Std.Math/AbsSquaredComplexPolar.md +1 -1
- package/docs/Std.Math/ApproximateFactorial.md +1 -1
- package/docs/Std.Math/ArcCos.md +1 -1
- package/docs/Std.Math/ArcCosh.md +1 -1
- package/docs/Std.Math/ArcSin.md +1 -1
- package/docs/Std.Math/ArcSinh.md +1 -1
- package/docs/Std.Math/ArcTan.md +1 -1
- package/docs/Std.Math/ArcTan2.md +1 -1
- package/docs/Std.Math/ArcTanh.md +1 -1
- package/docs/Std.Math/ArgComplex.md +1 -1
- package/docs/Std.Math/ArgComplexPolar.md +1 -1
- package/docs/Std.Math/Binom.md +1 -1
- package/docs/Std.Math/BitSizeI.md +1 -1
- package/docs/Std.Math/BitSizeL.md +1 -1
- package/docs/Std.Math/Ceiling.md +1 -1
- package/docs/Std.Math/Complex.md +1 -1
- package/docs/Std.Math/ComplexPolar.md +1 -1
- package/docs/Std.Math/ContinuedFractionConvergentI.md +1 -1
- package/docs/Std.Math/ContinuedFractionConvergentL.md +1 -1
- package/docs/Std.Math/Cos.md +1 -1
- package/docs/Std.Math/Cosh.md +1 -1
- package/docs/Std.Math/DivRemI.md +1 -1
- package/docs/Std.Math/DivRemL.md +1 -1
- package/docs/Std.Math/DividedByC.md +1 -1
- package/docs/Std.Math/DividedByCP.md +1 -1
- package/docs/Std.Math/E.md +1 -1
- package/docs/Std.Math/ExpModI.md +1 -1
- package/docs/Std.Math/ExpModL.md +1 -1
- package/docs/Std.Math/ExtendedGreatestCommonDivisorI.md +1 -1
- package/docs/Std.Math/ExtendedGreatestCommonDivisorL.md +1 -1
- package/docs/Std.Math/FactorialI.md +1 -1
- package/docs/Std.Math/FactorialL.md +1 -1
- package/docs/Std.Math/Floor.md +1 -1
- package/docs/Std.Math/GreatestCommonDivisorI.md +1 -1
- package/docs/Std.Math/GreatestCommonDivisorL.md +1 -1
- package/docs/Std.Math/HammingWeightI.md +1 -1
- package/docs/Std.Math/InverseModI.md +1 -1
- package/docs/Std.Math/InverseModL.md +1 -1
- package/docs/Std.Math/IsCoprimeI.md +1 -1
- package/docs/Std.Math/IsCoprimeL.md +1 -1
- package/docs/Std.Math/IsInfinite.md +1 -1
- package/docs/Std.Math/IsNaN.md +1 -1
- package/docs/Std.Math/LargestFixedPoint.md +1 -1
- package/docs/Std.Math/Lg.md +1 -1
- package/docs/Std.Math/Log.md +1 -1
- package/docs/Std.Math/Log10.md +1 -1
- package/docs/Std.Math/LogFactorialD.md +1 -1
- package/docs/Std.Math/LogGammaD.md +1 -1
- package/docs/Std.Math/LogOf2.md +1 -1
- package/docs/Std.Math/Max.md +1 -1
- package/docs/Std.Math/MaxD.md +1 -1
- package/docs/Std.Math/MaxI.md +1 -1
- package/docs/Std.Math/MaxL.md +1 -1
- package/docs/Std.Math/Min.md +1 -1
- package/docs/Std.Math/MinD.md +1 -1
- package/docs/Std.Math/MinI.md +1 -1
- package/docs/Std.Math/MinL.md +1 -1
- package/docs/Std.Math/MinusC.md +1 -1
- package/docs/Std.Math/MinusCP.md +1 -1
- package/docs/Std.Math/ModulusI.md +1 -1
- package/docs/Std.Math/ModulusL.md +1 -1
- package/docs/Std.Math/NegationC.md +1 -1
- package/docs/Std.Math/NegationCP.md +1 -1
- package/docs/Std.Math/PI.md +1 -1
- package/docs/Std.Math/PNorm.md +1 -1
- package/docs/Std.Math/PNormalized.md +1 -1
- package/docs/Std.Math/PlusC.md +1 -1
- package/docs/Std.Math/PlusCP.md +1 -1
- package/docs/Std.Math/PowC.md +1 -1
- package/docs/Std.Math/PowCP.md +1 -1
- package/docs/Std.Math/RealMod.md +1 -1
- package/docs/Std.Math/Round.md +1 -1
- package/docs/Std.Math/RoundHalfAwayFromZero.md +1 -1
- package/docs/Std.Math/SignD.md +1 -1
- package/docs/Std.Math/SignI.md +1 -1
- package/docs/Std.Math/SignL.md +1 -1
- package/docs/Std.Math/Sin.md +1 -1
- package/docs/Std.Math/Sinh.md +1 -1
- package/docs/Std.Math/SmallestFixedPoint.md +1 -1
- package/docs/Std.Math/Sqrt.md +1 -1
- package/docs/Std.Math/SquaredNorm.md +1 -1
- package/docs/Std.Math/Tan.md +1 -1
- package/docs/Std.Math/Tanh.md +1 -1
- package/docs/Std.Math/TimesC.md +1 -1
- package/docs/Std.Math/TimesCP.md +1 -1
- package/docs/Std.Math/TrailingZeroCountI.md +1 -1
- package/docs/Std.Math/TrailingZeroCountL.md +1 -1
- package/docs/Std.Math/Truncate.md +1 -1
- package/docs/Std.Math/index.md +1 -1
- package/docs/Std.Measurement/IsLossResult.md +1 -1
- package/docs/Std.Measurement/MResetEachZ.md +1 -1
- package/docs/Std.Measurement/MResetX.md +1 -1
- package/docs/Std.Measurement/MResetY.md +1 -1
- package/docs/Std.Measurement/MResetZ.md +1 -1
- package/docs/Std.Measurement/MResetZChecked.md +1 -1
- package/docs/Std.Measurement/MeasureAllZ.md +1 -1
- package/docs/Std.Measurement/MeasureEachZ.md +1 -1
- package/docs/Std.Measurement/MeasureInteger.md +1 -1
- package/docs/Std.Measurement/index.md +1 -1
- package/docs/Std.Random/DrawRandomBool.md +1 -1
- package/docs/Std.Random/DrawRandomDouble.md +1 -1
- package/docs/Std.Random/DrawRandomInt.md +1 -1
- package/docs/Std.Random/index.md +1 -1
- package/docs/Std.Range/IsRangeEmpty.md +1 -1
- package/docs/Std.Range/RangeEnd.md +1 -1
- package/docs/Std.Range/RangeReverse.md +1 -1
- package/docs/Std.Range/RangeStart.md +1 -1
- package/docs/Std.Range/RangeStep.md +1 -1
- package/docs/Std.Range/index.md +1 -1
- package/docs/Std.ResourceEstimation/AccountForEstimates.md +1 -1
- package/docs/Std.ResourceEstimation/AuxQubitCount.md +1 -1
- package/docs/Std.ResourceEstimation/BeginEstimateCaching.md +1 -1
- package/docs/Std.ResourceEstimation/BeginRepeatEstimates.md +1 -1
- package/docs/Std.ResourceEstimation/CczCount.md +1 -1
- package/docs/Std.ResourceEstimation/EnableMemoryComputeArchitecture.md +1 -1
- package/docs/Std.ResourceEstimation/EndEstimateCaching.md +1 -1
- package/docs/Std.ResourceEstimation/EndRepeatEstimates.md +1 -1
- package/docs/Std.ResourceEstimation/LeastFrequentlyUsed.md +1 -1
- package/docs/Std.ResourceEstimation/LeastRecentlyUsed.md +1 -1
- package/docs/Std.ResourceEstimation/MeasurementCount.md +1 -1
- package/docs/Std.ResourceEstimation/PSSPCLayout.md +1 -1
- package/docs/Std.ResourceEstimation/RepeatEstimates.md +1 -1
- package/docs/Std.ResourceEstimation/RotationCount.md +1 -1
- package/docs/Std.ResourceEstimation/RotationDepth.md +1 -1
- package/docs/Std.ResourceEstimation/SingleVariant.md +1 -1
- package/docs/Std.ResourceEstimation/TCount.md +1 -1
- package/docs/Std.ResourceEstimation/index.md +1 -1
- package/docs/Std.StatePreparation/ApproximatelyPreparePureStateCP.md +1 -1
- package/docs/Std.StatePreparation/PreparePureStateD.md +1 -1
- package/docs/Std.StatePreparation/PrepareUniformSuperposition.md +1 -1
- package/docs/Std.StatePreparation/index.md +1 -1
- package/docs/Std.TableLookup/Select.md +1 -1
- package/docs/Std.TableLookup/index.md +1 -1
- package/docs/index.md +1 -1
- package/lib/web/qsc_wasm.d.ts +3 -3
- package/lib/web/qsc_wasm.js +7 -7
- package/lib/web/qsc_wasm_bg.wasm +0 -0
- package/package.json +11 -8
- package/ux/circuit-vis/draggable.ts +1 -1
- package/ux/circuit-vis/sqore.ts +2 -1
- package/ux/report.ts +1 -1
- package/ux/resultsTable.tsx +1 -2
- package/ux/saveImage.tsx +1 -2
- package/ux/tsconfig.json +3 -2
- package/dist/browser.d.ts +0 -32
- package/dist/browser.js +0 -126
- package/dist/compiler/worker-node.d.ts +0 -1
- package/dist/compiler/worker-node.js +0 -5
- package/dist/debug-service/worker-node.d.ts +0 -1
- package/dist/debug-service/worker-node.js +0 -5
- package/dist/language-service/worker-node.d.ts +0 -1
- package/dist/language-service/worker-node.js +0 -5
- package/dist/workers/browser.js +0 -67
- package/dist/workers/node.d.ts +0 -20
- package/dist/workers/node.js +0 -56
- package/lib/nodejs/qsc_wasm.cjs +0 -1614
- package/lib/nodejs/qsc_wasm.d.cts +0 -383
- package/lib/nodejs/qsc_wasm_bg.wasm +0 -0
- /package/dist/compiler/{worker-browser.d.ts → worker.d.ts} +0 -0
- /package/dist/debug-service/{worker-browser.d.ts → worker.d.ts} +0 -0
- /package/dist/language-service/{worker-browser.d.ts → worker.d.ts} +0 -0
|
@@ -2,6 +2,45 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { QdkDiagnostics } from "../diagnostics.js";
|
|
4
4
|
import { log } from "../log.js";
|
|
5
|
+
/**
|
|
6
|
+
* Creates and initializes a service in a web worker, and returns a proxy for the service
|
|
7
|
+
* to be used from the main thread.
|
|
8
|
+
*
|
|
9
|
+
* @param workerArg The service web worker or the URL of the web worker script.
|
|
10
|
+
* @param wasmModule The wasm module to initialize the service with
|
|
11
|
+
* @param serviceProtocol An object that describes the service: its constructor, methods and events
|
|
12
|
+
* @param workerType The type of worker to create: "classic" for browsers, "module" for Node.js
|
|
13
|
+
* @returns A proxy object that implements the service interface.
|
|
14
|
+
* This interface can now be used as if calling into the real service,
|
|
15
|
+
* and the calls will be proxied to the web worker.
|
|
16
|
+
*/
|
|
17
|
+
export function createProxy(workerArg, wasmModule, serviceProtocol, workerType) {
|
|
18
|
+
// Create or use the WebWorker
|
|
19
|
+
const useModuleWorker = { type: workerType };
|
|
20
|
+
const worker = typeof workerArg === "string"
|
|
21
|
+
? new Worker(workerArg, useModuleWorker)
|
|
22
|
+
: workerArg;
|
|
23
|
+
// Log any errors from the worker
|
|
24
|
+
worker.addEventListener("error", (ev) => {
|
|
25
|
+
log.error("Worker error:", ev);
|
|
26
|
+
});
|
|
27
|
+
// Send it the Wasm module to instantiate
|
|
28
|
+
worker.postMessage({
|
|
29
|
+
type: "init",
|
|
30
|
+
wasmModule,
|
|
31
|
+
qscLogLevel: log.getLogLevel(),
|
|
32
|
+
});
|
|
33
|
+
// If you lose the 'this' binding, some environments have issues
|
|
34
|
+
const postMessage = worker.postMessage.bind(worker);
|
|
35
|
+
const onTerminate = () => worker.terminate();
|
|
36
|
+
// Create the proxy which will forward method calls to the worker
|
|
37
|
+
const proxy = createProxyInternal(postMessage, onTerminate, serviceProtocol.methods);
|
|
38
|
+
// Let proxy handle response and event messages from the worker
|
|
39
|
+
worker.addEventListener("message", (ev) => {
|
|
40
|
+
proxy.onMsgFromWorker(ev.data);
|
|
41
|
+
});
|
|
42
|
+
return proxy;
|
|
43
|
+
}
|
|
5
44
|
/*
|
|
6
45
|
The WorkerProxy works by queuing up requests to send over to the Worker, only
|
|
7
46
|
ever having one in flight at a time. By queuing on the caller side, this allows
|
|
@@ -24,7 +63,7 @@ complete the request.
|
|
|
24
63
|
* @returns The proxy object. The caller should then set the onMsgFromWorker
|
|
25
64
|
* property to a callback that will receive messages from the worker.
|
|
26
65
|
*/
|
|
27
|
-
|
|
66
|
+
function createProxyInternal(postMessage, terminator, methods) {
|
|
28
67
|
const queue = [];
|
|
29
68
|
const eventTarget = new EventTarget();
|
|
30
69
|
let curr;
|
|
@@ -181,144 +220,6 @@ export function createProxyInternal(postMessage, terminator, methods) {
|
|
|
181
220
|
proxy.onMsgFromWorker = onMsgFromWorker;
|
|
182
221
|
return proxy;
|
|
183
222
|
}
|
|
184
|
-
/**
|
|
185
|
-
* Function to wrap a service in a dispatcher. To be used in the worker thread.
|
|
186
|
-
*
|
|
187
|
-
* @param service The service to be wrapped
|
|
188
|
-
* @param methods A map of method names. Should match the list passed into @see createProxyInternal.
|
|
189
|
-
* @param eventNames The list of event names that the service can emit
|
|
190
|
-
* @param postMessage A function to post messages back to the main thread
|
|
191
|
-
* @returns A function that takes a message and invokes the corresponding
|
|
192
|
-
* method on the service. The caller should then set this method as a message handler.
|
|
193
|
-
*/
|
|
194
|
-
function createDispatcher(postMessage, service, methods, eventNames) {
|
|
195
|
-
log.trace("Worker: Constructing WorkerEventHandler");
|
|
196
|
-
function logAndPost(msg) {
|
|
197
|
-
log.trace("Worker: Sending %s message from worker: %o", msg.messageType, msg);
|
|
198
|
-
postMessage(msg);
|
|
199
|
-
}
|
|
200
|
-
const eventTarget = new EventTarget();
|
|
201
|
-
eventNames.forEach((eventName) => {
|
|
202
|
-
// Subscribe to all known events and forward them as messages to the main thread.
|
|
203
|
-
eventTarget.addEventListener(eventName, (ev) => {
|
|
204
|
-
logAndPost({
|
|
205
|
-
messageType: "event",
|
|
206
|
-
type: ev.type,
|
|
207
|
-
detail: ev.detail,
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
// If there's an addEventListener on the object itself, forward those events as well.
|
|
211
|
-
if (service.addEventListener) {
|
|
212
|
-
service.addEventListener(eventName, (ev) => {
|
|
213
|
-
logAndPost({
|
|
214
|
-
messageType: "event",
|
|
215
|
-
type: ev.type,
|
|
216
|
-
detail: ev.detail,
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
return function invokeMethod(req) {
|
|
222
|
-
// Pass the eventTarget to the methods marked as taking progress
|
|
223
|
-
return service[req.type]
|
|
224
|
-
.call(service, ...req.args, methods[req.type] === "requestWithProgress" ? eventTarget : undefined)
|
|
225
|
-
.then((result) => logAndPost({
|
|
226
|
-
messageType: "response",
|
|
227
|
-
type: req.type,
|
|
228
|
-
result: { success: true, result },
|
|
229
|
-
}))
|
|
230
|
-
.catch((err) => {
|
|
231
|
-
// Serialize the error if it's a known type.
|
|
232
|
-
err = serializeIfError(err);
|
|
233
|
-
logAndPost({
|
|
234
|
-
// If this happens then the wasm code likely threw an exception/panicked rather than
|
|
235
|
-
// completing gracefully and fulfilling the promise. Communicate to the client
|
|
236
|
-
// that there was an error and it should reject the current request
|
|
237
|
-
messageType: "response",
|
|
238
|
-
type: req.type,
|
|
239
|
-
result: { success: false, error: err },
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Creates and initializes the actual service. To be used in the worker thread.
|
|
246
|
-
*
|
|
247
|
-
* @param postMessage A function to post messages back to the main thread
|
|
248
|
-
* @param serviceProtocol An object that describes the service: its constructor, methods and events
|
|
249
|
-
* @param wasm The wasm module to initialize the service with
|
|
250
|
-
* @param qscLogLevel The log level to initialize the service with
|
|
251
|
-
* @returns A function that takes a message and invokes the corresponding
|
|
252
|
-
* method on the service. The caller should then set this method as a message handler.
|
|
253
|
-
*/
|
|
254
|
-
export function initService(postMessage, serviceProtocol, wasm, qscLogLevel) {
|
|
255
|
-
function postTelemetryMessage(telemetry) {
|
|
256
|
-
postMessage({
|
|
257
|
-
messageType: "common-event",
|
|
258
|
-
type: "telemetry-event",
|
|
259
|
-
detail: telemetry,
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
function postLogMessage(level, target, ...args) {
|
|
263
|
-
if (log.getLogLevel() < level) {
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
let data = args;
|
|
267
|
-
try {
|
|
268
|
-
// Only structured cloneable objects can be sent in worker messages.
|
|
269
|
-
// Test if this is the case.
|
|
270
|
-
structuredClone(args);
|
|
271
|
-
}
|
|
272
|
-
catch {
|
|
273
|
-
// Uncloneable object.
|
|
274
|
-
// Use String(args) instead of ${args} to handle all possible values
|
|
275
|
-
// without throwing. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion
|
|
276
|
-
data = ["unsupported log data " + String(args)];
|
|
277
|
-
}
|
|
278
|
-
postMessage({
|
|
279
|
-
messageType: "common-event",
|
|
280
|
-
type: "log",
|
|
281
|
-
detail: { level, target, data },
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
// Override the global logger
|
|
285
|
-
log.error = (...args) => postLogMessage(1, "worker", ...args);
|
|
286
|
-
log.warn = (...args) => postLogMessage(2, "worker", ...args);
|
|
287
|
-
log.info = (...args) => postLogMessage(3, "worker", ...args);
|
|
288
|
-
log.debug = (...args) => postLogMessage(4, "worker", ...args);
|
|
289
|
-
log.trace = (...args) => postLogMessage(5, "worker", ...args);
|
|
290
|
-
if (qscLogLevel !== undefined) {
|
|
291
|
-
log.setLogLevel(qscLogLevel);
|
|
292
|
-
}
|
|
293
|
-
// Set up logging and telemetry as soon as possible after instantiating
|
|
294
|
-
log.onLevelChanged = (level) => wasm.setLogLevel(level);
|
|
295
|
-
log.setTelemetryCollector(postTelemetryMessage);
|
|
296
|
-
wasm.initLogging(postLogMessage, log.getLogLevel());
|
|
297
|
-
// Create the actual service and return the dispatcher method
|
|
298
|
-
const service = new serviceProtocol.class(wasm);
|
|
299
|
-
return createDispatcher(postMessage, service, serviceProtocol.methods, serviceProtocol.eventNames);
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Serializes an error, if it is a known type, so that it can be sent between threads.
|
|
303
|
-
*
|
|
304
|
-
* By default, browsers can only send certain types of errors between the main thread and a worker.
|
|
305
|
-
* See: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#error_types
|
|
306
|
-
*
|
|
307
|
-
* Serializing our own custom errors allows us to send them between threads.
|
|
308
|
-
*/
|
|
309
|
-
function serializeIfError(err) {
|
|
310
|
-
if (err instanceof QdkDiagnostics) {
|
|
311
|
-
err = { name: err.name, data: err.diagnostics };
|
|
312
|
-
}
|
|
313
|
-
else if (err instanceof WebAssembly.RuntimeError) {
|
|
314
|
-
err = {
|
|
315
|
-
name: "WebAssembly.RuntimeError",
|
|
316
|
-
message: err.message,
|
|
317
|
-
stack: err.stack,
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
return err;
|
|
321
|
-
}
|
|
322
223
|
/**
|
|
323
224
|
* Deserializes an error if it is a known type.
|
|
324
225
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TelemetryEvent } from "../log.js";
|
|
1
|
+
import type { TelemetryEvent } from "../log.js";
|
|
2
2
|
type Wasm = typeof import("../../lib/web/qsc_wasm.js");
|
|
3
3
|
/**
|
|
4
4
|
* Describes a service that can be run in a worker.
|
|
@@ -77,7 +77,7 @@ export interface IServiceEventMessage {
|
|
|
77
77
|
/**
|
|
78
78
|
* Common event types all workers can send.
|
|
79
79
|
*/
|
|
80
|
-
type CommonEvent = {
|
|
80
|
+
export type CommonEvent = {
|
|
81
81
|
type: "telemetry-event";
|
|
82
82
|
detail: TelemetryEvent;
|
|
83
83
|
} | {
|
|
@@ -88,7 +88,7 @@ type CommonEvent = {
|
|
|
88
88
|
data: any[];
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
|
-
type CommonEventMessage = CommonEvent & {
|
|
91
|
+
export type CommonEventMessage = CommonEvent & {
|
|
92
92
|
messageType: "common-event";
|
|
93
93
|
};
|
|
94
94
|
/**
|
|
@@ -104,27 +104,4 @@ export interface IServiceEventTarget<TEvents extends IServiceEventMessage> {
|
|
|
104
104
|
}>) => void): void;
|
|
105
105
|
dispatchEvent(event: Event & TEvents): boolean;
|
|
106
106
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Function to create the proxy for a type. To be used from the main thread.
|
|
109
|
-
*
|
|
110
|
-
* @param postMessage A function to post messages to the worker
|
|
111
|
-
* @param terminator A function to call to tear down the worker thread
|
|
112
|
-
* @param methods A map of method names to be proxied and some metadata @see MethodMap
|
|
113
|
-
* @returns The proxy object. The caller should then set the onMsgFromWorker
|
|
114
|
-
* property to a callback that will receive messages from the worker.
|
|
115
|
-
*/
|
|
116
|
-
export declare function createProxyInternal<TService extends ServiceMethods<TService>, TServiceEventMsg extends IServiceEventMessage>(postMessage: (msg: RequestMessage<TService>) => void, terminator: () => void, methods: MethodMap<TService>): TService & IServiceProxy & {
|
|
117
|
-
onMsgFromWorker: (msg: ResponseMessage<TService> | EventMessage<TServiceEventMsg>) => void;
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Creates and initializes the actual service. To be used in the worker thread.
|
|
121
|
-
*
|
|
122
|
-
* @param postMessage A function to post messages back to the main thread
|
|
123
|
-
* @param serviceProtocol An object that describes the service: its constructor, methods and events
|
|
124
|
-
* @param wasm The wasm module to initialize the service with
|
|
125
|
-
* @param qscLogLevel The log level to initialize the service with
|
|
126
|
-
* @returns A function that takes a message and invokes the corresponding
|
|
127
|
-
* method on the service. The caller should then set this method as a message handler.
|
|
128
|
-
*/
|
|
129
|
-
export declare function initService<TService extends ServiceMethods<TService>, TServiceEventMsg extends IServiceEventMessage>(postMessage: (msg: ResponseMessage<TService> | EventMessage<TServiceEventMsg> | CommonEventMessage) => void, serviceProtocol: ServiceProtocol<TService, TServiceEventMsg>, wasm: Wasm, qscLogLevel?: number): (req: RequestMessage<TService>) => Promise<void>;
|
|
130
107
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IServiceEventMessage, ServiceMethods, ServiceProtocol } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates an initializes a service, setting it up to receive requests.
|
|
4
|
+
* This function to be is used in the worker.
|
|
5
|
+
*
|
|
6
|
+
* @param serviceProtocol An object that describes the service: its constructor, methods and events
|
|
7
|
+
* @returns A message handler to be assigned to the `self.onmessage` handler in a web worker
|
|
8
|
+
*/
|
|
9
|
+
export declare function createWorker<TService extends ServiceMethods<TService>, TServiceEventMsg extends IServiceEventMessage>(serviceProtocol: ServiceProtocol<TService, TServiceEventMsg>): (e: MessageEvent) => void;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import * as wasm from "../../lib/web/qsc_wasm.js";
|
|
4
|
+
import { QdkDiagnostics } from "../diagnostics.js";
|
|
5
|
+
import { log } from "../log.js";
|
|
6
|
+
/**
|
|
7
|
+
* Creates an initializes a service, setting it up to receive requests.
|
|
8
|
+
* This function to be is used in the worker.
|
|
9
|
+
*
|
|
10
|
+
* @param serviceProtocol An object that describes the service: its constructor, methods and events
|
|
11
|
+
* @returns A message handler to be assigned to the `self.onmessage` handler in a web worker
|
|
12
|
+
*/
|
|
13
|
+
export function createWorker(serviceProtocol) {
|
|
14
|
+
let invokeService = null;
|
|
15
|
+
// This export should be assigned to 'self.onmessage' in a WebWorker
|
|
16
|
+
return function messageHandler(e) {
|
|
17
|
+
const data = e.data;
|
|
18
|
+
if (!data.type || typeof data.type !== "string") {
|
|
19
|
+
log.error(`Unrecognized msg: ${data}`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
switch (data.type) {
|
|
23
|
+
case "init":
|
|
24
|
+
{
|
|
25
|
+
wasm.initSync({ module: data.wasmModule });
|
|
26
|
+
invokeService = initService(self.postMessage.bind(self), serviceProtocol, wasm, data.qscLogLevel);
|
|
27
|
+
}
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
if (!invokeService) {
|
|
31
|
+
log.error(`Received message before the service was initialized: %o`, data);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
invokeService(data);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Serializes an error, if it is a known type, so that it can be sent between threads.
|
|
41
|
+
*
|
|
42
|
+
* By default, browsers can only send certain types of errors between the main thread and a worker.
|
|
43
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#error_types
|
|
44
|
+
*
|
|
45
|
+
* Serializing our own custom errors allows us to send them between threads.
|
|
46
|
+
*/
|
|
47
|
+
function serializeIfError(err) {
|
|
48
|
+
if (err instanceof QdkDiagnostics) {
|
|
49
|
+
err = { name: err.name, data: err.diagnostics };
|
|
50
|
+
}
|
|
51
|
+
else if (err instanceof WebAssembly.RuntimeError) {
|
|
52
|
+
err = {
|
|
53
|
+
name: "WebAssembly.RuntimeError",
|
|
54
|
+
message: err.message,
|
|
55
|
+
stack: err.stack,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return err;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Function to wrap a service in a dispatcher. To be used in the worker thread.
|
|
62
|
+
*
|
|
63
|
+
* @param service The service to be wrapped
|
|
64
|
+
* @param methods A map of method names. Should match the list passed into @see createProxyInternal.
|
|
65
|
+
* @param eventNames The list of event names that the service can emit
|
|
66
|
+
* @param postMessage A function to post messages back to the main thread
|
|
67
|
+
* @returns A function that takes a message and invokes the corresponding
|
|
68
|
+
* method on the service. The caller should then set this method as a message handler.
|
|
69
|
+
*/
|
|
70
|
+
function createDispatcher(postMessage, service, methods, eventNames) {
|
|
71
|
+
log.trace("Worker: Constructing WorkerEventHandler");
|
|
72
|
+
function logAndPost(msg) {
|
|
73
|
+
log.trace("Worker: Sending %s message from worker: %o", msg.messageType, msg);
|
|
74
|
+
postMessage(msg);
|
|
75
|
+
}
|
|
76
|
+
const eventTarget = new EventTarget();
|
|
77
|
+
eventNames.forEach((eventName) => {
|
|
78
|
+
// Subscribe to all known events and forward them as messages to the main thread.
|
|
79
|
+
eventTarget.addEventListener(eventName, (ev) => {
|
|
80
|
+
logAndPost({
|
|
81
|
+
messageType: "event",
|
|
82
|
+
type: ev.type,
|
|
83
|
+
detail: ev.detail,
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
// If there's an addEventListener on the object itself, forward those events as well.
|
|
87
|
+
if (service.addEventListener) {
|
|
88
|
+
service.addEventListener(eventName, (ev) => {
|
|
89
|
+
logAndPost({
|
|
90
|
+
messageType: "event",
|
|
91
|
+
type: ev.type,
|
|
92
|
+
detail: ev.detail,
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return function invokeMethod(req) {
|
|
98
|
+
// Pass the eventTarget to the methods marked as taking progress
|
|
99
|
+
return service[req.type]
|
|
100
|
+
.call(service, ...req.args, methods[req.type] === "requestWithProgress" ? eventTarget : undefined)
|
|
101
|
+
.then((result) => logAndPost({
|
|
102
|
+
messageType: "response",
|
|
103
|
+
type: req.type,
|
|
104
|
+
result: { success: true, result },
|
|
105
|
+
}))
|
|
106
|
+
.catch((err) => {
|
|
107
|
+
// Serialize the error if it's a known type.
|
|
108
|
+
err = serializeIfError(err);
|
|
109
|
+
logAndPost({
|
|
110
|
+
// If this happens then the wasm code likely threw an exception/panicked rather than
|
|
111
|
+
// completing gracefully and fulfilling the promise. Communicate to the client
|
|
112
|
+
// that there was an error and it should reject the current request
|
|
113
|
+
messageType: "response",
|
|
114
|
+
type: req.type,
|
|
115
|
+
result: { success: false, error: err },
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Creates and initializes the actual service. To be used in the worker thread.
|
|
122
|
+
*
|
|
123
|
+
* @param postMessage A function to post messages back to the main thread
|
|
124
|
+
* @param serviceProtocol An object that describes the service: its constructor, methods and events
|
|
125
|
+
* @param wasm The wasm module to initialize the service with
|
|
126
|
+
* @param qscLogLevel The log level to initialize the service with
|
|
127
|
+
* @returns A function that takes a message and invokes the corresponding
|
|
128
|
+
* method on the service. The caller should then set this method as a message handler.
|
|
129
|
+
*/
|
|
130
|
+
function initService(postMessage, serviceProtocol, wasm, qscLogLevel) {
|
|
131
|
+
function postTelemetryMessage(telemetry) {
|
|
132
|
+
postMessage({
|
|
133
|
+
messageType: "common-event",
|
|
134
|
+
type: "telemetry-event",
|
|
135
|
+
detail: telemetry,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function postLogMessage(level, target, ...args) {
|
|
139
|
+
if (log.getLogLevel() < level) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
let data = args;
|
|
143
|
+
try {
|
|
144
|
+
// Only structured cloneable objects can be sent in worker messages.
|
|
145
|
+
// Test if this is the case.
|
|
146
|
+
structuredClone(args);
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// Uncloneable object.
|
|
150
|
+
// Use String(args) instead of ${args} to handle all possible values
|
|
151
|
+
// without throwing. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion
|
|
152
|
+
data = ["unsupported log data " + String(args)];
|
|
153
|
+
}
|
|
154
|
+
postMessage({
|
|
155
|
+
messageType: "common-event",
|
|
156
|
+
type: "log",
|
|
157
|
+
detail: { level, target, data },
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
// Override the global logger
|
|
161
|
+
log.error = (...args) => postLogMessage(1, "worker", ...args);
|
|
162
|
+
log.warn = (...args) => postLogMessage(2, "worker", ...args);
|
|
163
|
+
log.info = (...args) => postLogMessage(3, "worker", ...args);
|
|
164
|
+
log.debug = (...args) => postLogMessage(4, "worker", ...args);
|
|
165
|
+
log.trace = (...args) => postLogMessage(5, "worker", ...args);
|
|
166
|
+
if (qscLogLevel !== undefined) {
|
|
167
|
+
log.setLogLevel(qscLogLevel);
|
|
168
|
+
}
|
|
169
|
+
// Set up logging and telemetry as soon as possible after instantiating
|
|
170
|
+
log.onLevelChanged = (level) => wasm.setLogLevel(level);
|
|
171
|
+
log.setTelemetryCollector(postTelemetryMessage);
|
|
172
|
+
wasm.initLogging(postLogMessage, log.getLogLevel());
|
|
173
|
+
// Create the actual service and return the dispatcher method
|
|
174
|
+
const service = new serviceProtocol.class(wasm);
|
|
175
|
+
return createDispatcher(postMessage, service, serviceProtocol.methods, serviceProtocol.eventNames);
|
|
176
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Microsoft.Quantum.Core.IsRangeEmpty
|
|
3
3
|
title: IsRangeEmpty exported item
|
|
4
4
|
description: "Q# IsRangeEmpty exported item: This is an exported item. The actual definition is found here: [Std.Range.IsRangeEmpty](xref:Qdk.Std.Range.IsRangeEmpty)"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: export
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Microsoft.Quantum.Core
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Microsoft.Quantum.Core.Length
|
|
3
3
|
title: Length exported item
|
|
4
4
|
description: "Q# Length exported item: This is an exported item. The actual definition is found here: [Std.Core.Length](xref:Qdk.Std.Core.Length)"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: export
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Microsoft.Quantum.Core
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Microsoft.Quantum.Core.RangeEnd
|
|
3
3
|
title: RangeEnd exported item
|
|
4
4
|
description: "Q# RangeEnd exported item: This is an exported item. The actual definition is found here: [Std.Range.RangeEnd](xref:Qdk.Std.Range.RangeEnd)"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: export
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Microsoft.Quantum.Core
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Microsoft.Quantum.Core.RangeStart
|
|
3
3
|
title: RangeStart exported item
|
|
4
4
|
description: "Q# RangeStart exported item: This is an exported item. The actual definition is found here: [Std.Range.RangeStart](xref:Qdk.Std.Range.RangeStart)"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: export
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Microsoft.Quantum.Core
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Microsoft.Quantum.Core.Repeated
|
|
3
3
|
title: Repeated exported item
|
|
4
4
|
description: "Q# Repeated exported item: This is an exported item. The actual definition is found here: [Std.Core.Repeated](xref:Qdk.Std.Core.Repeated)"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: export
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Microsoft.Quantum.Core
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.AddLE
|
|
3
3
|
title: AddLE operation
|
|
4
4
|
description: "Q# AddLE operation: Sets a zero-initialized little-endian register zs to the sum of little-endian registers xs and ys"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.ApplyIfEqualL
|
|
3
3
|
title: ApplyIfEqualL operation
|
|
4
4
|
description: "Q# ApplyIfEqualL operation: Computes `if (c == x) { action(target) }`, that is, applies `action` to `target` if a BigInt value `c` is equal to the little-endian qubit register `x`"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.ApplyIfEqualLE
|
|
3
3
|
title: ApplyIfEqualLE operation
|
|
4
4
|
description: "Q# ApplyIfEqualLE operation: Computes `if x == y { action(target) }`, that is, applies `action` to `target` if register `x` is equal to the register `y`. Both qubit registers should be in a little-endian format."
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.ApplyIfGreaterL
|
|
3
3
|
title: ApplyIfGreaterL operation
|
|
4
4
|
description: "Q# ApplyIfGreaterL operation: Computes `if (c > x) { action(target) }`, that is, applies `action` to `target` if a BigInt value `c` is greater than the little-endian qubit register `x`"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.ApplyIfGreaterLE
|
|
3
3
|
title: ApplyIfGreaterLE operation
|
|
4
4
|
description: "Q# ApplyIfGreaterLE operation: Computes `if x > y { action(target) }`, that is, applies `action` to `target` if register `x` is greater than the register `y`. Both qubit registers should be in a little-endian format."
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.ApplyIfGreaterOrEqualL
|
|
3
3
|
title: ApplyIfGreaterOrEqualL operation
|
|
4
4
|
description: "Q# ApplyIfGreaterOrEqualL operation: Computes `if (c >= x) { action(target) }`, that is, applies `action` to `target` if a BigInt value `c` is greater or equal to the little-endian qubit register `x`"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.ApplyIfGreaterOrEqualLE
|
|
3
3
|
title: ApplyIfGreaterOrEqualLE operation
|
|
4
4
|
description: "Q# ApplyIfGreaterOrEqualLE operation: Computes `if x >= y { action(target) }`, that is, applies `action` to `target` if register `x` is greater or equal to the register `y`. Both qubit registers should be in a little-endian format."
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.ApplyIfLessL
|
|
3
3
|
title: ApplyIfLessL operation
|
|
4
4
|
description: "Q# ApplyIfLessL operation: Computes `if (c < x) { action(target) }`, that is, applies `action` to `target` if a BigInt value `c` is less than the little-endian qubit register `x`"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.ApplyIfLessLE
|
|
3
3
|
title: ApplyIfLessLE operation
|
|
4
4
|
description: "Q# ApplyIfLessLE operation: Computes `if x < y { action(target) }`, that is, applies `action` to `target` if register `x` is less than the register `y`. Both qubit registers should be in a little-endian format."
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.ApplyIfLessOrEqualL
|
|
3
3
|
title: ApplyIfLessOrEqualL operation
|
|
4
4
|
description: "Q# ApplyIfLessOrEqualL operation: Computes `if (c <= x) { action(target) }`, that is, applies `action` to `target` if a BigInt value `c` is less or equal to the little-endian qubit register `x`"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.ApplyIfLessOrEqualLE
|
|
3
3
|
title: ApplyIfLessOrEqualLE operation
|
|
4
4
|
description: "Q# ApplyIfLessOrEqualLE operation: Computes `if x <= y { action(target) }`, that is, applies `action` to `target` if register `x` is less or equal to the register `y`. Both qubit registers should be in a little-endian format."
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.FourierTDIncByLE
|
|
3
3
|
title: FourierTDIncByLE operation
|
|
4
4
|
description: "Q# FourierTDIncByLE operation: Increments a little-endian register ys by a little-endian register xs using Quantum Fourier Transform."
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.IncByI
|
|
3
3
|
title: IncByI operation
|
|
4
4
|
description: "Q# IncByI operation: Increments a little-endian register ys by an integer number c"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.IncByIUsingIncByLE
|
|
3
3
|
title: IncByIUsingIncByLE operation
|
|
4
4
|
description: "Q# IncByIUsingIncByLE operation: Increments a little-endian register ys by an Int number c using provided adder."
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uid: Qdk.Std.Arithmetic.IncByL
|
|
3
3
|
title: IncByL operation
|
|
4
4
|
description: "Q# IncByL operation: Increments a little-endian register ys by a BigInt number c"
|
|
5
|
-
ms.date: 04/
|
|
5
|
+
ms.date: 04/20/2026
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.package: __Std__
|
|
8
8
|
qsharp.namespace: Std.Arithmetic
|