@allyhub/sdk 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/define.d.ts +4 -0
- package/dist/define.js +1 -1
- package/dist/node_modules/@allyhub-next/audio/dist/node/index.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/audio/dist/node/index.js +1 -1
- package/dist/node_modules/@allyhub-next/audio/dist/node/master.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/audio/dist/node/master.js +1 -1
- package/dist/node_modules/@allyhub-next/audio/package.json +1 -1
- package/dist/node_modules/@allyhub-next/chart/dist/chart-xml.js +2 -2
- package/dist/node_modules/@allyhub-next/chart/dist/chart.d.ts +14 -5
- package/dist/node_modules/@allyhub-next/chart/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub-next/chart/package.json +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.d.ts +205 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/script.d.ts +4 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/script.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +69 -18
- package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/slides.d.ts +847 -116
- package/dist/node_modules/@allyhub-next/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/website.d.ts +20 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/website.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/index.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/formats/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/items.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/items.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/media-type.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/formats/dist/media-type.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/schemas.d.ts +501 -38
- package/dist/node_modules/@allyhub-next/formats/dist/schemas.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/strict.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/strict.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/package.json +2 -1
- package/dist/node_modules/@allyhub-next/ooxml/LICENSE +241 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.d.ts +31 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/color.d.ts +33 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/color.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/enums.d.ts +13 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/enums.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ext.d.ts +79 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ext.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.d.ts +132 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.d.ts +28 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.d.ts +4708 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.d.ts +57 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/index.d.ts +10 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/index.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/mce.d.ts +12 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/mce.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/node.d.ts +111 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/node.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ns.d.ts +45 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ns.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/opc.d.ts +48 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/opc.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/report.d.ts +45 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/report.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/xml.d.ts +28 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/xml.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/package.json +26 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/account.d.ts +338 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/account.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/auth.d.ts +12 -13
- package/dist/node_modules/@allyhub-next/protocol/dist/auth.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/blobs.d.ts +35 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/blobs.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +101 -32
- package/dist/node_modules/@allyhub-next/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/editor.d.ts +79 -5
- package/dist/node_modules/@allyhub-next/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/files.d.ts +2 -2
- package/dist/node_modules/@allyhub-next/protocol/dist/index.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/notes.d.ts +21 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/notes.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/open.d.ts +13 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/open.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/registry.d.ts +73 -59
- package/dist/node_modules/@allyhub-next/protocol/dist/registry.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/routes.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/shares.d.ts +115 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/shares.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/sites.d.ts +293 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/sites.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.d.ts +396 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/teams.d.ts +27 -9
- package/dist/node_modules/@allyhub-next/protocol/dist/teams.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/tools.d.ts +53 -14
- package/dist/node_modules/@allyhub-next/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/package.json +2 -1
- package/dist/node_modules/@allyhub-next/runtimes/dist/download.d.ts +19 -1
- package/dist/node_modules/@allyhub-next/runtimes/dist/download.js +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/dist/index.d.ts +2 -2
- package/dist/node_modules/@allyhub-next/runtimes/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/dist/lock.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/runtimes/dist/lock.js +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/dist/packages.d.ts +19 -2
- package/dist/node_modules/@allyhub-next/runtimes/dist/packages.js +3 -3
- package/dist/node_modules/@allyhub-next/runtimes/dist/runtimes.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/runtimes/dist/runtimes.js +3 -3
- package/dist/node_modules/@allyhub-next/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +25 -5
- package/dist/node_modules/@allyhub-next/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.d.ts +9 -3
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.d.ts +5 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.d.ts +60 -13
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/aggregate.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/criteria.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/database.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/date.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.d.ts +27 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.d.ts +16 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.d.ts +18 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/finance.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/info.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/kernels.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/logical.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/lookup.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/maths.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/text.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.d.ts +38 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.d.ts +19 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.d.ts +49 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.d.ts +82 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.d.ts +6 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/check.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/diff.d.ts +15 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/diff.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/export.d.ts +29 -8
- package/dist/node_modules/@allyhub-next/sheet/dist/export.js +3 -4
- package/dist/node_modules/@allyhub-next/sheet/dist/file.js +2 -2
- package/dist/node_modules/@allyhub-next/sheet/dist/format.d.ts +8 -2
- package/dist/node_modules/@allyhub-next/sheet/dist/format.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/html.d.ts +52 -4
- package/dist/node_modules/@allyhub-next/sheet/dist/html.js +43 -11
- package/dist/node_modules/@allyhub-next/sheet/dist/index.d.ts +7 -3
- package/dist/node_modules/@allyhub-next/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/paginate.d.ts +98 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/paginate.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/structure.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/table-style.d.ts +32 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/table-style.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/values.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/workbook.d.ts +10 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.d.ts +10 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.d.ts +14 -4
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.js +2 -2
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.d.ts +11 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.js +36 -16
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.d.ts +3 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.d.ts +42 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.js +2 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.d.ts +23 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.d.ts +40 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/animation.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/api.d.ts +59 -39
- package/dist/node_modules/@allyhub-next/slides-core/dist/api.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.d.ts +27 -13
- package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/check.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/code.d.ts +33 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/code.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/components.d.ts +31 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/components.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/enums.d.ts +179 -16
- package/dist/node_modules/@allyhub-next/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/file.d.ts +43 -21
- package/dist/node_modules/@allyhub-next/slides-core/dist/file.js +3 -3
- package/dist/node_modules/@allyhub-next/slides-core/dist/identity.d.ts +17 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/identity.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/index.d.ts +5 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/lang.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/lang.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/merge.d.ts +58 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/merge.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/model.d.ts +2 -4
- package/dist/node_modules/@allyhub-next/slides-core/dist/office.d.ts +17 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/office.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.d.ts +21 -5
- package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/script.d.ts +18 -16
- package/dist/node_modules/@allyhub-next/slides-core/dist/script.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-core/dist/stage.d.ts +51 -53
- package/dist/node_modules/@allyhub-next/slides-core/dist/strict.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/units.d.ts +27 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/units.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/values.d.ts +7 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/values.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/captions.js +6 -6
- package/dist/node_modules/@allyhub-next/video-core/dist/fact.d.ts +47 -8
- package/dist/node_modules/@allyhub-next/video-core/dist/fact.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/index.d.ts +1 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/marks.d.ts +14 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/marks.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/music.d.ts +2 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/piece.d.ts +11 -2
- package/dist/node_modules/@allyhub-next/video-core/dist/problem.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/problem.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/schema.d.ts +2 -2
- package/dist/node_modules/@allyhub-next/video-core/dist/schema.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/script.d.ts +2 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/script.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/source.d.ts +7 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/source.js +2 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +10 -33
- package/dist/node_modules/@allyhub-next/video-core/package.json +1 -1
- package/dist/slides.d.ts +3 -1
- package/dist/slides.js +1 -1
- package/docs/README.md +1 -0
- package/docs/contract.md +1 -1
- package/docs/defaults.md +2 -2
- package/docs/layers.md +1 -1
- package/docs/project.md +3 -1
- package/docs/sheets.md +7 -6
- package/docs/slides.md +16 -12
- package/docs/sound.md +1 -1
- package/docs/websites.md +57 -0
- package/package.json +3 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/preset.d.ts +0 -5
- package/dist/node_modules/@allyhub-next/slides-core/dist/preset.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{z as e}from"zod";import{KINDS as c}from"@allyhub-next/formats";import{PathSchema as
|
|
2
|
+
import{z as e}from"zod";import{KINDS as c}from"@allyhub-next/formats";import{PathSchema as s}from"./files.js";import{method as t,notification as r}from"./jsonrpc.js";const n={item:s,version:e.string().optional()};export const ImageSchema=e.strictObject({mime:e.string().regex(/^image\//u),data:e.base64()}),ProblemSchema=e.looseObject({code:e.string(),level:e.enum(["error","warn"]),message:e.string(),piece:e.string().optional(),part:e.string().optional(),t:e.number().optional()}),FactSchema=e.looseObject({kind:e.string(),data:e.unknown()}),TimelineSchema=e.looseObject({fps:e.number(),width:e.number(),height:e.number(),duration:e.number(),parts:e.array(e.unknown())}),CHECK_STATES=["off","waiting","running","done","failed"],CheckStateSchema=e.strictObject({status:e.enum(CHECK_STATES),revision:e.int().nonnegative(),problems:e.array(ProblemSchema),facts:e.array(FactSchema),versions:e.strictObject({total:e.int(),loaded:e.int(),reused:e.int()}).optional(),error:e.string().optional()}),EXPORT_STATES=["queued","running","done","failed","cancelled"],ExportOptionsSchema=e.record(e.string(),e.union([e.string(),e.boolean()])),ExportJobSchema=e.strictObject({id:e.string(),item:s,versions:e.array(e.string()),types:e.array(e.string()),options:ExportOptionsSchema.optional(),state:e.enum(EXPORT_STATES),progress:e.number().min(0).max(1),files:e.array(s),error:e.string().optional()}),IndexJobSchema=e.strictObject({file:s,status:e.enum(["running","done","failed"]),message:e.string(),share:e.number().min(0).max(1).optional()});const o=e.tuple([e.number(),e.number(),e.number()]),a=e.strictObject({url:e.string(),probe:e.string()});export const COMPONENT_STILLS_MAX=64,PROJECT_TOOLS={"project/items":t(e.strictObject({}),e.strictObject({items:e.array(e.strictObject({kind:e.enum(c),dir:s,entry:s,title:e.string().optional()})),name:e.string(),scope:e.string(),revision:e.int().nonnegative()}),"The project's items, as the build finds them."),"sheet/generated":t(e.strictObject({item:s}),e.strictObject({generated:e.unknown().optional(),failed:e.boolean()}),"What a sheet's sheet.ts makes now: sheets as sheet.yaml would hold them. Never written to a file."),"video/versions":t(e.strictObject({item:s}),e.strictObject({piece:e.string(),kind:e.enum(["video","slides"]),title:e.string().optional(),width:e.number(),height:e.number(),versions:e.array(e.strictObject({key:e.string(),lang:e.string().optional()}))}),"A video's or a deck's versions, one per language: what its stage, its timeline and its exports are asked for."),"slides/deck":t(e.strictObject({item:s}),e.strictObject({piece:e.string(),file:s,prefix:e.string(),layouts:e.array(e.string()),components:e.record(e.string(),e.unknown()),generators:e.array(e.string()),scripts:e.record(e.string(),s),code:e.unknown(),theme:e.strictObject({name:e.string(),colors:e.record(e.string(),e.string()),fonts:e.record(e.string(),e.string())})}),"A deck's layouts, components and generators, and its files: slides.yaml (its slides) and its script in each language (their words and notes), which the deck's editor edits."),"video/stage":t(e.strictObject({...n,start:e.strictObject({t:e.number().nonnegative().optional(),part:e.string().optional(),offset:e.number().nonnegative().optional(),dur:e.number().positive().optional()}).optional(),play:e.boolean().optional(),chrome:e.boolean().optional(),mode:e.enum(["code","component"]).optional()}),a,"The address of a version's stage page, for a sandboxed frame: it plays the piece and talks to its parent by postMessage."),"video/timeline":t(e.strictObject(n),e.strictObject({timeline:TimelineSchema,text:e.array(e.unknown())}),"A version's timeline, drawn nowhere."),"video/still":t(e.strictObject({...n,t:e.number().nonnegative().optional()}),e.strictObject({t:e.number(),image:ImageSchema,width:e.int().positive(),height:e.int().positive(),duration:e.number().nonnegative()}),"A moment of a version as the render draws it, as a picture."),"video/stills":t(e.strictObject({...n,moments:e.array(e.number().nonnegative()).min(1).max(32)}),e.strictObject({stills:e.array(e.strictObject({t:e.number(),image:ImageSchema}))}),"Several moments of a version as the render draws them: what `video/still` gives, on one page."),"slides/fonts":t(e.strictObject({item:s}),e.strictObject({faces:e.array(e.strictObject({family:e.string(),url:e.url(),weight:e.string().optional(),style:e.string().optional(),stretch:e.string().optional(),unicodeRange:e.string().optional()}))}),"The font faces a deck's slides draw with: the stage's own (the theme's standard fonts), allyhub.config.ts's fonts and what the deck's code imports, for a document that draws its slides without the project's stylesheets."),"slides/component-stills":t(e.strictObject({...n,components:e.array(e.strictObject({name:e.string(),props:e.record(e.string(),e.unknown()),width:e.number().positive(),height:e.number().positive(),t:e.number().nonnegative()})).min(1).max(COMPONENT_STILLS_MAX)}),e.strictObject({stills:e.array(e.strictObject({key:e.string(),url:e.url()}).nullable())}),"Components of a deck drawn alone, transparent, as the render draws them: pictures kept by what they show, given as addresses."),"check/results":t(e.strictObject({}),CheckStateSchema,"The check run after edits, as it stands."),"check/run":t(e.strictObject({}),e.strictObject({}),"Runs the check again now."),"export/start":t(e.strictObject({item:s,versions:e.array(e.string()).optional(),types:e.array(e.string().min(1)).max(10).optional(),options:ExportOptionsSchema.optional()}),e.strictObject({job:ExportJobSchema}),"Exports an item (its versions, as file types) into .allyhub/out/; `export/changed` says how it goes."),"export/cancel":t(e.strictObject({job:e.string()}),e.strictObject({}),"Stops an export."),"export/list":t(e.strictObject({}),e.strictObject({jobs:e.array(ExportJobSchema),reveal:e.boolean()}),"The exports asked for since the server started."),"export/reveal":t(e.strictObject({path:s}),e.strictObject({}),"Shows an exported file in the person's file manager, where the server runs on their computer (`export/list`'s `reveal`)."),"scenery/viewer":t(e.strictObject({item:s,camera:e.strictObject({position:o,target:o}).optional()}),a,"The address of a scenery's viewer page, for a sandboxed frame: it tells what the person does by postMessage.")},AGENT_DOES={"project/items":{files:"the project's folder"},"sheet/generated":{files:"the item's sheet.ts and sheet.yaml"},"video/versions":{command:"inspect combos"},"slides/deck":{files:"slides.ts, slides.yaml and the item's script.<locale>.yaml"},"video/stage":{command:"frames"},"video/timeline":{command:"inspect timeline"},"video/still":{command:"frames"},"video/stills":{command:"frames"},"slides/fonts":{files:"allyhub.config.ts's fonts and the stylesheets slides.ts imports"},"slides/component-stills":{command:"frames"},"check/results":{command:"inspect"},"check/run":{command:"check"},"export/start":{command:"render"},"export/cancel":{command:"render"},"export/list":{files:".allyhub/out/"},"export/reveal":{files:".allyhub/out/"},"scenery/viewer":{command:"scenery view"}};export function toolSpec(i){return Object.hasOwn(PROJECT_TOOLS,i)?PROJECT_TOOLS[i]:void 0}export const TOOL_NOTIFICATIONS={"project/changed":r(e.strictObject({revision:e.int().nonnegative()}),"The build saw a change: a stage or a timeline asked for now is the new one's."),"check/changed":r(CheckStateSchema,"The check started, ended or failed."),"export/changed":r(e.strictObject({job:ExportJobSchema}),"An export moved on."),"index/changed":r(e.strictObject({jobs:e.array(IndexJobSchema)}),"Making what the media index lacks moved on.")};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allyhub-next/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"default": "./dist/index.js"
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
|
+
"sideEffects": false,
|
|
11
12
|
"private": true,
|
|
12
13
|
"license": "SEE LICENSE IN LICENSE.md"
|
|
13
14
|
}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import { RuntimeError } from "./errors.js";
|
|
2
|
+
/** How long a download may go without a byte before that try is given up (ms). */
|
|
3
|
+
export declare const DOWNLOAD_STALL_MS = 30000;
|
|
4
|
+
/** How many times a download that failed on the way is tried again. */
|
|
5
|
+
export declare const DOWNLOAD_RETRIES = 3;
|
|
6
|
+
/** The wait before the first try again, doubled before each next one (ms). */
|
|
7
|
+
export declare const DOWNLOAD_RETRY_DELAY_MS = 1000;
|
|
8
|
+
/** How a download waits and tries again; each default is its constant above. */
|
|
9
|
+
export interface DownloadTimings {
|
|
10
|
+
/** No byte for this long gives up a try (default: DOWNLOAD_STALL_MS). */
|
|
11
|
+
stallMs?: number | undefined;
|
|
12
|
+
/** Tries again after the first (default: DOWNLOAD_RETRIES). */
|
|
13
|
+
retries?: number | undefined;
|
|
14
|
+
/** The first wait before trying again (default: DOWNLOAD_RETRY_DELAY_MS). */
|
|
15
|
+
retryDelayMs?: number | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface DownloadOptions extends DownloadTimings {
|
|
2
18
|
size: number;
|
|
3
19
|
sha256: string;
|
|
4
20
|
fetch: typeof globalThis.fetch;
|
|
5
21
|
signal?: AbortSignal | undefined;
|
|
6
22
|
onProgress?: ((received: number, total: number) => void) | undefined;
|
|
23
|
+
/** Before each try again: what went wrong, the try that failed and how many there are. */
|
|
24
|
+
onRetry?: ((error: RuntimeError, attempt: number, attempts: number) => void) | undefined;
|
|
7
25
|
}
|
|
8
26
|
/**
|
|
9
27
|
* Downloads `url` to `dest`, hashing as it comes; a file of another size or
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{createHash as
|
|
2
|
+
import{createHash as T}from"node:crypto";import{createReadStream as _,createWriteStream as z}from"node:fs";import{rm as f,stat as k}from"node:fs/promises";import{Readable as C,Transform as Y}from"node:stream";import{pipeline as x}from"node:stream/promises";import{setTimeout as H}from"node:timers/promises";import{RuntimeError as i}from"./errors.js";export const DOWNLOAD_STALL_MS=3e4,DOWNLOAD_RETRIES=3,DOWNLOAD_RETRY_DELAY_MS=1e3;const I=e=>e===408||e===425||e===429||e>=500,p=(e,r)=>new i("cancelled",`Stopped downloading ${e}.`,{cause:r}),P=async e=>k(e).then(r=>r.size,()=>0),j=e=>{const r=/^bytes (\d+)-/u.exec(e??"")?.[1];return r===void 0?void 0:Number(r)};export async function download(e,r,$){const{size:s,sha256:b,signal:c,onProgress:A,onRetry:W,stallMs:S=DOWNLOAD_STALL_MS,retries:E=DOWNLOAD_RETRIES,retryDelayMs:L=DOWNLOAD_RETRY_DELAY_MS}=$,g=E+1;let h;const v=async()=>{const o=await P(r);if(o>=s)return{received:o,digest:await sha256Of(r)};const a=new AbortController,d=c?AbortSignal.any([c,a.signal]):a.signal;let m;const u=()=>{clearTimeout(m),m=setTimeout(()=>{a.abort()},S)},D=()=>new i("download",`${e} sent nothing for ${String(S/1e3)} s.`);u();try{const M=o>0?{range:`bytes=${String(o)}-`,...h?{"if-range":h}:{}}:{};let n;try{n=await $.fetch(e,{redirect:"follow",headers:M,signal:d})}catch(t){if(c?.aborted)throw p(e,t);return a.signal.aborted?D():new i("download",`Could not reach ${e}: ${R(t)}`,{cause:t})}if(!n.ok||!n.body){await n.body?.cancel().catch(()=>{});const t=new i("download",`${e} answered ${String(n.status)}.`);if(I(n.status))return t;throw t}const l=n.status===206&&j(n.headers.get("content-range"))===o;if(n.status===206&&!l)return await n.body.cancel().catch(()=>{}),await f(r,{force:!0}),new i("download",`${e} answered another range than bytes=${String(o)}-.`);if(!l){const t=n.headers.get("etag");h=t&&!t.startsWith("W/")?t:n.headers.get("last-modified")??void 0}const y=T("sha256");let w=0;if(l)for await(const t of _(r))y.update(t),w+=t.length;const N=new Y({transform(t,q,O){if(u(),w+=t.length,w>s){O(new i("checksum",`${e} is larger than its pin (${String(s)} bytes).`));return}y.update(t),A?.(w,s),O(null,t)}});u();try{await x(C.fromWeb(n.body),N,z(r,{flags:l?"a":"w"}),{signal:d})}catch(t){if(t instanceof i)throw t;if(c?.aborted)throw p(e,t);return a.signal.aborted?D():new i("download",`Downloading ${e} failed: ${R(t)}`,{cause:t})}return{received:w,digest:y.digest("hex")}}finally{clearTimeout(m)}};await f(r,{force:!0});for(let o=1;;o++){let a;try{a=await v()}catch(d){throw await f(r,{force:!0}),d}if(!(a instanceof i)){if(a.received!==s||a.digest!==b)throw await f(r,{force:!0}),new i("checksum",`${e} came as ${String(a.received)} bytes with sha256 ${a.digest}; its pin is ${String(s)} bytes, ${b}.`);return}if(o>=g)throw await f(r,{force:!0}),new i("download",g>1?`${a.message} Tried ${String(g)} times.`:a.message,{cause:a});W?.(a,o,g);try{await H(L*2**(o-1),void 0,c?{signal:c}:{})}catch(d){throw await f(r,{force:!0}),p(e,d)}}}export async function sha256Of(e){const r=T("sha256");return await x(_(e),r),r.digest("hex")}const R=e=>e instanceof Error?e.message:String(e);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { binVariable, createRuntimes, type EnsureOptions, type Located, type Progress, type Runtimes, type RuntimesOptions, type Status, } from "./runtimes.js";
|
|
2
|
-
export { createPackages, npmCi, type EnsurePackageOptions, type LoadOptions, type Install, type LocatedPackage, type Packages, type PackagesOptions, } from "./packages.js";
|
|
2
|
+
export { createPackages, npmCi, NPM_FETCH_TIMEOUT_MS, NPM_STALL_MS, type EnsurePackageOptions, type InstallOptions, type LoadOptions, type Install, type LocatedPackage, type Packages, type PackagesOptions, } from "./packages.js";
|
|
3
3
|
export { bundledEnv, type BundledOptions } from "./bundled.js";
|
|
4
4
|
export { RuntimeError, type RuntimeErrorCode } from "./errors.js";
|
|
5
5
|
export { cacheHome } from "./home.js";
|
|
6
6
|
export { shippedManifest } from "./manifest.js";
|
|
7
|
-
export { download, sha256Of } from "./download.js";
|
|
7
|
+
export { download, sha256Of, DOWNLOAD_RETRIES, DOWNLOAD_RETRY_DELAY_MS, DOWNLOAD_STALL_MS, type DownloadOptions, type DownloadTimings, } from "./download.js";
|
|
8
8
|
export { withLock } from "./lock.js";
|
|
9
9
|
export { unzip, untgz } from "./unpack.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export{binVariable,createRuntimes}from"./runtimes.js";export{createPackages,npmCi}from"./packages.js";export{bundledEnv}from"./bundled.js";export{RuntimeError}from"./errors.js";export{cacheHome}from"./home.js";export{shippedManifest}from"./manifest.js";export{download,sha256Of}from"./download.js";export{withLock}from"./lock.js";export{unzip,untgz}from"./unpack.js";
|
|
2
|
+
export{binVariable,createRuntimes}from"./runtimes.js";export{createPackages,npmCi,NPM_FETCH_TIMEOUT_MS,NPM_STALL_MS}from"./packages.js";export{bundledEnv}from"./bundled.js";export{RuntimeError}from"./errors.js";export{cacheHome}from"./home.js";export{shippedManifest}from"./manifest.js";export{download,sha256Of,DOWNLOAD_RETRIES,DOWNLOAD_RETRY_DELAY_MS,DOWNLOAD_STALL_MS}from"./download.js";export{withLock}from"./lock.js";export{unzip,untgz}from"./unpack.js";
|
|
@@ -5,4 +5,10 @@ export interface LockOptions {
|
|
|
5
5
|
onWait?: () => void;
|
|
6
6
|
}
|
|
7
7
|
export declare function withLock<T>(path: string, run: () => Promise<T>, options?: LockOptions): Promise<T>;
|
|
8
|
+
/** A new staging folder's path for `dir`, owned by this process. */
|
|
9
|
+
export declare const partialOf: (dir: string) => string;
|
|
10
|
+
/** Whether a process of this computer runs by that pid (one of another user's counts). */
|
|
11
|
+
export declare function running(pid: number): boolean;
|
|
12
|
+
/** Removes the staging folders in `root` of any version of `name` whose process has ended. */
|
|
13
|
+
export declare function sweepPartials(root: string, name: string): Promise<void>;
|
|
8
14
|
//# sourceMappingURL=lock.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{setTimeout as
|
|
2
|
+
import{randomBytes as l}from"node:crypto";import{readdir as p,rm as u}from"node:fs/promises";import{join as m}from"node:path";import{setTimeout as d}from"node:timers/promises";import{lock as w}from"proper-lockfile";export async function withLock(r,o,i={}){const{signal:t,pollMs:a=150,onWait:f}=i;let n,c,s=!1;for(;;){t?.throwIfAborted();try{c=await w(r,{lockfilePath:r,realpath:!1,onCompromised:e=>{n=e}});break}catch(e){if(e.code!=="ELOCKED")throw e;s||f?.(),s=!0,await d(a,void 0,t?{signal:t}:{})}}try{const e=await o();if(n)throw n;return e}finally{n||await c()}}const h=/\.partial-(\d+)-[0-9a-f]+$/u;export const partialOf=r=>`${r}.partial-${String(process.pid)}-${l(4).toString("hex")}`;export function running(r){try{return process.kill(r,0),!0}catch(o){return o.code==="EPERM"}}export async function sweepPartials(r,o){let i;try{i=await p(r)}catch{return}for(const t of i){if(!t.startsWith(`${o}@`))continue;const a=h.exec(t)?.[1];a!==void 0&&!running(Number(a))&&await u(m(r,t),{recursive:!0,force:!0})}}
|
|
@@ -6,11 +6,28 @@ export interface PackagesOptions {
|
|
|
6
6
|
env?: Readonly<Record<string, string | undefined>>;
|
|
7
7
|
/** What fills a folder from its package-lock.json (default: `npm ci`). */
|
|
8
8
|
install?: Install;
|
|
9
|
+
/** How long npm waits on a quiet connection (default: NPM_FETCH_TIMEOUT_MS). */
|
|
10
|
+
fetchTimeoutMs?: number | undefined;
|
|
11
|
+
/** How long an install may go without progress before it is stopped (default: NPM_STALL_MS). */
|
|
12
|
+
stallMs?: number | undefined;
|
|
9
13
|
}
|
|
10
|
-
export
|
|
14
|
+
export interface InstallOptions {
|
|
11
15
|
home: string;
|
|
12
16
|
signal?: AbortSignal | undefined;
|
|
13
|
-
|
|
17
|
+
/** npm's `--fetch-timeout`, its socket's idle limit (default: NPM_FETCH_TIMEOUT_MS). */
|
|
18
|
+
fetchTimeoutMs?: number | undefined;
|
|
19
|
+
/** No output and no change in its folders for this long stops it (default: NPM_STALL_MS). */
|
|
20
|
+
stallMs?: number | undefined;
|
|
21
|
+
}
|
|
22
|
+
export type Install = (dir: string, options: InstallOptions) => Promise<void>;
|
|
23
|
+
/** npm's `--fetch-timeout`: a connection quiet this long is dropped and tried again by npm (ms). */
|
|
24
|
+
export declare const NPM_FETCH_TIMEOUT_MS = 30000;
|
|
25
|
+
/**
|
|
26
|
+
* An install with no output and no change in its folder or npm's download
|
|
27
|
+
* folder for this long is stopped (ms): longer than npm's own timeout and
|
|
28
|
+
* retry, so npm says what went wrong first when it can.
|
|
29
|
+
*/
|
|
30
|
+
export declare const NPM_STALL_MS = 120000;
|
|
14
31
|
export interface LocatedPackage {
|
|
15
32
|
name: string;
|
|
16
33
|
version: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{spawn as
|
|
3
|
-
`).map(
|
|
4
|
-
`),await
|
|
2
|
+
import{spawn as R}from"node:child_process";import{createHash as I}from"node:crypto";import{existsSync as M,readFileSync as T}from"node:fs";import{copyFile as P,mkdir as j,readdir as _,readFile as A,rename as D,rm as k,stat as H,writeFile as C}from"node:fs/promises";import{createRequire as F}from"node:module";import{delimiter as z,join as o}from"node:path";import{fileURLToPath as U,pathToFileURL as J}from"node:url";import{DOWNLOAD_STALL_MS as W}from"./download.js";import{RuntimeError as b}from"./errors.js";import{cacheHome as G}from"./home.js";import{partialOf as q,sweepPartials as B,withLock as K}from"./lock.js";import{nodeCommand as V}from"./node-program.js";import{createRuntimes as X}from"./runtimes.js";const E=".allyhub-package.json",Y=U(new URL("../pins/",import.meta.url));export const NPM_FETCH_TIMEOUT_MS=W,NPM_STALL_MS=12e4;async function Q(n){const i=o(n,"node_modules","onnxruntime-node","bin","napi-v6");for(const s of await _(i)){if(s!==process.platform){await k(o(i,s),{recursive:!0,force:!0});continue}for(const l of await _(o(i,s)))l!==process.arch&&await k(o(i,s,l),{recursive:!0,force:!0})}if(process.platform!=="darwin")return;const a=o(i,"darwin",process.arch);for(const s of await _(a))/^libonnxruntime\.\d+\.\d+\.\d+\.dylib$/u.test(s)&&await k(o(a,s),{force:!0})}const Z={"onnxruntime-node":Q};export const NPX_SETTING=/^npm_config_(global|prefix|location|cache|.*_prefix)/iu;export function npmProblem(n,i){return n.split(`
|
|
3
|
+
`).map(s=>s.replace(/^npm (error|ERR!)\s*/u,"").trim()).find(s=>s!==""&&!/^(code|errno|syscall|path|type|A complete log|Exit handler|This is an error with npm|<https)/u.test(s))??`npm ended with code ${String(i)}`}const tt=(n,i)=>(i.PATH??"").split(z).some(a=>a!==""&&M(o(a,n)));export async function findNpm(n,i){const a=n.ALLYHUB_NPM??n.npm_execpath;if(a?.endsWith(".js"))return{command:V(n),script:[a]};if(tt("npm",n))return{command:"npm",script:[]};const s=await i(),{node:l,npm:d}=s;if(!l||!d)throw new Error("AllyHub's Node has no npm");return{command:l,script:[d]}}async function et(n,i){const a=await _(n,{recursive:!0}).catch(()=>[]);let s=0;for(const l of await _(i).catch(()=>[]))s+=await H(o(i,l)).then(d=>d.size,()=>0);return`${String(a.length)}:${String(s)}`}export const npmCi=async(n,{home:i,signal:a,fetchTimeoutMs:s=NPM_FETCH_TIMEOUT_MS,stallMs:l=NPM_STALL_MS})=>{const d=await findNpm(process.env,async()=>(await X({home:i}).ensure("node",{signal:a})).bins),O=Object.fromEntries(Object.entries(process.env).filter(([p])=>!NPX_SETTING.test(p))),m=o(i,"packages",".npm"),y=["ci","--ignore-scripts","--omit=dev","--no-audit","--no-fund","--omit=peer","--loglevel=error","--fetch-retries=1",`--fetch-timeout=${String(s)}`];await new Promise((p,h)=>{const w=R(d.command,[...d.script,...y],{cwd:n,env:{...O,npm_config_cache:m},stdio:["ignore","ignore","pipe"],...a?{signal:a}:{}});let g="",x=Date.now(),$="",v=!1,S=!1;const t=setInterval(()=>{v||S||(v=!0,et(n,o(m,"_cacache","tmp")).then(e=>{e!==$?($=e,x=Date.now()):Date.now()-x>=l&&(S=!0,w.kill(),setTimeout(()=>w.kill("SIGKILL"),5e3).unref())}).finally(()=>{v=!1}))},Math.max(20,Math.min(5e3,l/4)));w.stderr.on("data",e=>{x=Date.now(),g=`${g}${e.toString()}`.slice(-1e3)}),w.on("error",e=>{clearInterval(t),h(e)}),w.on("close",e=>{clearInterval(t),S?h(new b("install",`npm made no progress for ${String(l/1e3)} s and was stopped${g.trim()?`; it said: ${npmProblem(g,e)}`:""}`)):e===0?p():h(new Error(npmProblem(g,e)))})})};export function createPackages(n={}){const i=n.env??process.env,a=n.home??G(i),s=n.pins??Y,l=n.install??npmCi,{fetchTimeoutMs:d,stallMs:O}=n,m=o(a,"packages"),y=t=>{const e=o(s,t);let r,c;try{r=JSON.parse(T(o(e,"package.json"),"utf8")),c=T(o(e,"package-lock.json"),"utf8")}catch{throw new b("unknown-package",`AllyHub has no package "${t}".`)}const u=r.dependencies??{},f=u[t]??r.version;if(!f)throw new b("unknown-package",`The pin of "${t}" does not name it.`);return{version:f,holds:u,lock:I("sha256").update(c).digest("hex"),dir:e,size:r.allyhubSize??0}},p=(t,e)=>o(m,`${t}@${e.version}`),h=(t,e)=>{try{const r=JSON.parse(T(o(p(t,e),E),"utf8"));return r.version===e.version&&r.lock===e.lock}catch{return!1}},w=(t,e)=>({name:t,version:e.version,dir:p(t,e)}),g=async(t,e,r)=>{const c=p(t,e),u=q(c);await j(u,{recursive:!0});try{await P(o(e.dir,"package.json"),o(u,"package.json")),await P(o(e.dir,"package-lock.json"),o(u,"package-lock.json")),await l(u,{home:a,signal:r,fetchTimeoutMs:d,stallMs:O});for(const[f,L]of Object.entries(e.holds)){const N=JSON.parse(await A(o(u,"node_modules",f,"package.json"),"utf8"));if(N.version!==L)throw new Error(`it holds ${f} ${String(N.version)}, not ${L}`)}await Z[t]?.(u),await C(o(u,E),`${JSON.stringify({version:e.version,lock:e.lock,at:new Date().toISOString()})}
|
|
4
|
+
`),await k(c,{recursive:!0,force:!0}),await D(u,c),await x(t,e)}catch(f){throw await k(u,{recursive:!0,force:!0}),r?.aborted?new b("cancelled",`Stopped getting ${t}.`,{cause:f}):new b("install",`Could not get ${t} ${e.version} (${f instanceof Error?f.message:String(f)}). Check the connection and run it again.`,{cause:f})}},x=async(t,e)=>{const r=`${t}@${e.version}`;for(const c of await _(m))c.startsWith(`${t}@`)&&c!==r&&!c.startsWith(`${r}.`)&&await k(o(m,c),{recursive:!0,force:!0})},$=t=>{const e=y(t);return h(t,e)?w(t,e):void 0},v=(t,e)=>F(o(t,"package.json")).resolve(e),S=async(t,e={})=>{const r=y(t);return h(t,r)||(await j(m,{recursive:!0}).catch(c=>{throw new b("install",`Could not get ${t} ${r.version}: AllyHub cannot write to ${m}.`,{cause:c})}),await K(`${p(t,r)}.lock`,async()=>{h(t,r)||(await B(m,t),e.onFetch?.(t),await g(t,r,e.signal))},{signal:e.signal})),w(t,r)};return{home:a,locate:$,ensure:S,size:t=>y(t).size,entry(t){const e=$(t);return e?v(e.dir,t):void 0},resolve(t,e){const r=$(t);return r?v(r.dir,e):void 0},async load(t,e){const{dir:r}=await S(t,e),c=v(r,e?.module??t);return await import(J(c).href)},async remove(t){await k(p(t,y(t)),{recursive:!0,force:!0})}}}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Platform, type RuntimeManifest } from "@allyhub-next/protocol";
|
|
2
|
+
import { type DownloadTimings } from "./download.js";
|
|
2
3
|
export interface RuntimesOptions {
|
|
3
4
|
/** The cache folder (default: the system's, `cacheHome`). */
|
|
4
5
|
home?: string;
|
|
@@ -13,6 +14,8 @@ export interface RuntimesOptions {
|
|
|
13
14
|
* read as a hang to whoever runs them.
|
|
14
15
|
*/
|
|
15
16
|
log?: (line: string) => void;
|
|
17
|
+
/** How a download waits and tries again (defaults: download.ts's constants). */
|
|
18
|
+
downloads?: DownloadTimings;
|
|
16
19
|
}
|
|
17
20
|
export interface Located {
|
|
18
21
|
name: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{
|
|
3
|
-
`)}),w=
|
|
4
|
-
`),await
|
|
2
|
+
import{chmod as T,mkdir as E,readFile as W,rename as J,rm as z,writeFile as _}from"node:fs/promises";import{dirname as U,join as d}from"node:path";import{binsOf as A,filesFor as C,platformOf as V}from"@allyhub-next/protocol";import{download as Y,sha256Of as q}from"./download.js";import{RuntimeError as g}from"./errors.js";import{cacheHome as G}from"./home.js";import{partialOf as K,sweepPartials as Q,withLock as X}from"./lock.js";import{shippedManifest as Z}from"./manifest.js";import{inside as D,native as tt,undmg as et,untgz as rt,unzip as nt}from"./unpack.js";const F=".allyhub-runtime.json";export const binVariable=o=>`ALLYHUB_${o.toUpperCase().replaceAll("-","_")}`;const L=o=>`${String(Math.max(1,Math.round(o/1e6)))} MB`;function st(o,$,w,v){v(`Downloading ${o} ${$} (${L(w)}), once…`);let h=0;return u=>{const b=Math.floor(u/w*10)*10;b!==h&&(h=b,v(` ${String(b)}% (${L(u)} of ${L(w)})`))}}export function createRuntimes(o={}){const $=o.log??(t=>{process.stderr.write(`${t}
|
|
3
|
+
`)}),w=o.env??process.env,v=o.home??G(w),h=o.manifest??Z(),u="platform"in o?o.platform:V(process.platform,process.arch),b=o.fetch??globalThis.fetch,y=d(v,"runtimes"),j=t=>{const e=Object.hasOwn(h.runtimes,t)?h.runtimes[t]:void 0;if(!e)throw new g("unknown-runtime",`AllyHub has no runtime "${t}".`);return e},p=(t,e)=>d(y,`${t}@${e.version}`),k=(t,e)=>{const r=u?C(e,u):void 0;if(!r)throw new g("unsupported",`${t} ${e.version} has no build for ${u??`${process.platform}-${process.arch}`}.`);return r},H=(t,e,r)=>Object.fromEntries(Object.entries(A(k(t,e))).map(([n,s])=>[n,d(r,tt(s))])),N=(t,e)=>{const r=[...new Set(Object.values(e.platforms).flatMap(f=>Object.keys(A(f))))];if(r.length===0)return;const n=r.map(f=>[f,w[binVariable(f)]]);if(n.some(([,f])=>!f))return;const s=Object.fromEntries(n),c=n[0]?.[1]??"";return{name:t,version:void 0,dir:U(c),bins:s,from:"env"}},R=async(t,e)=>{try{const r=JSON.parse(await W(d(p(t,e),F),"utf8")),n=k(t,e).map(s=>s.sha256);return r.version===e.version&&JSON.stringify(r.files)===JSON.stringify(n)}catch{return!1}},M=async t=>{const e=j(t),r=N(t,e);if(r)return r;if(!await R(t,e))return;const n=p(t,e);return{name:t,version:e.version,dir:n,bins:H(t,e,n),from:"cache"}},I=async(t,e,r)=>{const n=k(t,e),s=p(t,e),c=K(s),f=d(c,".downloads");await E(f,{recursive:!0});const B=r.onProgress?void 0:st(t,e.version,n.reduce((l,i)=>l+i.size,0),$);let x=0;try{for(const[l,i]of n.entries()){const O=d(f,String(l));if(await Y(i.url,O,{size:i.size,sha256:i.sha256,fetch:b,signal:r.signal,...o.downloads,onRetry:(a,m,S)=>{$(` ${a.message} Trying again (${String(m+1)} of ${String(S)})…`)},onProgress:(a,m)=>{B?.(x+a),r.onProgress?.({runtime:t,url:i.url,received:a,total:m})}}),x+=i.size,i.unpack==="zip")await nt(O,c);else if(i.unpack==="tgz")await rt(O,c);else if(i.unpack==="dmg")await et(O,c);else{const a=D(c,i.name??ot(i.url));if(!a)throw new g("unpack",`${i.url} would be kept outside its folder.`);await E(U(a),{recursive:!0}),await J(O,a),i.executable&&await T(a,493)}for(const a of i.check){const m=D(c,a.path),S=m?await q(m).catch(()=>"missing"):"missing";if(S!==a.sha256)throw new g("checksum",`${a.path} from ${i.url} has sha256 ${S}; its pin is ${a.sha256}.`)}}await z(f,{recursive:!0,force:!0}),await _(d(c,F),`${JSON.stringify({version:e.version,files:n.map(l=>l.sha256),at:new Date().toISOString()})}
|
|
4
|
+
`),await z(s,{recursive:!0,force:!0}),await J(c,s)}catch(l){throw await z(c,{recursive:!0,force:!0}),l}},P=async(t,e={})=>{const r=j(t),n=await M(t);if(n)return n;k(t,r),await E(y,{recursive:!0}),await X(`${p(t,r)}.lock`,async()=>{await R(t,r)||(await Q(y,t),await I(t,r,e))},{signal:e.signal,onWait:()=>{$(`Waiting for ${t}, which another command is getting…`)}});const s=await M(t);if(!s)throw new g("download",`${t} was installed but cannot be found in ${y}.`);return s};return{home:v,platform:u,locate:M,ensure:P,async bin(t,e,r){const s=(await P(t,r)).bins[e];if(!s)throw new g("unknown-runtime",`${t} holds no program "${e}".`);return s},async remove(t){const e=j(t);await z(p(t,e),{recursive:!0,force:!0})},async status(){return Promise.all(Object.entries(h.runtimes).map(async([t,e])=>{const r=u?C(e,u):void 0,n=p(t,e),s=N(t,e)!==void 0?"env":r!==void 0&&await R(t,e)?"cache":void 0;return{name:t,about:e.about,version:e.version,license:e.license,available:r!==void 0,installed:s!==void 0,...s?{from:s}:{},size:(r??[]).reduce((c,f)=>c+f.size,0),dir:n}}))}}}const ot=o=>decodeURIComponent(new URL(o).pathname.split("/").pop()??"file");
|
|
@@ -76,7 +76,12 @@
|
|
|
76
76
|
"unpack": {
|
|
77
77
|
"default": "none",
|
|
78
78
|
"type": "string",
|
|
79
|
-
"enum": [
|
|
79
|
+
"enum": [
|
|
80
|
+
"none",
|
|
81
|
+
"zip",
|
|
82
|
+
"tgz",
|
|
83
|
+
"dmg"
|
|
84
|
+
]
|
|
80
85
|
},
|
|
81
86
|
"name": {
|
|
82
87
|
"type": "string",
|
|
@@ -97,7 +102,10 @@
|
|
|
97
102
|
"pattern": "^[0-9a-f]{64}$"
|
|
98
103
|
}
|
|
99
104
|
},
|
|
100
|
-
"required": [
|
|
105
|
+
"required": [
|
|
106
|
+
"path",
|
|
107
|
+
"sha256"
|
|
108
|
+
],
|
|
101
109
|
"additionalProperties": false
|
|
102
110
|
}
|
|
103
111
|
},
|
|
@@ -118,17 +126,29 @@
|
|
|
118
126
|
}
|
|
119
127
|
}
|
|
120
128
|
},
|
|
121
|
-
"required": [
|
|
129
|
+
"required": [
|
|
130
|
+
"url",
|
|
131
|
+
"sha256",
|
|
132
|
+
"size"
|
|
133
|
+
],
|
|
122
134
|
"additionalProperties": false
|
|
123
135
|
}
|
|
124
136
|
}
|
|
125
137
|
}
|
|
126
138
|
},
|
|
127
|
-
"required": [
|
|
139
|
+
"required": [
|
|
140
|
+
"about",
|
|
141
|
+
"version",
|
|
142
|
+
"license",
|
|
143
|
+
"platforms"
|
|
144
|
+
],
|
|
128
145
|
"additionalProperties": false
|
|
129
146
|
}
|
|
130
147
|
}
|
|
131
148
|
},
|
|
132
|
-
"required": [
|
|
149
|
+
"required": [
|
|
150
|
+
"version",
|
|
151
|
+
"runtimes"
|
|
152
|
+
],
|
|
133
153
|
"additionalProperties": false
|
|
134
154
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RefNode, StructuredNode } from "../formula/ast.js";
|
|
2
|
-
import type { SharedFormula, Workbook } from "../workbook.js";
|
|
2
|
+
import type { SharedFormula, Workbook, Worksheet } from "../workbook.js";
|
|
3
3
|
export interface Analysis {
|
|
4
4
|
reads: (RefNode | StructuredNode)[];
|
|
5
5
|
/** Defined names, in lower case. */
|
|
@@ -9,13 +9,19 @@ export interface Analysis {
|
|
|
9
9
|
unknownNames: string[];
|
|
10
10
|
/** Functions that are nothing here. */
|
|
11
11
|
unknownFunctions: string[];
|
|
12
|
-
/** Functions given too few or too many arguments. */
|
|
12
|
+
/** Functions given too few or too many arguments, or a repeating group of them left short (`group`, its size). */
|
|
13
13
|
arguments: {
|
|
14
14
|
name: string;
|
|
15
15
|
given: number;
|
|
16
16
|
min: number;
|
|
17
17
|
max: number;
|
|
18
|
+
group?: number;
|
|
18
19
|
}[];
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* A formula's analysis. `sheet`: the sheet it is on, whose own names come
|
|
23
|
+
* before the workbook's; without it every sheet's name of a spelling counts,
|
|
24
|
+
* so what a formula can read is never less than it reads.
|
|
25
|
+
*/
|
|
26
|
+
export declare function analyse(wb: Workbook, shared: SharedFormula, sheet?: Worksheet): Analysis;
|
|
21
27
|
//# sourceMappingURL=analyse.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{FUNCTIONS as
|
|
2
|
+
import{FUNCTIONS as p}from"./functions/index.js";import{fillsGroup as w}from"./functions/define.js";export function analyse(i,c,l){const a={reads:[],names:new Set,volatile:!1,unknownNames:[],unknownFunctions:[],arguments:[]},d=new Set,g=(e,t,n)=>{const r=e.toLowerCase();if(n===void 0&&t.has(r))return!0;const u=n===void 0?l:i.sheet(n),o=u?[i.name(r,u)]:i.definitions(r);if(o.some(m=>m!==void 0)){a.names.add(r);const m=`${n??""}!${r}`;if(!d.has(m)){d.add(m);for(const h of o)h?.formula?.node&&s(h.formula.node,new Set)}return!0}if(p.has(e.toUpperCase()))return!0;const f=i.table(r);return f?(a.reads.push({kind:"structured",table:f.name,sections:[],columns:[],thisRow:!1}),!0):!1},s=(e,t)=>{switch(e.kind){case"ref":case"structured":a.reads.push(e);return;case"name":g(e.name,t,e.sheet)||a.unknownNames.push(e.name);return;case"unary":case"postfix":case"paren":s(e.arg,t);return;case"binary":s(e.left,t),s(e.right,t);return;case"array":return;case"invoke":s(e.callee,t);for(const n of e.args)s(n,t);return;case"call":{const n=p.get(e.name);if(e.name==="LET"||e.name==="LAMBDA"){const r=new Set(t),u=e.args[e.args.length-1];e.args.forEach((o,f)=>{if(o!==u){if(e.name==="LET"&&f%2===1){s(o,r);return}o.kind==="name"&&r.add(o.name.toLowerCase())}}),u&&s(u,r);return}if(!n)g(e.written,t)||a.unknownFunctions.push(e.name);else{n.volatile===!0&&(a.volatile=!0);const r=n.kind==="raw"&&!w(n.params,e.args.length);(e.args.length<n.min||e.args.length>n.max||r)&&a.arguments.push({name:e.name,given:e.args.length,min:n.min,max:n.max,...r?{group:n.params.group.length}:{}})}for(const r of e.args)s(r,t);return}default:return}};return c.node&&s(c.node,new Set),a}
|
|
@@ -4,7 +4,11 @@ export declare function numberOfText(text: string): number | undefined;
|
|
|
4
4
|
export declare function toNumber(v: Scalar | undefined): number | CellError;
|
|
5
5
|
export declare function toText(v: Scalar | undefined): string | CellError;
|
|
6
6
|
export declare function toBool(v: Scalar | undefined): boolean | CellError;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Equal to 15 significant digits, as Excel compares numbers. Two numbers that
|
|
9
|
+
* round to the same 15 digits are within 1e-13 of each other relatively, so
|
|
10
|
+
* any further apart are told apart without rounding either.
|
|
11
|
+
*/
|
|
8
12
|
export declare const sameNumber: (a: number, b: number) => boolean;
|
|
9
13
|
/** Excel's order of two values that are not errors: numbers, then text, then TRUE and FALSE. */
|
|
10
14
|
export declare function compare(a: Scalar, b: Scalar): number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{parseValue as d}from"numfmt";import{CellError as f,ERR as s,Matrix as x,numberText as h,readTyped as
|
|
2
|
+
import{parseValue as d}from"numfmt";import{CellError as f,ERR as s,Matrix as x,numberText as h,readTyped as M}from"../values.js";export function numberOfText(e){if(!/\d/u.test(e))return;const r=M(e.trim());if(typeof r.value=="number")return r.value;if(e.trim()==="")return;const t=d(e);return typeof t?.value=="number"?t.value:void 0}export function toNumber(e){return typeof e=="number"?e:e==null?0:typeof e=="boolean"?e?1:0:e instanceof f?e:numberOfText(e)??s.VALUE}export function toText(e){return typeof e=="string"?e:e==null?"":typeof e=="number"?h(e):typeof e=="boolean"?e?"TRUE":"FALSE":e}export function toBool(e){if(typeof e=="boolean")return e;if(e==null)return!1;if(typeof e=="number")return e!==0;if(e instanceof f)return e;const r=e.trim().toUpperCase();return r==="TRUE"?!0:r==="FALSE"?!1:s.VALUE}const m=e=>typeof e=="number"?0:typeof e=="string"?1:2;export const sameNumber=(e,r)=>e===r?!0:Math.abs(e-r)>1e-13*Math.max(Math.abs(e),Math.abs(r))?!1:Number(e.toPrecision(15))===Number(r.toPrecision(15));export function compare(e,r){const t=e??(typeof r=="string"?"":typeof r=="boolean"?!1:0),n=r??(typeof e=="string"?"":typeof e=="boolean"?!1:0),o=m(t),c=m(n);if(o!==c)return o<c?-1:1;if(typeof t=="number"&&typeof n=="number")return sameNumber(t,n)?0:t<n?-1:1;if(typeof t=="string"&&typeof n=="string"){const a=t.toUpperCase(),u=n.toUpperCase();return a===u?0:a<u?-1:1}return t===n?0:t===!1?-1:1}export const finite=e=>Number.isFinite(e)?e:s.NUM;export function snap(e,r,t){return Math.abs(e)<=Math.max(Math.abs(r),Math.abs(t))*89e-17?0:e}export function arithmetic(e,r,t){const n=toNumber(r);if(n instanceof f)return n;const o=toNumber(t);if(o instanceof f)return o;switch(e){case"+":return finite(snap(n+o,n,o));case"-":return finite(snap(n-o,n,o));case"*":return finite(n*o);case"/":return o===0?s.DIV0:finite(n/o);default:return n===0&&o===0?s.NUM:n===0&&o<0?s.DIV0:finite(n**o)}}export function binary(e,r,t){if(r instanceof f)return r;if(t instanceof f)return t;switch(e){case"&":{const n=toText(r);if(n instanceof f)return n;const o=toText(t);return o instanceof f?o:`${n}${o}`}case"=":return compare(r,t)===0;case"<>":return compare(r,t)!==0;case"<":return compare(r,t)<0;case"<=":return compare(r,t)<=0;case">":return compare(r,t)>0;case">=":return compare(r,t)>=0;default:return arithmetic(e,r,t)}}export function mapBoth(e,r,t){const n=Math.max(e.rows,r.rows),o=Math.max(e.cols,r.cols),c=new Array(n*o),a=(u,i,l)=>{const p=u.rows===1?0:i,y=u.cols===1?0:l;return p<u.rows&&y<u.cols?u.at(p,y):void 0};for(let u=0;u<n;u++)for(let i=0;i<o;i++){const l=a(e,u,i),p=a(r,u,i);c[u*o+i]=l===void 0||p===void 0?s.NA:t(l,p)}return new x(n,o,c)}
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import type { Node, RefNode, StructuredNode } from "../formula/ast.js";
|
|
2
2
|
import { CellError, Matrix, type Scalar } from "../values.js";
|
|
3
3
|
import { FormulaCell, SharedFormula, type Slot, type Workbook, type Worksheet } from "../workbook.js";
|
|
4
|
+
import { type Computed } from "./remote.js";
|
|
5
|
+
import { RangeCache, type Index } from "./indexes.js";
|
|
6
|
+
import { type FunctionDef } from "./functions/index.js";
|
|
4
7
|
import { Lambda, Reference, Union, type Frame, type Value } from "./types.js";
|
|
5
8
|
export interface CalcOptions {
|
|
6
9
|
/** The moment NOW and TODAY read. Default: the clock. */
|
|
7
10
|
now?: Date;
|
|
8
11
|
/** What RAND reads, values from 0 up to 1. Default: Math.random. */
|
|
9
12
|
random?: () => number;
|
|
13
|
+
/**
|
|
14
|
+
* Keeps what each pass settles for `takeComputed`: a calculation in a
|
|
15
|
+
* worker, which sends it to the model the page reads.
|
|
16
|
+
*/
|
|
17
|
+
report?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Computes nothing: a model the page reads while a calculation elsewhere
|
|
20
|
+
* works. What is typed shows at once; what formulas give arrives by
|
|
21
|
+
* `receive`, and a formula reads as it last did until then. A formula
|
|
22
|
+
* given to `evaluate` (a rule's, a validation's) is worked out over that.
|
|
23
|
+
*/
|
|
24
|
+
replica?: boolean;
|
|
10
25
|
}
|
|
11
26
|
/**
|
|
12
27
|
* Random numbers that are the same for the same seed, for a result that must
|
|
@@ -31,12 +46,15 @@ export declare class Calc {
|
|
|
31
46
|
private readonly stack;
|
|
32
47
|
private readonly inCycle;
|
|
33
48
|
private readonly namesAt;
|
|
34
|
-
|
|
35
|
-
private readonly
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
private readonly
|
|
39
|
-
|
|
49
|
+
/** Who reads whom: made the first time something changes. */
|
|
50
|
+
private readonly graph;
|
|
51
|
+
private graphMade;
|
|
52
|
+
/** Keeps what each pass settles, for `takeComputed`. */
|
|
53
|
+
private readonly reports;
|
|
54
|
+
/** Computes nothing; results arrive by `receive`. */
|
|
55
|
+
readonly replica: boolean;
|
|
56
|
+
/** What passes settled since `takeComputed` was last asked. */
|
|
57
|
+
private readonly settled;
|
|
40
58
|
/** What spills changed since it was last looked at. */
|
|
41
59
|
private moved;
|
|
42
60
|
/** Formula cells whose spill's size turned out to depend on itself. */
|
|
@@ -44,8 +62,10 @@ export declare class Calc {
|
|
|
44
62
|
private readonly hiddenBy;
|
|
45
63
|
/** What reads what no reference shows (OFFSET, INDIRECT) or changes by itself (NOW, RAND): computed with every change, as Excel's are. */
|
|
46
64
|
private volatiles;
|
|
47
|
-
/** Lookup indexes of ranges,
|
|
48
|
-
readonly indexes:
|
|
65
|
+
/** Lookup and criteria indexes of ranges, each kept until its range changes. */
|
|
66
|
+
readonly indexes: RangeCache<Index>;
|
|
67
|
+
/** Criteria functions' results over ranges, each kept until a range it read changes. */
|
|
68
|
+
readonly results: RangeCache<Scalar>;
|
|
49
69
|
readonly wb: Workbook;
|
|
50
70
|
constructor(wb: Workbook, o?: CalcOptions);
|
|
51
71
|
private allCells;
|
|
@@ -65,6 +85,8 @@ export declare class Calc {
|
|
|
65
85
|
/** What an empty place reads: nothing, or the value a formula spilled into it. */
|
|
66
86
|
private ghost;
|
|
67
87
|
private circular;
|
|
88
|
+
/** What was worked out over ranges that hold changed cells is worked out again. */
|
|
89
|
+
private forget;
|
|
68
90
|
private run;
|
|
69
91
|
/**
|
|
70
92
|
* What reads a spill's cells computed again until nothing moves: who reads
|
|
@@ -79,6 +101,8 @@ export declare class Calc {
|
|
|
79
101
|
private analysisOf;
|
|
80
102
|
/** What a formula cell reads, by what evaluating its references gives. */
|
|
81
103
|
private readsOf;
|
|
104
|
+
/** What a formula reads evaluated at a place, an entry a reference (each place of a union its own); undefined where one gives no place. */
|
|
105
|
+
private readsAt;
|
|
82
106
|
/** What a formula that is in no cell reads: a chart's, a rule's, a check's. */
|
|
83
107
|
readsOfFormula(shared: SharedFormula, sheet: Worksheet): Reference[];
|
|
84
108
|
/** `seeds`, and what they read that is to be computed, each after what it reads. */
|
|
@@ -103,6 +127,7 @@ export declare class Calc {
|
|
|
103
127
|
private bound;
|
|
104
128
|
resolveRef(n: RefNode, f: Frame): Reference | Union | CellError;
|
|
105
129
|
structured(n: StructuredNode, f: Frame): Reference | Union | CellError;
|
|
130
|
+
/** A name's value: a LET's or a LAMBDA's, else the sheet's own (`sheet` when it is written Sheet1!name), else the workbook's. */
|
|
106
131
|
private nameValue;
|
|
107
132
|
private intersect;
|
|
108
133
|
private unary;
|
|
@@ -115,17 +140,31 @@ export declare class Calc {
|
|
|
115
140
|
/** A LAMBDA given its arguments' values. */
|
|
116
141
|
apply(l: Lambda, args: readonly Value[]): Value;
|
|
117
142
|
private call;
|
|
118
|
-
/**
|
|
119
|
-
|
|
143
|
+
/**
|
|
144
|
+
* A function given its arguments' values: every function call goes through
|
|
145
|
+
* here, a function's own call of another (AGGREGATE's) too, so each is
|
|
146
|
+
* lifted over arrays as its parameters say.
|
|
147
|
+
*/
|
|
148
|
+
applyFunction(def: FunctionDef, values: readonly Value[], f: Frame): Value;
|
|
149
|
+
/**
|
|
150
|
+
* A function over its arguments, as Excel lifts one: where a single value
|
|
151
|
+
* goes and an array or a range of several cells is given, the function is
|
|
152
|
+
* applied over each of its cells and the results are an array. Arrays of
|
|
153
|
+
* different sizes are stretched along a side of one, and give #N/A past the
|
|
154
|
+
* end of a shorter one. Every argument taken as a single value is given as
|
|
155
|
+
* one (a Scalar, or Missing when left empty).
|
|
156
|
+
*/
|
|
157
|
+
private over;
|
|
158
|
+
/** One cell of a lifted function's array: what one call gave, as a single value. */
|
|
159
|
+
private element;
|
|
120
160
|
/** One scalar from a value: a range in a place for one gives the cell in the formula's row or column. */
|
|
121
161
|
scalar(v: Value, f: Frame): Scalar;
|
|
122
162
|
/** Lets NOW, TODAY, RAND and whatever else is volatile change on the next pass. */
|
|
123
163
|
recalculate(): this;
|
|
124
|
-
private key;
|
|
125
|
-
private addEdges;
|
|
126
|
-
private removeEdges;
|
|
127
164
|
/** The graph of who reads whom: made the first time something changes. */
|
|
128
165
|
private build;
|
|
166
|
+
private addEdges;
|
|
167
|
+
private removeEdges;
|
|
129
168
|
/** Who reads any place of an area. */
|
|
130
169
|
private readersIn;
|
|
131
170
|
/** Who reads a place. */
|
|
@@ -146,6 +185,14 @@ export declare class Calc {
|
|
|
146
185
|
change(cells: readonly CellChange[]): void;
|
|
147
186
|
/** Sets a defined name's constant (a scenario's) and computes what reads it. */
|
|
148
187
|
setName(name: string, value: Scalar): void;
|
|
188
|
+
/** What passes settled since this was last asked, for the model the page reads (`receive`). */
|
|
189
|
+
takeComputed(): Computed;
|
|
190
|
+
/**
|
|
191
|
+
* What a calculation elsewhere computed, put in this model: each formula
|
|
192
|
+
* cell's value and spill. A cell no longer a formula, or another formula
|
|
193
|
+
* now, is left as it is: what was typed there since is newer.
|
|
194
|
+
*/
|
|
195
|
+
receive(computed: Computed): void;
|
|
149
196
|
/** Numbers of a value, for code outside a formula. */
|
|
150
197
|
numberOf(v: Scalar): number | CellError;
|
|
151
198
|
}
|