@mistriwork/engine 0.0.0-stage → 1.0.0-rc.10
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/LICENSE +21 -0
- package/README.md +17 -2
- package/dist/adapters/adapter.d.ts +693 -0
- package/dist/adapters/adapter.js +444 -0
- package/dist/adapters/cache/cacheStore.d.ts +75 -0
- package/dist/adapters/cache/cacheStore.js +160 -0
- package/dist/adapters/cache/resp.d.ts +52 -0
- package/dist/adapters/cache/resp.js +237 -0
- package/dist/adapters/commands/canonicalJson.d.ts +19 -0
- package/dist/adapters/commands/canonicalJson.js +154 -0
- package/dist/adapters/connect.d.ts +29 -0
- package/dist/adapters/connect.js +40 -0
- package/dist/adapters/connectionBudget.d.ts +101 -0
- package/dist/adapters/connectionBudget.js +128 -0
- package/dist/adapters/dbLatency.d.ts +35 -0
- package/dist/adapters/dbLatency.js +79 -0
- package/dist/adapters/epochCache.d.ts +50 -0
- package/dist/adapters/epochCache.js +85 -0
- package/dist/adapters/http/egress.d.ts +48 -0
- package/dist/adapters/http/egress.js +175 -0
- package/dist/adapters/http/httpAdapter.d.ts +71 -0
- package/dist/adapters/http/httpAdapter.js +512 -0
- package/dist/adapters/http/httpDescription.d.ts +32 -0
- package/dist/adapters/http/httpDescription.js +246 -0
- package/dist/adapters/http/openapi.d.ts +98 -0
- package/dist/adapters/http/openapi.js +487 -0
- package/dist/adapters/layoutRefusal.d.ts +24 -0
- package/dist/adapters/layoutRefusal.js +35 -0
- package/dist/adapters/net/networkPolicy.d.ts +44 -0
- package/dist/adapters/net/networkPolicy.js +123 -0
- package/dist/adapters/net/untrustedDatabase.d.ts +18 -0
- package/dist/adapters/net/untrustedDatabase.js +120 -0
- package/dist/adapters/poolAdmission.d.ts +43 -0
- package/dist/adapters/poolAdmission.js +184 -0
- package/dist/adapters/poolMetrics.d.ts +121 -0
- package/dist/adapters/poolMetrics.js +185 -0
- package/dist/adapters/postgres.d.ts +436 -0
- package/dist/adapters/postgres.js +1890 -0
- package/dist/adapters/postgresCatalog.d.ts +96 -0
- package/dist/adapters/postgresCatalog.js +387 -0
- package/dist/adapters/postgresCatalogDigest.d.ts +30 -0
- package/dist/adapters/postgresCatalogDigest.js +87 -0
- package/dist/adapters/postgresCatalogRows.d.ts +62 -0
- package/dist/adapters/postgresCatalogRows.js +37 -0
- package/dist/adapters/postgresDates.d.ts +1 -0
- package/dist/adapters/postgresDates.js +39 -0
- package/dist/adapters/postgresMaintenance.d.ts +33 -0
- package/dist/adapters/postgresMaintenance.js +179 -0
- package/dist/adapters/postgresPool.d.ts +255 -0
- package/dist/adapters/postgresPool.js +838 -0
- package/dist/adapters/postgresPooler.d.ts +28 -0
- package/dist/adapters/postgresPooler.js +267 -0
- package/dist/adapters/postgresReadCatalog.d.ts +31 -0
- package/dist/adapters/postgresReadCatalog.js +226 -0
- package/dist/adapters/postgresReadSnapshot.d.ts +46 -0
- package/dist/adapters/postgresReadSnapshot.js +133 -0
- package/dist/adapters/postgresSchemaEpoch.d.ts +24 -0
- package/dist/adapters/postgresSchemaEpoch.js +149 -0
- package/dist/adapters/postgresTransactionHandle.d.ts +173 -0
- package/dist/adapters/postgresTransactionHandle.js +524 -0
- package/dist/adapters/postgresValues.d.ts +30 -0
- package/dist/adapters/postgresValues.js +75 -0
- package/dist/adapters/replicas.d.ts +70 -0
- package/dist/adapters/replicas.js +208 -0
- package/dist/adapters/reservedSql.d.ts +38 -0
- package/dist/adapters/reservedSql.js +264 -0
- package/dist/adapters/rolePrivileges.d.ts +17 -0
- package/dist/adapters/rolePrivileges.js +22 -0
- package/dist/adapters/scoped/keyRows.d.ts +65 -0
- package/dist/adapters/scoped/keyRows.js +173 -0
- package/dist/adapters/scoped/postgresScopeCatalog.d.ts +16 -0
- package/dist/adapters/scoped/postgresScopeCatalog.js +117 -0
- package/dist/adapters/scoped/scopedCommandOperations.d.ts +5 -0
- package/dist/adapters/scoped/scopedCommandOperations.js +48 -0
- package/dist/adapters/scoped/scopedReads.d.ts +20 -0
- package/dist/adapters/scoped/scopedReads.js +174 -0
- package/dist/adapters/scoped/scopedTransaction.d.ts +89 -0
- package/dist/adapters/scoped/scopedTransaction.js +303 -0
- package/dist/adapters/scoped/sqliteScopeCatalog.d.ts +16 -0
- package/dist/adapters/scoped/sqliteScopeCatalog.js +241 -0
- package/dist/adapters/scoped/updateGuard.d.ts +3 -0
- package/dist/adapters/scoped/updateGuard.js +40 -0
- package/dist/adapters/serverSettings.d.ts +45 -0
- package/dist/adapters/serverSettings.js +46 -0
- package/dist/adapters/sqlite.d.ts +262 -0
- package/dist/adapters/sqlite.js +1434 -0
- package/dist/adapters/sqliteCostlyReads.d.ts +33 -0
- package/dist/adapters/sqliteCostlyReads.js +49 -0
- package/dist/adapters/sqliteDecimals.d.ts +22 -0
- package/dist/adapters/sqliteDecimals.js +57 -0
- package/dist/adapters/sqliteHandles.d.ts +43 -0
- package/dist/adapters/sqliteHandles.js +143 -0
- package/dist/adapters/sqliteStatementProcess.d.ts +29 -0
- package/dist/adapters/sqliteStatementProcess.js +131 -0
- package/dist/adapters/statementControl.d.ts +34 -0
- package/dist/adapters/statementControl.js +90 -0
- package/dist/adapters/storeHost.d.ts +130 -0
- package/dist/adapters/storeHost.js +13 -0
- package/dist/adapters/telemetry/drivers.d.ts +21 -0
- package/dist/adapters/telemetry/drivers.js +321 -0
- package/dist/adapters/telemetry/metrics.d.ts +63 -0
- package/dist/adapters/telemetry/metrics.js +122 -0
- package/dist/adapters/telemetry/otlp.d.ts +12 -0
- package/dist/adapters/telemetry/otlp.js +320 -0
- package/dist/adapters/telemetry/otlpEncode.d.ts +48 -0
- package/dist/adapters/telemetry/otlpEncode.js +366 -0
- package/dist/adapters/telemetry/otlpEnv.d.ts +1 -0
- package/dist/adapters/telemetry/otlpEnv.js +12 -0
- package/dist/adapters/telemetry/serverTiming.d.ts +83 -0
- package/dist/adapters/telemetry/serverTiming.js +503 -0
- package/dist/adapters/telemetry/start.d.ts +10 -0
- package/dist/adapters/telemetry/start.js +25 -0
- package/dist/adapters/telemetry/statement.d.ts +16 -0
- package/dist/adapters/telemetry/statement.js +134 -0
- package/dist/adapters/telemetry/trace.d.ts +127 -0
- package/dist/adapters/telemetry/trace.js +295 -0
- package/dist/adapters/writeAhead.d.ts +27 -0
- package/dist/adapters/writeAhead.js +46 -0
- package/dist/adapters/writeAttribution.d.ts +18 -0
- package/dist/adapters/writeAttribution.js +23 -0
- package/dist/adapters/writeCapture.d.ts +73 -0
- package/dist/adapters/writeCapture.js +20 -0
- package/dist/adapters/writeLanes.d.ts +94 -0
- package/dist/adapters/writeLanes.js +232 -0
- package/dist/engine.d.ts +15 -0
- package/dist/engine.js +13 -0
- package/dist/server/auth/credentials.d.ts +61 -0
- package/dist/server/auth/credentials.js +260 -0
- package/dist/server/cacheService.d.ts +50 -0
- package/dist/server/cacheService.js +110 -0
- package/dist/server/cli/args.d.ts +176 -0
- package/dist/server/cli/args.js +342 -0
- package/dist/server/cli/bin.d.ts +5 -0
- package/dist/server/cli/bin.js +66 -0
- package/dist/server/cli/browser.d.ts +15 -0
- package/dist/server/cli/browser.js +37 -0
- package/dist/server/cli/config.d.ts +50 -0
- package/dist/server/cli/config.js +206 -0
- package/dist/server/cli/startup.d.ts +36 -0
- package/dist/server/cli/startup.js +128 -0
- package/dist/server/cli/startupOptions.d.ts +63 -0
- package/dist/server/cli/startupOptions.js +143 -0
- package/dist/server/cli/subcommand.d.ts +28 -0
- package/dist/server/cli/subcommand.js +32 -0
- package/dist/server/cli/usage.d.ts +13 -0
- package/dist/server/cli/usage.js +31 -0
- package/dist/server/clientHttp.d.ts +184 -0
- package/dist/server/clientHttp.js +700 -0
- package/dist/server/clientSurface.d.ts +128 -0
- package/dist/server/clientSurface.js +182 -0
- package/dist/server/columnGrants.d.ts +103 -0
- package/dist/server/columnGrants.js +730 -0
- package/dist/server/compileCache.d.ts +1 -0
- package/dist/server/compileCache.js +30 -0
- package/dist/server/config/locations.d.ts +1 -0
- package/dist/server/config/locations.js +15 -0
- package/dist/server/configPaths.d.ts +7 -0
- package/dist/server/configPaths.js +34 -0
- package/dist/server/configSections.d.ts +64 -0
- package/dist/server/configSections.js +72 -0
- package/dist/server/connectionRedaction.d.ts +30 -0
- package/dist/server/connectionRedaction.js +77 -0
- package/dist/server/connections.d.ts +353 -0
- package/dist/server/connections.js +978 -0
- package/dist/server/constraints.d.ts +82 -0
- package/dist/server/constraints.js +169 -0
- package/dist/server/demo.d.ts +9 -0
- package/dist/server/demo.js +554 -0
- package/dist/server/devclient.d.ts +108 -0
- package/dist/server/devclient.js +361 -0
- package/dist/server/evidence.d.ts +55 -0
- package/dist/server/evidence.js +323 -0
- package/dist/server/hiddenColumns.d.ts +32 -0
- package/dist/server/hiddenColumns.js +238 -0
- package/dist/server/http/baselineHeaders.d.ts +24 -0
- package/dist/server/http/baselineHeaders.js +12 -0
- package/dist/server/http/captured.d.ts +35 -0
- package/dist/server/http/captured.js +73 -0
- package/dist/server/http/clock.d.ts +1 -0
- package/dist/server/http/clock.js +14 -0
- package/dist/server/http/connectionSource.d.ts +4 -0
- package/dist/server/http/connectionSource.js +48 -0
- package/dist/server/http/context.d.ts +189 -0
- package/dist/server/http/context.js +11 -0
- package/dist/server/http/crawlerText.d.ts +15 -0
- package/dist/server/http/crawlerText.js +32 -0
- package/dist/server/http/dataRoutes.d.ts +88 -0
- package/dist/server/http/dataRoutes.js +137 -0
- package/dist/server/http/door.d.ts +57 -0
- package/dist/server/http/door.js +39 -0
- package/dist/server/http/exportRoute.d.ts +15 -0
- package/dist/server/http/exportRoute.js +320 -0
- package/dist/server/http/firstPaint.d.ts +108 -0
- package/dist/server/http/firstPaint.js +262 -0
- package/dist/server/http/httpOperationRoutes.d.ts +11 -0
- package/dist/server/http/httpOperationRoutes.js +50 -0
- package/dist/server/http/pageReads.d.ts +20 -0
- package/dist/server/http/pageReads.js +205 -0
- package/dist/server/http/pageRoutes.d.ts +39 -0
- package/dist/server/http/pageRoutes.js +291 -0
- package/dist/server/http/probes.d.ts +22 -0
- package/dist/server/http/probes.js +27 -0
- package/dist/server/http/rateLimit.d.ts +131 -0
- package/dist/server/http/rateLimit.js +351 -0
- package/dist/server/http/readRoutes.d.ts +9 -0
- package/dist/server/http/readRoutes.js +131 -0
- package/dist/server/http/readRouting.d.ts +20 -0
- package/dist/server/http/readRouting.js +80 -0
- package/dist/server/http/recordCompose.d.ts +67 -0
- package/dist/server/http/recordCompose.js +167 -0
- package/dist/server/http/recordWrites.d.ts +89 -0
- package/dist/server/http/recordWrites.js +298 -0
- package/dist/server/http/refusalReport.d.ts +38 -0
- package/dist/server/http/refusalReport.js +63 -0
- package/dist/server/http/reply.d.ts +130 -0
- package/dist/server/http/reply.js +394 -0
- package/dist/server/http/requestOrigin.d.ts +11 -0
- package/dist/server/http/requestOrigin.js +8 -0
- package/dist/server/http/router.d.ts +45 -0
- package/dist/server/http/router.js +22 -0
- package/dist/server/http/serverCore.d.ts +68 -0
- package/dist/server/http/serverCore.js +177 -0
- package/dist/server/http/traceRequest.d.ts +30 -0
- package/dist/server/http/traceRequest.js +224 -0
- package/dist/server/http/trust.d.ts +261 -0
- package/dist/server/http/trust.js +472 -0
- package/dist/server/http/writeRefusal.d.ts +33 -0
- package/dist/server/http/writeRefusal.js +24 -0
- package/dist/server/httpConnection.d.ts +49 -0
- package/dist/server/httpConnection.js +170 -0
- package/dist/server/impact.d.ts +55 -0
- package/dist/server/impact.js +47 -0
- package/dist/server/journal.d.ts +134 -0
- package/dist/server/journal.js +398 -0
- package/dist/server/keysetReadHttp.d.ts +52 -0
- package/dist/server/keysetReadHttp.js +85 -0
- package/dist/server/layouts.d.ts +49 -0
- package/dist/server/layouts.js +192 -0
- package/dist/server/migrate/cli.d.ts +55 -0
- package/dist/server/migrate/cli.js +517 -0
- package/dist/server/migrate/database.d.ts +37 -0
- package/dist/server/migrate/database.js +247 -0
- package/dist/server/migrate/desired.d.ts +76 -0
- package/dist/server/migrate/desired.js +292 -0
- package/dist/server/migrate/files.d.ts +34 -0
- package/dist/server/migrate/files.js +141 -0
- package/dist/server/migrate/flyway.d.ts +7 -0
- package/dist/server/migrate/flyway.js +69 -0
- package/dist/server/migrate/history.d.ts +70 -0
- package/dist/server/migrate/history.js +211 -0
- package/dist/server/migrate/runner.d.ts +100 -0
- package/dist/server/migrate/runner.js +409 -0
- package/dist/server/migrate/snapshot.d.ts +30 -0
- package/dist/server/migrate/snapshot.js +239 -0
- package/dist/server/migrate/target.d.ts +33 -0
- package/dist/server/migrate/target.js +82 -0
- package/dist/server/openapiDraft.d.ts +25 -0
- package/dist/server/openapiDraft.js +171 -0
- package/dist/server/operations/diagnostics.d.ts +101 -0
- package/dist/server/operations/diagnostics.js +284 -0
- package/dist/server/operations/requestMetrics.d.ts +33 -0
- package/dist/server/operations/requestMetrics.js +94 -0
- package/dist/server/packageVersion.d.ts +1 -0
- package/dist/server/packageVersion.js +11 -0
- package/dist/server/poolConfig.d.ts +34 -0
- package/dist/server/poolConfig.js +114 -0
- package/dist/server/product.d.ts +20 -0
- package/dist/server/product.js +12 -0
- package/dist/server/recordHistoryOperations.d.ts +39 -0
- package/dist/server/recordHistoryOperations.js +43 -0
- package/dist/server/recordWriteOperations.d.ts +111 -0
- package/dist/server/recordWriteOperations.js +329 -0
- package/dist/server/resourceReadHttp.d.ts +81 -0
- package/dist/server/resourceReadHttp.js +606 -0
- package/dist/server/resourceReadOperations.d.ts +147 -0
- package/dist/server/resourceReadOperations.js +452 -0
- package/dist/server/scaffoldMachine.d.ts +54 -0
- package/dist/server/scaffoldMachine.js +184 -0
- package/dist/server/seed/cli.d.ts +20 -0
- package/dist/server/seed/cli.js +164 -0
- package/dist/server/seed/lexicon.d.ts +26 -0
- package/dist/server/seed/lexicon.js +585 -0
- package/dist/server/seed/seed.d.ts +70 -0
- package/dist/server/seed/seed.js +779 -0
- package/dist/server/seed/words.d.ts +21 -0
- package/dist/server/seed/words.js +164 -0
- package/dist/server/serverRequests.d.ts +6 -0
- package/dist/server/serverRequests.js +33 -0
- package/dist/server/serverTimeouts.d.ts +33 -0
- package/dist/server/serverTimeouts.js +32 -0
- package/dist/server/shapeonly.d.ts +32 -0
- package/dist/server/shapeonly.js +110 -0
- package/dist/server/startupWarnings.d.ts +32 -0
- package/dist/server/startupWarnings.js +92 -0
- package/dist/shared/addressParams.d.ts +28 -0
- package/dist/shared/addressParams.js +47 -0
- package/dist/shared/appCards.d.ts +123 -0
- package/dist/shared/appCards.js +385 -0
- package/dist/shared/appComponents.d.ts +177 -0
- package/dist/shared/appComponents.js +422 -0
- package/dist/shared/appDocuments.d.ts +43 -0
- package/dist/shared/appDocuments.js +131 -0
- package/dist/shared/appEmbeds.d.ts +21 -0
- package/dist/shared/appEmbeds.js +24 -0
- package/dist/shared/appIcons.d.ts +28 -0
- package/dist/shared/appIcons.js +223 -0
- package/dist/shared/appLinks.d.ts +17 -0
- package/dist/shared/appLinks.js +124 -0
- package/dist/shared/appListColumns.d.ts +3 -0
- package/dist/shared/appListColumns.js +66 -0
- package/dist/shared/appLocale.d.ts +36 -0
- package/dist/shared/appLocale.js +86 -0
- package/dist/shared/appMessages.d.ts +44 -0
- package/dist/shared/appMessages.js +78 -0
- package/dist/shared/appNoun.d.ts +21 -0
- package/dist/shared/appNoun.js +32 -0
- package/dist/shared/autoBucket.d.ts +98 -0
- package/dist/shared/autoBucket.js +305 -0
- package/dist/shared/autoValues.d.ts +25 -0
- package/dist/shared/autoValues.js +25 -0
- package/dist/shared/breakdown.d.ts +228 -0
- package/dist/shared/breakdown.js +557 -0
- package/dist/shared/breakdowntext.d.ts +41 -0
- package/dist/shared/breakdowntext.js +400 -0
- package/dist/shared/builtInThemes.d.ts +2 -0
- package/dist/shared/builtInThemes.js +771 -0
- package/dist/shared/chartSeparation.d.ts +11 -0
- package/dist/shared/chartSeparation.js +58 -0
- package/dist/shared/clauses.d.ts +22 -0
- package/dist/shared/clauses.js +97 -0
- package/dist/shared/columnCaption.d.ts +16 -0
- package/dist/shared/columnCaption.js +90 -0
- package/dist/shared/commandFieldPath.d.ts +2 -0
- package/dist/shared/commandFieldPath.js +7 -0
- package/dist/shared/commandWire.d.ts +26 -0
- package/dist/shared/commandWire.js +41 -0
- package/dist/shared/computed.d.ts +161 -0
- package/dist/shared/computed.js +378 -0
- package/dist/shared/computedParse.d.ts +13 -0
- package/dist/shared/computedParse.js +278 -0
- package/dist/shared/computedValue.d.ts +47 -0
- package/dist/shared/computedValue.js +191 -0
- package/dist/shared/connection.d.ts +30 -0
- package/dist/shared/connection.js +1 -0
- package/dist/shared/csv.d.ts +20 -0
- package/dist/shared/csv.js +63 -0
- package/dist/shared/dashLayout.d.ts +30 -0
- package/dist/shared/dashLayout.js +132 -0
- package/dist/shared/dashboardAsks.d.ts +93 -0
- package/dist/shared/dashboardAsks.js +129 -0
- package/dist/shared/dashboardTrend.d.ts +20 -0
- package/dist/shared/dashboardTrend.js +50 -0
- package/dist/shared/declaredReferences.d.ts +50 -0
- package/dist/shared/declaredReferences.js +202 -0
- package/dist/shared/definedFields.d.ts +63 -0
- package/dist/shared/definedFields.js +103 -0
- package/dist/shared/definedValues.d.ts +63 -0
- package/dist/shared/definedValues.js +184 -0
- package/dist/shared/displayDefaults.d.ts +135 -0
- package/dist/shared/displayDefaults.js +529 -0
- package/dist/shared/dueDate.d.ts +6 -0
- package/dist/shared/dueDate.js +6 -0
- package/dist/shared/duration.d.ts +4 -0
- package/dist/shared/duration.js +23 -0
- package/dist/shared/fileBounds.d.ts +9 -0
- package/dist/shared/fileBounds.js +9 -0
- package/dist/shared/filter.d.ts +217 -0
- package/dist/shared/filter.js +305 -0
- package/dist/shared/firstPaint.d.ts +24 -0
- package/dist/shared/firstPaint.js +33 -0
- package/dist/shared/form.d.ts +21 -0
- package/dist/shared/form.js +25 -0
- package/dist/shared/formValues.d.ts +104 -0
- package/dist/shared/formValues.js +352 -0
- package/dist/shared/funnel.d.ts +45 -0
- package/dist/shared/funnel.js +108 -0
- package/dist/shared/httpOperations.d.ts +48 -0
- package/dist/shared/httpOperations.js +9 -0
- package/dist/shared/iconGlyphs.d.ts +4 -0
- package/dist/shared/iconGlyphs.js +151 -0
- package/dist/shared/iconWeights.d.ts +3 -0
- package/dist/shared/iconWeights.js +162 -0
- package/dist/shared/imageWidths.d.ts +32 -0
- package/dist/shared/imageWidths.js +38 -0
- package/dist/shared/keysetPage.d.ts +64 -0
- package/dist/shared/keysetPage.js +161 -0
- package/dist/shared/like.d.ts +20 -0
- package/dist/shared/like.js +29 -0
- package/dist/shared/listEmpty.d.ts +12 -0
- package/dist/shared/listEmpty.js +36 -0
- package/dist/shared/listFilters.d.ts +28 -0
- package/dist/shared/listFilters.js +84 -0
- package/dist/shared/listPresentations.d.ts +199 -0
- package/dist/shared/listPresentations.js +7 -0
- package/dist/shared/listQuestion.d.ts +52 -0
- package/dist/shared/listQuestion.js +137 -0
- package/dist/shared/lookPalettes.d.ts +62 -0
- package/dist/shared/lookPalettes.js +306 -0
- package/dist/shared/maskQuoted.d.ts +24 -0
- package/dist/shared/maskQuoted.js +48 -0
- package/dist/shared/mentionLabel.d.ts +19 -0
- package/dist/shared/mentionLabel.js +38 -0
- package/dist/shared/mentionLookup.d.ts +17 -0
- package/dist/shared/mentionLookup.js +64 -0
- package/dist/shared/menuCounts.d.ts +16 -0
- package/dist/shared/menuCounts.js +74 -0
- package/dist/shared/model.d.ts +79 -0
- package/dist/shared/model.js +153 -0
- package/dist/shared/money.d.ts +44 -0
- package/dist/shared/money.js +81 -0
- package/dist/shared/moneyEntry.d.ts +7 -0
- package/dist/shared/moneyEntry.js +27 -0
- package/dist/shared/mount.d.ts +118 -0
- package/dist/shared/mount.js +248 -0
- package/dist/shared/niceTicks.d.ts +26 -0
- package/dist/shared/niceTicks.js +50 -0
- package/dist/shared/order.d.ts +59 -0
- package/dist/shared/order.js +133 -0
- package/dist/shared/page.d.ts +135 -0
- package/dist/shared/page.js +1187 -0
- package/dist/shared/pageAnatomy.d.ts +99 -0
- package/dist/shared/pageAnatomy.js +370 -0
- package/dist/shared/pageConfig.d.ts +25 -0
- package/dist/shared/pageConfig.js +1308 -0
- package/dist/shared/pageEmptyActions.d.ts +12 -0
- package/dist/shared/pageEmptyActions.js +20 -0
- package/dist/shared/pageLayouts.d.ts +72 -0
- package/dist/shared/pageLayouts.js +205 -0
- package/dist/shared/pageModel.d.ts +785 -0
- package/dist/shared/pageModel.js +121 -0
- package/dist/shared/pagePaths.d.ts +180 -0
- package/dist/shared/pagePaths.js +869 -0
- package/dist/shared/pagePlans.d.ts +52 -0
- package/dist/shared/pagePlans.js +108 -0
- package/dist/shared/pageRoutes.d.ts +9 -0
- package/dist/shared/pageRoutes.js +9 -0
- package/dist/shared/query.d.ts +166 -0
- package/dist/shared/query.js +1302 -0
- package/dist/shared/queryDates.d.ts +12 -0
- package/dist/shared/queryDates.js +101 -0
- package/dist/shared/queryOperands.d.ts +99 -0
- package/dist/shared/queryOperands.js +131 -0
- package/dist/shared/reads.d.ts +103 -0
- package/dist/shared/reads.js +154 -0
- package/dist/shared/recordLabel.d.ts +51 -0
- package/dist/shared/recordLabel.js +123 -0
- package/dist/shared/recordReadKeys.d.ts +30 -0
- package/dist/shared/recordReadKeys.js +51 -0
- package/dist/shared/recordReads.d.ts +268 -0
- package/dist/shared/recordReads.js +368 -0
- package/dist/shared/recordview.d.ts +198 -0
- package/dist/shared/recordview.js +356 -0
- package/dist/shared/referenceModel.d.ts +58 -0
- package/dist/shared/referenceModel.js +194 -0
- package/dist/shared/refusal.d.ts +64 -0
- package/dist/shared/refusal.js +144 -0
- package/dist/shared/relatedCreate.d.ts +30 -0
- package/dist/shared/relatedCreate.js +162 -0
- package/dist/shared/resourceHttp.d.ts +464 -0
- package/dist/shared/resourceHttp.js +1 -0
- package/dist/shared/richText.d.ts +85 -0
- package/dist/shared/richText.js +305 -0
- package/dist/shared/rollups.d.ts +143 -0
- package/dist/shared/rollups.js +64 -0
- package/dist/shared/rowScope.d.ts +72 -0
- package/dist/shared/rowScope.js +376 -0
- package/dist/shared/runtimeTables.d.ts +44 -0
- package/dist/shared/runtimeTables.js +79 -0
- package/dist/shared/schema.d.ts +523 -0
- package/dist/shared/schema.js +627 -0
- package/dist/shared/schematext.d.ts +38 -0
- package/dist/shared/schematext.js +101 -0
- package/dist/shared/scopeCatalog.d.ts +29 -0
- package/dist/shared/scopeCatalog.js +468 -0
- package/dist/shared/servedApp.d.ts +681 -0
- package/dist/shared/servedApp.js +45 -0
- package/dist/shared/sessionLease.d.ts +34 -0
- package/dist/shared/sessionLease.js +3 -0
- package/dist/shared/shape.d.ts +55 -0
- package/dist/shared/shape.js +168 -0
- package/dist/shared/slug.d.ts +1 -0
- package/dist/shared/slug.js +12 -0
- package/dist/shared/sortText.d.ts +14 -0
- package/dist/shared/sortText.js +26 -0
- package/dist/shared/sqlRelation.d.ts +4 -0
- package/dist/shared/sqlRelation.js +8 -0
- package/dist/shared/sqlsaved.d.ts +44 -0
- package/dist/shared/sqlsaved.js +63 -0
- package/dist/shared/stitchedPaths.d.ts +27 -0
- package/dist/shared/stitchedPaths.js +38 -0
- package/dist/shared/structuredFilter.d.ts +22 -0
- package/dist/shared/structuredFilter.js +1 -0
- package/dist/shared/subtitlePath.d.ts +20 -0
- package/dist/shared/subtitlePath.js +24 -0
- package/dist/shared/suggest.d.ts +18 -0
- package/dist/shared/suggest.js +59 -0
- package/dist/shared/tableSizing.d.ts +4 -0
- package/dist/shared/tableSizing.js +9 -0
- package/dist/shared/tagLists.d.ts +57 -0
- package/dist/shared/tagLists.js +34 -0
- package/dist/shared/textRules.d.ts +54 -0
- package/dist/shared/textRules.js +133 -0
- package/dist/shared/theme.d.ts +94 -0
- package/dist/shared/theme.js +800 -0
- package/dist/shared/themeColor.d.ts +34 -0
- package/dist/shared/themeColor.js +109 -0
- package/dist/shared/themeFaces.d.ts +30 -0
- package/dist/shared/themeFaces.js +42 -0
- package/dist/shared/themeInk.d.ts +20 -0
- package/dist/shared/themeInk.js +52 -0
- package/dist/shared/themeLooks.d.ts +9 -0
- package/dist/shared/themeLooks.js +572 -0
- package/dist/shared/themeParts.d.ts +26 -0
- package/dist/shared/themeParts.js +71 -0
- package/dist/shared/themePartsCheck.d.ts +21 -0
- package/dist/shared/themePartsCheck.js +91 -0
- package/dist/shared/themePresets.d.ts +85 -0
- package/dist/shared/themePresets.js +139 -0
- package/dist/shared/themeRecipeWords.d.ts +156 -0
- package/dist/shared/themeRecipeWords.js +156 -0
- package/dist/shared/themeRecipes.d.ts +213 -0
- package/dist/shared/themeRecipes.js +234 -0
- package/dist/shared/themeResolve.d.ts +55 -0
- package/dist/shared/themeResolve.js +52 -0
- package/dist/shared/themeTokens.d.ts +107 -0
- package/dist/shared/themeTokens.js +116 -0
- package/dist/shared/themeType.d.ts +38 -0
- package/dist/shared/themeType.js +205 -0
- package/dist/shared/unitWord.d.ts +4 -0
- package/dist/shared/unitWord.js +37 -0
- package/dist/shared/view.d.ts +195 -0
- package/dist/shared/view.js +987 -0
- package/dist/shared/viewLabels.d.ts +47 -0
- package/dist/shared/viewLabels.js +459 -0
- package/dist/shared/viewPaths.d.ts +248 -0
- package/dist/shared/viewPaths.js +294 -0
- package/dist/shared/viewtext.d.ts +57 -0
- package/dist/shared/viewtext.js +282 -0
- package/dist/shared/vocabulary.d.ts +71 -0
- package/dist/shared/vocabulary.js +249 -0
- package/dist/shared/weekStart.d.ts +7 -0
- package/dist/shared/weekStart.js +36 -0
- package/mark.svg +1 -0
- package/package.json +261 -4
- package/schema/model.d.ts +298 -0
- package/schema/theme.d.ts +587 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An expression's value, worked out in JavaScript (computed.ts parses it and
|
|
3
|
+
* writes its SQL). A module of its own so the evaluator loads only with what
|
|
4
|
+
* uses it — a form saying its live values (formLines.ts), a fixed action's
|
|
5
|
+
* stamp on the server (appStamps.ts) — and never with a page's first paint.
|
|
6
|
+
*/
|
|
7
|
+
import { type ComputedNode, type ComputedValue } from './computed.js';
|
|
8
|
+
/**
|
|
9
|
+
* An expression's value, worked out in JavaScript with the statement's
|
|
10
|
+
* semantics (compileComputed), so the browser and the server say one thing:
|
|
11
|
+
* where a fixed action's `set` writes a constant (appStamps on the server),
|
|
12
|
+
* and where a form says its live values as someone types (formLines.ts).
|
|
13
|
+
* `read` supplies each path's value, typed — a number, a yes-or-no, text, a
|
|
14
|
+
* day — or null for none; an expression that reads no column needs none.
|
|
15
|
+
*
|
|
16
|
+
* As SQL does: anything with no value in it has none (`price * qty` with no
|
|
17
|
+
* price), a number over zero has none, a comparison with nothing is unknown,
|
|
18
|
+
* and `and`, `or` and `not` keep unknown as SQL's three-valued logic does. A
|
|
19
|
+
* yes-or-no that comes out unknown is no, as a computed flag is (the CASE in
|
|
20
|
+
* compileComputed): a task with no due date is not overdue. Dates move as the
|
|
21
|
+
* statement moves them: days and weeks by count, months and years by the
|
|
22
|
+
* calendar, a day past a month's end landing on its last, an instant by hours
|
|
23
|
+
* and minutes.
|
|
24
|
+
*/
|
|
25
|
+
export declare function evaluateComputed(node: ComputedNode, values: {
|
|
26
|
+
today: string;
|
|
27
|
+
now: Date;
|
|
28
|
+
me: string | null;
|
|
29
|
+
}, read?: (path: string) => ComputedValue): ComputedValue;
|
|
30
|
+
/**
|
|
31
|
+
* A constant expression's value, worked out where a fixed action's `set`
|
|
32
|
+
* writes it (appStamps on the server): `today + 14 days`, `now + 1 week`,
|
|
33
|
+
* `3 * 7`. It reads no column, which loading the App made sure of; the
|
|
34
|
+
* constants are this request's — the App's day, the instant, the
|
|
35
|
+
* signed-in person.
|
|
36
|
+
*/
|
|
37
|
+
export declare function evaluateConstant(node: ComputedNode, values: {
|
|
38
|
+
today: string;
|
|
39
|
+
now: Date;
|
|
40
|
+
me: string | null;
|
|
41
|
+
}): ComputedValue;
|
|
42
|
+
/**
|
|
43
|
+
* Two values compared as the statement compares them (`qty < reorder_at`, `paid < owed`): a number with a number,
|
|
44
|
+
* a day with a day or an instant; a comparison with nothing is no. Where a guard reads both sides in one transaction
|
|
45
|
+
* rather than writing the comparison into a single-table read, which never compares two columns (filter.ts).
|
|
46
|
+
*/
|
|
47
|
+
export declare function compares(op: string, left: ComputedValue, right: ComputedValue): boolean;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An expression's value, worked out in JavaScript (computed.ts parses it and
|
|
3
|
+
* writes its SQL). A module of its own so the evaluator loads only with what
|
|
4
|
+
* uses it — a form saying its live values (formLines.ts), a fixed action's
|
|
5
|
+
* stamp on the server (appStamps.ts) — and never with a page's first paint.
|
|
6
|
+
*/
|
|
7
|
+
import { ComputedError } from './computed.js';
|
|
8
|
+
const DAY_MS = 86_400_000;
|
|
9
|
+
const dayOf = (date) => date.toISOString().slice(0, 10);
|
|
10
|
+
const COMPARISONS = new Set(['=', '!=', '<', '<=', '>', '>=']);
|
|
11
|
+
/* A figure to `places`, a half away from zero, as the engines round a numeric: moved by its places and said to 15
|
|
12
|
+
digits first (as PostgreSQL casts a double to a numeric, and computed.ts has SQLite do), so 1.005 is 1.01 as it is
|
|
13
|
+
written rather than 1.00 as the double nearest it would say. */
|
|
14
|
+
function roundAway(figure, places) {
|
|
15
|
+
const scale = 10 ** places;
|
|
16
|
+
const moved = Number((Math.abs(figure) * scale).toPrecision(15));
|
|
17
|
+
const rounded = Math.round(moved) / scale;
|
|
18
|
+
return rounded === 0 ? 0 : Math.sign(figure) * rounded;
|
|
19
|
+
}
|
|
20
|
+
/** Whether an expression is a yes-or-no at its top: a comparison, `and`, `or`, `not`, `is empty`, or `true`/`false`. */
|
|
21
|
+
const isCondition = (node) => node.k === 'not' ||
|
|
22
|
+
node.k === 'empty' ||
|
|
23
|
+
node.k === 'bool' ||
|
|
24
|
+
(node.k === 'op' && (node.op === 'and' || node.op === 'or' || COMPARISONS.has(node.op)));
|
|
25
|
+
/**
|
|
26
|
+
* An expression's value, worked out in JavaScript with the statement's
|
|
27
|
+
* semantics (compileComputed), so the browser and the server say one thing:
|
|
28
|
+
* where a fixed action's `set` writes a constant (appStamps on the server),
|
|
29
|
+
* and where a form says its live values as someone types (formLines.ts).
|
|
30
|
+
* `read` supplies each path's value, typed — a number, a yes-or-no, text, a
|
|
31
|
+
* day — or null for none; an expression that reads no column needs none.
|
|
32
|
+
*
|
|
33
|
+
* As SQL does: anything with no value in it has none (`price * qty` with no
|
|
34
|
+
* price), a number over zero has none, a comparison with nothing is unknown,
|
|
35
|
+
* and `and`, `or` and `not` keep unknown as SQL's three-valued logic does. A
|
|
36
|
+
* yes-or-no that comes out unknown is no, as a computed flag is (the CASE in
|
|
37
|
+
* compileComputed): a task with no due date is not overdue. Dates move as the
|
|
38
|
+
* statement moves them: days and weeks by count, months and years by the
|
|
39
|
+
* calendar, a day past a month's end landing on its last, an instant by hours
|
|
40
|
+
* and minutes.
|
|
41
|
+
*/
|
|
42
|
+
export function evaluateComputed(node, values, read = (path) => {
|
|
43
|
+
throw new ComputedError(`"${path}" is a column, and this expression reads none.`, 0);
|
|
44
|
+
}) {
|
|
45
|
+
const span = (n) => ({ count: Number(value(n.of)), unit: n.unit });
|
|
46
|
+
const move = (at, by, sign) => {
|
|
47
|
+
const base = 'day' in at ? new Date(`${at.day}T00:00:00Z`) : new Date(at.instant);
|
|
48
|
+
const count = by.count * sign;
|
|
49
|
+
if (by.unit === 'hour' || by.unit === 'minute')
|
|
50
|
+
return { instant: new Date(base.getTime() + count * (by.unit === 'hour' ? 3_600_000 : 60_000)) };
|
|
51
|
+
if (by.unit === 'day' || by.unit === 'week')
|
|
52
|
+
base.setTime(base.getTime() + count * (by.unit === 'week' ? 7 : 1) * DAY_MS);
|
|
53
|
+
else {
|
|
54
|
+
const months = by.unit === 'year' ? count * 12 : count, day = base.getUTCDate();
|
|
55
|
+
base.setUTCDate(1);
|
|
56
|
+
base.setUTCMonth(base.getUTCMonth() + months);
|
|
57
|
+
const last = new Date(Date.UTC(base.getUTCFullYear(), base.getUTCMonth() + 1, 0)).getUTCDate();
|
|
58
|
+
base.setUTCDate(Math.min(day, last));
|
|
59
|
+
}
|
|
60
|
+
return 'day' in at ? { day: dayOf(base) } : { instant: base };
|
|
61
|
+
};
|
|
62
|
+
const isDate = (v) => typeof v === 'object' && v !== null;
|
|
63
|
+
const ms = (v) => ('day' in v ? Date.parse(`${v.day}T00:00:00Z`) : v.instant.getTime());
|
|
64
|
+
const comparable = (v) => (isDate(v) ? ms(v) : v);
|
|
65
|
+
/* SQL's truth: yes, no, or unknown (null). */
|
|
66
|
+
const truth = (v) => (v === null ? null : Boolean(v));
|
|
67
|
+
const value = (n) => {
|
|
68
|
+
switch (n.k) {
|
|
69
|
+
case 'number':
|
|
70
|
+
return n.value;
|
|
71
|
+
case 'text':
|
|
72
|
+
return n.value;
|
|
73
|
+
case 'bool':
|
|
74
|
+
return n.value;
|
|
75
|
+
case 'today':
|
|
76
|
+
return { day: values.today };
|
|
77
|
+
case 'date':
|
|
78
|
+
return { day: n.value };
|
|
79
|
+
case 'now':
|
|
80
|
+
return { instant: values.now };
|
|
81
|
+
case 'instant':
|
|
82
|
+
return { instant: new Date(n.value) };
|
|
83
|
+
case 'me':
|
|
84
|
+
return values.me;
|
|
85
|
+
case 'nobody':
|
|
86
|
+
return null;
|
|
87
|
+
case 'not': {
|
|
88
|
+
const v = truth(value(n.of));
|
|
89
|
+
return v === null ? null : !v;
|
|
90
|
+
}
|
|
91
|
+
case 'neg': {
|
|
92
|
+
const v = value(n.of);
|
|
93
|
+
return v === null ? null : -Number(v);
|
|
94
|
+
}
|
|
95
|
+
case 'empty': {
|
|
96
|
+
const v = value(n.of);
|
|
97
|
+
return (v === null || v === '') !== n.negate;
|
|
98
|
+
}
|
|
99
|
+
case 'span':
|
|
100
|
+
return Number(value(n.of));
|
|
101
|
+
case 'call': {
|
|
102
|
+
const args = n.args.map(value);
|
|
103
|
+
if (n.fn === 'coalesce')
|
|
104
|
+
return args.find((each) => each !== null) ?? null;
|
|
105
|
+
if (args.some((each) => each === null))
|
|
106
|
+
return null;
|
|
107
|
+
if (n.fn === 'abs')
|
|
108
|
+
return Math.abs(Number(args[0]));
|
|
109
|
+
if (n.fn === 'round')
|
|
110
|
+
return roundAway(Number(args[0]), args[1] === undefined ? 0 : Number(args[1]));
|
|
111
|
+
let kept = args[0];
|
|
112
|
+
for (const each of args.slice(1)) {
|
|
113
|
+
const [a, b] = [comparable(each), comparable(kept)];
|
|
114
|
+
if (n.fn === 'min' ? a < b : a > b)
|
|
115
|
+
kept = each;
|
|
116
|
+
}
|
|
117
|
+
return kept;
|
|
118
|
+
}
|
|
119
|
+
case 'path': {
|
|
120
|
+
const v = read(n.path);
|
|
121
|
+
return v === undefined || v === '' ? null : v;
|
|
122
|
+
}
|
|
123
|
+
case 'op': {
|
|
124
|
+
if (n.op === 'and' || n.op === 'or') {
|
|
125
|
+
const l = truth(value(n.left)), r = truth(value(n.right));
|
|
126
|
+
if (n.op === 'and')
|
|
127
|
+
return l === false || r === false ? false : l === null || r === null ? null : true;
|
|
128
|
+
return l === true || r === true ? true : l === null || r === null ? null : false;
|
|
129
|
+
}
|
|
130
|
+
const l = value(n.left), r = value(n.right);
|
|
131
|
+
if (COMPARISONS.has(n.op)) {
|
|
132
|
+
if (l === null || r === null)
|
|
133
|
+
return null;
|
|
134
|
+
const a = comparable(l), b = comparable(r);
|
|
135
|
+
switch (n.op) {
|
|
136
|
+
case '=':
|
|
137
|
+
return a === b;
|
|
138
|
+
case '!=':
|
|
139
|
+
return a !== b;
|
|
140
|
+
case '<':
|
|
141
|
+
return a < b;
|
|
142
|
+
case '<=':
|
|
143
|
+
return a <= b;
|
|
144
|
+
case '>':
|
|
145
|
+
return a > b;
|
|
146
|
+
default:
|
|
147
|
+
return a >= b;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (l === null || r === null)
|
|
151
|
+
return null;
|
|
152
|
+
if (n.op === '+' || n.op === '-') {
|
|
153
|
+
const sign = n.op === '+' ? 1 : -1;
|
|
154
|
+
if (isDate(l) && isDate(r) && n.op === '-')
|
|
155
|
+
return Math.round((ms(l) - ms(r)) / DAY_MS);
|
|
156
|
+
if (isDate(l) && !isDate(r))
|
|
157
|
+
return move(l, n.right.k === 'span' ? span(n.right) : { count: Number(r), unit: 'day' }, sign);
|
|
158
|
+
if (isDate(r) && !isDate(l) && n.op === '+')
|
|
159
|
+
return move(r, n.left.k === 'span' ? span(n.left) : { count: Number(l), unit: 'day' }, 1);
|
|
160
|
+
return Number(l) + sign * Number(r);
|
|
161
|
+
}
|
|
162
|
+
if (n.op === '*')
|
|
163
|
+
return Number(l) * Number(r);
|
|
164
|
+
return Number(r) === 0 ? null : Number(l) / Number(r);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const result = value(node);
|
|
169
|
+
return result === null && isCondition(node) ? false : result;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* A constant expression's value, worked out where a fixed action's `set`
|
|
173
|
+
* writes it (appStamps on the server): `today + 14 days`, `now + 1 week`,
|
|
174
|
+
* `3 * 7`. It reads no column, which loading the App made sure of; the
|
|
175
|
+
* constants are this request's — the App's day, the instant, the
|
|
176
|
+
* signed-in person.
|
|
177
|
+
*/
|
|
178
|
+
export function evaluateConstant(node, values) {
|
|
179
|
+
return evaluateComputed(node, values);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Two values compared as the statement compares them (`qty < reorder_at`, `paid < owed`): a number with a number,
|
|
183
|
+
* a day with a day or an instant; a comparison with nothing is no. Where a guard reads both sides in one transaction
|
|
184
|
+
* rather than writing the comparison into a single-table read, which never compares two columns (filter.ts).
|
|
185
|
+
*/
|
|
186
|
+
export function compares(op, left, right) {
|
|
187
|
+
if (!COMPARISONS.has(op))
|
|
188
|
+
return false;
|
|
189
|
+
const node = { k: 'op', op, left: { k: 'path', path: 'l' }, right: { k: 'path', path: 'r' } };
|
|
190
|
+
return evaluateComputed(node, { today: '', now: new Date(0), me: null }, (path) => (path === 'l' ? left : right)) === true;
|
|
191
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Public metadata only. Connection URLs and credentials remain server-side. */
|
|
2
|
+
export type SecretSource = 'none' | 'inline' | 'environment' | 'keychain' | 'file';
|
|
3
|
+
/** Routing and write capability, without database administration metadata. */
|
|
4
|
+
export interface AppSource {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
writable: boolean;
|
|
8
|
+
rows?: boolean;
|
|
9
|
+
/** Some columns are never served over it (`"hidden"`), so it runs no raw SQL. */
|
|
10
|
+
hidesColumns?: true;
|
|
11
|
+
}
|
|
12
|
+
export type RuntimeMetadata = {
|
|
13
|
+
appConfigured: false;
|
|
14
|
+
} | {
|
|
15
|
+
appConfigured: true;
|
|
16
|
+
active: string | null;
|
|
17
|
+
apps: AppSource[];
|
|
18
|
+
};
|
|
19
|
+
export interface PublicConnection extends AppSource {
|
|
20
|
+
dialect: string;
|
|
21
|
+
/** Host and database, or a file name. Never a password. */
|
|
22
|
+
detail: string;
|
|
23
|
+
source: 'argument' | 'config' | 'session';
|
|
24
|
+
connected: boolean;
|
|
25
|
+
tables?: number;
|
|
26
|
+
error?: string;
|
|
27
|
+
secret?: SecretSource;
|
|
28
|
+
warning?: string;
|
|
29
|
+
schemas?: string[];
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const CRLF = "\r\n";
|
|
2
|
+
/**
|
|
3
|
+
* One CSV field.
|
|
4
|
+
*
|
|
5
|
+
* null and undefined emit nothing at all, while an empty string emits `""`.
|
|
6
|
+
* That asymmetry is the whole point: `a,,b` and `a,"",b` are different
|
|
7
|
+
* documents, and collapsing them means an export cannot tell you whether a
|
|
8
|
+
* column was never set or set to blank — often the exact question the export
|
|
9
|
+
* was taken to answer.
|
|
10
|
+
*/
|
|
11
|
+
export declare function csvField(value: unknown): string;
|
|
12
|
+
/** One CSV record: the fields of `row` in `columns` order, without its line break. */
|
|
13
|
+
export declare function csvRecord(columns: readonly string[], row: Record<string, unknown> | undefined): string;
|
|
14
|
+
/**
|
|
15
|
+
* One record as an export's JSON writes it: rebuilt from `columns` rather
|
|
16
|
+
* than emitted as-is so the shape matches the CSV exactly — including a key
|
|
17
|
+
* whose value is missing, which `JSON.stringify` would silently drop and
|
|
18
|
+
* leave the two formats disagreeing about the row.
|
|
19
|
+
*/
|
|
20
|
+
export declare function jsonRecord(columns: readonly string[], row: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* One CSV field and one JSON record, as an export writes them — shared, so
|
|
3
|
+
* the file the browser writes from rows in hand and the file the server
|
|
4
|
+
* streams (exportRoute.ts) are the same file, byte for byte.
|
|
5
|
+
*/
|
|
6
|
+
/* RFC 4180 §2.6: a field containing a comma, a quote or a line break must be
|
|
7
|
+
quoted. CR and LF are listed separately because a lone CR inside a value is
|
|
8
|
+
just as capable of splitting a record as a full CRLF. */
|
|
9
|
+
const NEEDS_QUOTES = /[",\r\n]/;
|
|
10
|
+
/* Excel, Sheets and LibreOffice all treat a cell beginning with one of these
|
|
11
|
+
as a formula to evaluate rather than text to show — so a value like
|
|
12
|
+
`=HYPERLINK(...)` or `@SUM(A1)` out of a database column becomes code the
|
|
13
|
+
moment someone opens the file. Prefixing a single quote is the standard
|
|
14
|
+
mitigation: spreadsheets show the rest as literal text.
|
|
15
|
+
Tab and CR are included because they are skipped before the parse, which
|
|
16
|
+
makes `\t=cmd` a formula too. */
|
|
17
|
+
const FORMULA_LEAD = /^[=+\-@\t\r]/;
|
|
18
|
+
/* ...but `-5` and `+1.5e3` are numbers, not formulas, and prefixing them
|
|
19
|
+
would corrupt every negative amount in the export to buy nothing. Only a
|
|
20
|
+
leading sign that is *not* part of a plain number is dangerous. */
|
|
21
|
+
const PLAIN_NUMBER = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
|
|
22
|
+
export const CRLF = '\r\n';
|
|
23
|
+
/**
|
|
24
|
+
* One CSV field.
|
|
25
|
+
*
|
|
26
|
+
* null and undefined emit nothing at all, while an empty string emits `""`.
|
|
27
|
+
* That asymmetry is the whole point: `a,,b` and `a,"",b` are different
|
|
28
|
+
* documents, and collapsing them means an export cannot tell you whether a
|
|
29
|
+
* column was never set or set to blank — often the exact question the export
|
|
30
|
+
* was taken to answer.
|
|
31
|
+
*/
|
|
32
|
+
export function csvField(value) {
|
|
33
|
+
if (value === null || value === undefined)
|
|
34
|
+
return '';
|
|
35
|
+
// A JSON/JSONB column arrives as a parsed object; `String(obj)` would write
|
|
36
|
+
// "[object Object]" into every row of it.
|
|
37
|
+
const text = typeof value === 'object' ? JSON.stringify(value) : String(value);
|
|
38
|
+
const safe = FORMULA_LEAD.test(text) && !PLAIN_NUMBER.test(text) ? `'${text}` : text;
|
|
39
|
+
if (safe === '' || NEEDS_QUOTES.test(safe))
|
|
40
|
+
return `"${safe.replace(/"/g, '""')}"`;
|
|
41
|
+
return safe;
|
|
42
|
+
}
|
|
43
|
+
/* A row's own value for a column, never one it inherits: an export's column
|
|
44
|
+
list is the caller's, and `constructor` or `__proto__` named there would
|
|
45
|
+
otherwise write out Object's own members as if they were data. */
|
|
46
|
+
const own = (row, name) => (row && Object.hasOwn(row, name) ? row[name] : undefined);
|
|
47
|
+
/** One CSV record: the fields of `row` in `columns` order, without its line break. */
|
|
48
|
+
export function csvRecord(columns, row) {
|
|
49
|
+
return columns.map((name) => csvField(own(row, name))).join(',');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* One record as an export's JSON writes it: rebuilt from `columns` rather
|
|
53
|
+
* than emitted as-is so the shape matches the CSV exactly — including a key
|
|
54
|
+
* whose value is missing, which `JSON.stringify` would silently drop and
|
|
55
|
+
* leave the two formats disagreeing about the row.
|
|
56
|
+
*/
|
|
57
|
+
export function jsonRecord(columns, row) {
|
|
58
|
+
/* No prototype, so a column called `__proto__` is a key like any other. */
|
|
59
|
+
const out = Object.create(null);
|
|
60
|
+
for (const name of columns)
|
|
61
|
+
out[name] = own(row, name) ?? null;
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** A template as cells: `grid[row][column]` is an area's name or `.`. */
|
|
2
|
+
export type LayoutGrid = string[][];
|
|
3
|
+
/** Whether a word may name an area. */
|
|
4
|
+
export declare const isAreaName: (word: string) => boolean;
|
|
5
|
+
/** The rows of a template as cells. Ragged rows stay ragged: `layoutProblems` is what says so. */
|
|
6
|
+
export declare function layoutGrid(layout: readonly string[]): LayoutGrid;
|
|
7
|
+
/** The areas a template names, in reading order: row by row, each at its first cell. */
|
|
8
|
+
export declare function layoutAreas(grid: LayoutGrid): string[];
|
|
9
|
+
/** An area's box: where it starts, and how many rows and columns it spans. Absent when the template does not name it. */
|
|
10
|
+
export declare function areaBox(grid: LayoutGrid, name: string): {
|
|
11
|
+
row: number;
|
|
12
|
+
column: number;
|
|
13
|
+
rows: number;
|
|
14
|
+
columns: number;
|
|
15
|
+
} | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Everything wrong with a template, in words, one pass: a template is judged whole so one run names every refusal.
|
|
18
|
+
* `at` is the dashboard, as the other refusals name it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function layoutProblems(layout: unknown, at: string): string[];
|
|
21
|
+
/**
|
|
22
|
+
* The areas a layout leaves for a reader when `hidden` ones have nothing to draw: a hidden area's cells go to its left
|
|
23
|
+
* neighbour in that row (the right one when it is first), and a row left with no area in it is dropped. A neighbour that
|
|
24
|
+
* would stop being a rectangle by it is not given the cells, which stand empty. Pure: a template in, a template out.
|
|
25
|
+
*/
|
|
26
|
+
export declare function reflowLayout(grid: LayoutGrid, hidden: ReadonlySet<string>): LayoutGrid;
|
|
27
|
+
/** The template as the strings a CSS `grid-template-areas` takes: one quoted row each. */
|
|
28
|
+
export declare const gridTemplateAreas: (grid: LayoutGrid) => string;
|
|
29
|
+
/** An area that no section is placed in, or a section placed in none: the nearest name for a slip. */
|
|
30
|
+
export declare function nearestArea(name: string, areas: readonly string[]): string | undefined;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A dashboard's `areas`: sections placed in named areas of a grid of equal columns.
|
|
3
|
+
*
|
|
4
|
+
* One reading on both sides — the parser that refuses a template (appViews.ts), the lint that judges an area's
|
|
5
|
+
* width (designLint.ts) and the client that draws it (components/Dashboard.tsx) — so a template means the same
|
|
6
|
+
* thing wherever it is read. Pure data in, data out.
|
|
7
|
+
*/
|
|
8
|
+
import { nearest } from './suggest.js';
|
|
9
|
+
/** An area's name: a lowercase word that is also a CSS identifier, since the client names the grid area with it. */
|
|
10
|
+
const AREA_NAME = /^[a-z][a-z0-9-]{0,23}$/;
|
|
11
|
+
/** Words CSS reads before an area name: `grid-area: span` or `auto` is not a name. */
|
|
12
|
+
const CSS_WORDS = new Set(['auto', 'span', 'initial', 'inherit', 'unset', 'revert', 'default']);
|
|
13
|
+
const LAYOUT_MAX_ROWS = 8;
|
|
14
|
+
const LAYOUT_MAX_COLUMNS = 4;
|
|
15
|
+
/** The cell that holds no area. */
|
|
16
|
+
const EMPTY_CELL = '.';
|
|
17
|
+
/** Whether a word may name an area. */
|
|
18
|
+
export const isAreaName = (word) => AREA_NAME.test(word) && !CSS_WORDS.has(word);
|
|
19
|
+
/** The rows of a template as cells. Ragged rows stay ragged: `layoutProblems` is what says so. */
|
|
20
|
+
export function layoutGrid(layout) {
|
|
21
|
+
return layout.map((row) => row.trim().split(/\s+/).filter(Boolean));
|
|
22
|
+
}
|
|
23
|
+
/** The areas a template names, in reading order: row by row, each at its first cell. */
|
|
24
|
+
export function layoutAreas(grid) {
|
|
25
|
+
const seen = [];
|
|
26
|
+
for (const row of grid)
|
|
27
|
+
for (const cell of row)
|
|
28
|
+
if (cell !== EMPTY_CELL && !seen.includes(cell))
|
|
29
|
+
seen.push(cell);
|
|
30
|
+
return seen;
|
|
31
|
+
}
|
|
32
|
+
/** The cells an area covers, 0-based, in reading order. */
|
|
33
|
+
function cellsOf(grid, name) {
|
|
34
|
+
const cells = [];
|
|
35
|
+
grid.forEach((row, r) => row.forEach((cell, c) => cell === name && cells.push({ row: r, column: c })));
|
|
36
|
+
return cells;
|
|
37
|
+
}
|
|
38
|
+
/** An area's box: where it starts, and how many rows and columns it spans. Absent when the template does not name it. */
|
|
39
|
+
export function areaBox(grid, name) {
|
|
40
|
+
const cells = cellsOf(grid, name);
|
|
41
|
+
if (!cells.length)
|
|
42
|
+
return undefined;
|
|
43
|
+
const rows = cells.map((cell) => cell.row);
|
|
44
|
+
const columns = cells.map((cell) => cell.column);
|
|
45
|
+
const row = Math.min(...rows);
|
|
46
|
+
const column = Math.min(...columns);
|
|
47
|
+
return { row, column, rows: Math.max(...rows) - row + 1, columns: Math.max(...columns) - column + 1 };
|
|
48
|
+
}
|
|
49
|
+
const place = (cell) => `row ${cell.row + 1} column ${cell.column + 1}`;
|
|
50
|
+
/** "a, b and c". */
|
|
51
|
+
const said = (words) => words.length < 2 ? (words[0] ?? '') : `${words.slice(0, -1).join(', ')} and ${words[words.length - 1]}`;
|
|
52
|
+
/** Whether an area's cells fill their box exactly. */
|
|
53
|
+
function isRectangle(grid, name) {
|
|
54
|
+
const box = areaBox(grid, name);
|
|
55
|
+
return !box || cellsOf(grid, name).length === box.rows * box.columns;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Everything wrong with a template, in words, one pass: a template is judged whole so one run names every refusal.
|
|
59
|
+
* `at` is the dashboard, as the other refusals name it.
|
|
60
|
+
*/
|
|
61
|
+
export function layoutProblems(layout, at) {
|
|
62
|
+
const here = `${at}, "areas"`;
|
|
63
|
+
if (!Array.isArray(layout) || !layout.length || layout.some((row) => typeof row !== 'string')) {
|
|
64
|
+
return [`${here} is not a list of rows, each a string of area names: ['kpis kpis', 'trend side'].`];
|
|
65
|
+
}
|
|
66
|
+
const problems = [];
|
|
67
|
+
if (layout.length > LAYOUT_MAX_ROWS)
|
|
68
|
+
problems.push(`${here} has ${layout.length} rows. At most ${LAYOUT_MAX_ROWS}.`);
|
|
69
|
+
const grid = layoutGrid(layout);
|
|
70
|
+
const widest = Math.max(...grid.map((row) => row.length));
|
|
71
|
+
if (grid.some((row) => !row.length))
|
|
72
|
+
problems.push(`${here} has an empty row. Write . for a cell with nothing in it.`);
|
|
73
|
+
if (widest > LAYOUT_MAX_COLUMNS)
|
|
74
|
+
problems.push(`${here} has ${widest} columns in a row. At most ${LAYOUT_MAX_COLUMNS}: wider than that, a column is too narrow to read.`);
|
|
75
|
+
const counts = new Set(grid.filter((row) => row.length).map((row) => row.length));
|
|
76
|
+
if (counts.size > 1) {
|
|
77
|
+
problems.push(`${here} has rows of different lengths (${grid.map((row, i) => `row ${i + 1} has ${row.length}`).join(', ')}). Every row has the same number of cells; write . for one with nothing in it.`);
|
|
78
|
+
}
|
|
79
|
+
for (const word of new Set(grid.flat())) {
|
|
80
|
+
if (word !== EMPTY_CELL && !isAreaName(word)) {
|
|
81
|
+
problems.push(`${here} has "${word}", which is not an area name. An area is a lowercase word (letters, digits and hyphens, at most 24, starting with a letter, and not ${[...CSS_WORDS].join(' or ')}); . is a cell with nothing in it.`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (problems.length)
|
|
85
|
+
return problems;
|
|
86
|
+
for (const name of layoutAreas(grid)) {
|
|
87
|
+
if (isRectangle(grid, name))
|
|
88
|
+
continue;
|
|
89
|
+
problems.push(`${here}: "${name}" is not a rectangle: it covers ${said(cellsOf(grid, name).map(place))}. An area is one block of cells; give each separate block its own name.`);
|
|
90
|
+
}
|
|
91
|
+
return problems;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The areas a layout leaves for a reader when `hidden` ones have nothing to draw: a hidden area's cells go to its left
|
|
95
|
+
* neighbour in that row (the right one when it is first), and a row left with no area in it is dropped. A neighbour that
|
|
96
|
+
* would stop being a rectangle by it is not given the cells, which stand empty. Pure: a template in, a template out.
|
|
97
|
+
*/
|
|
98
|
+
export function reflowLayout(grid, hidden) {
|
|
99
|
+
let next = grid.map((row) => [...row]);
|
|
100
|
+
for (const name of layoutAreas(grid)) {
|
|
101
|
+
if (!hidden.has(name))
|
|
102
|
+
continue;
|
|
103
|
+
const trial = next.map((row) => [...row]);
|
|
104
|
+
const touched = new Set();
|
|
105
|
+
next.forEach((row, r) => {
|
|
106
|
+
const first = row.indexOf(name);
|
|
107
|
+
if (first < 0)
|
|
108
|
+
return;
|
|
109
|
+
const last = row.lastIndexOf(name);
|
|
110
|
+
const neighbour = first > 0 ? row[first - 1] : (row[last + 1] ?? EMPTY_CELL);
|
|
111
|
+
for (let c = first; c <= last; c++)
|
|
112
|
+
trial[r][c] = neighbour;
|
|
113
|
+
touched.add(neighbour);
|
|
114
|
+
});
|
|
115
|
+
for (const other of touched) {
|
|
116
|
+
if (other !== EMPTY_CELL && !isRectangle(trial, other)) {
|
|
117
|
+
trial.forEach((row, r) => row.forEach((cell, c) => {
|
|
118
|
+
if (cell === other && next[r][c] === name)
|
|
119
|
+
row[c] = EMPTY_CELL;
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
next = trial;
|
|
124
|
+
}
|
|
125
|
+
return next.filter((row) => row.some((cell) => cell !== EMPTY_CELL));
|
|
126
|
+
}
|
|
127
|
+
/** The template as the strings a CSS `grid-template-areas` takes: one quoted row each. */
|
|
128
|
+
export const gridTemplateAreas = (grid) => grid.map((row) => `"${row.join(' ')}"`).join(' ');
|
|
129
|
+
/** An area that no section is placed in, or a section placed in none: the nearest name for a slip. */
|
|
130
|
+
export function nearestArea(name, areas) {
|
|
131
|
+
return nearest(name, areas);
|
|
132
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type ForeignKey, type TableMeta } from './schema.js';
|
|
2
|
+
import type { AppListPresentation } from './listPresentations.js';
|
|
3
|
+
/**
|
|
4
|
+
* How the asks read the schema: the client through the walk's own helpers
|
|
5
|
+
* (core.js), the server over the schema it answered with (listQuestion.ts
|
|
6
|
+
* `referenceNames` names the references either way).
|
|
7
|
+
*/
|
|
8
|
+
export interface AskLookups {
|
|
9
|
+
table(id: string): TableMeta | undefined;
|
|
10
|
+
references(id: string): readonly ForeignKey[];
|
|
11
|
+
referenceNames(tableId: string, names: readonly string[]): Record<string, string>;
|
|
12
|
+
/** Where a table's records are named, as a view path (schema.ts labelPath, by the App's record label). */
|
|
13
|
+
naming(table: TableMeta): string | undefined;
|
|
14
|
+
}
|
|
15
|
+
/** What of a section its asks are made from. */
|
|
16
|
+
export interface AskedSection {
|
|
17
|
+
kind: string;
|
|
18
|
+
table?: string;
|
|
19
|
+
query?: string;
|
|
20
|
+
measure?: string;
|
|
21
|
+
/** A scatter's second measure, which places its dots across. */
|
|
22
|
+
x?: string;
|
|
23
|
+
by?: string;
|
|
24
|
+
lanes?: string[];
|
|
25
|
+
limit?: number;
|
|
26
|
+
over?: string;
|
|
27
|
+
compare?: string;
|
|
28
|
+
windowBase?: string;
|
|
29
|
+
/** The reader's window, where one stands in the author's (`windowed`): the window a metric's trend is drawn over. */
|
|
30
|
+
windowPhrase?: string;
|
|
31
|
+
comparePeriod?: boolean;
|
|
32
|
+
spark?: boolean;
|
|
33
|
+
shape?: string;
|
|
34
|
+
show?: string[];
|
|
35
|
+
sort?: string;
|
|
36
|
+
view?: string;
|
|
37
|
+
windows?: string[];
|
|
38
|
+
windowKey?: string;
|
|
39
|
+
/** A goal: a number, or read from data — per group where it names a `by` (a breakdown's, G76). */
|
|
40
|
+
target?: number | {
|
|
41
|
+
table: string;
|
|
42
|
+
query?: string;
|
|
43
|
+
measure: string;
|
|
44
|
+
by?: string;
|
|
45
|
+
over?: string;
|
|
46
|
+
windowBase?: string;
|
|
47
|
+
};
|
|
48
|
+
/** The target is the whole this metric is a share of, not a goal (it follows the metric's window and picks). */
|
|
49
|
+
targetWhole?: true;
|
|
50
|
+
error?: string;
|
|
51
|
+
}
|
|
52
|
+
/** A breakdown's goals, a row per group: the target table's measure by its own `by`, within its query. */
|
|
53
|
+
export declare function targetText(section: Pick<AskedSection, 'target' | 'limit'>): string | null;
|
|
54
|
+
/** The breakdown a section asks for: its measure by its key, within its query. */
|
|
55
|
+
export declare function breakdownText(section: Pick<AskedSection, 'table' | 'query' | 'measure' | 'by' | 'x'>, limit?: number | string): string;
|
|
56
|
+
/**
|
|
57
|
+
* A section with the reader's window in place of the author's. The server
|
|
58
|
+
* hands sections whose query already windows the `over` column a
|
|
59
|
+
* `windowBase` without that phrase, so the reader's phrase stands where
|
|
60
|
+
* the author's did rather than intersecting it. A compare derived from
|
|
61
|
+
* "previous period" is re-derived against the reader's window — `last 30
|
|
62
|
+
* days` picked compares against `previous 30 days`; a hand-written compare,
|
|
63
|
+
* or a window phrase with no "previous" (this month), hides the delta rather
|
|
64
|
+
* than compare the reader's window to the author's.
|
|
65
|
+
*/
|
|
66
|
+
export declare function windowed<S extends AskedSection>(section: S, windowNow: string | null): S;
|
|
67
|
+
/** The period a section with windows of its own is over: the reader's pick, else its first. */
|
|
68
|
+
export declare const sectionPeriod: (section: Pick<AskedSection, 'windows' | 'windowKey'>, periods: Readonly<Record<string, string>>) => string | null;
|
|
69
|
+
/** A metric's figure over `query` — its own, or its compare window's. */
|
|
70
|
+
export declare const measureText: (section: Pick<AskedSection, 'table' | 'measure'>, query: string | undefined) => string;
|
|
71
|
+
export declare const groupsAskedFor: (section: Pick<AskedSection, 'limit'>) => number;
|
|
72
|
+
/** The groups a chart asks for: stacked bars cross two keys, and bars and a donut order their groups themselves. */
|
|
73
|
+
export declare function chartLimit(section: Pick<AskedSection, 'shape' | 'limit' | 'by'>): number | undefined;
|
|
74
|
+
/** A board's lane counts. */
|
|
75
|
+
export declare const boardCountText: (section: Pick<AskedSection, 'table' | 'query' | 'by'>) => string;
|
|
76
|
+
/**
|
|
77
|
+
* A dashboard list's question: its rows with the columns it draws, the names
|
|
78
|
+
* its references are read by and the keys a row opens by, kept out of sight,
|
|
79
|
+
* up to its limit. `presentation` is the embedded view's, whose dress reads
|
|
80
|
+
* columns of its own.
|
|
81
|
+
*/
|
|
82
|
+
export declare function dashboardListQuery(lookups: AskLookups, section: Pick<AskedSection, 'table' | 'query' | 'sort' | 'show' | 'limit'>, presentation?: AppListPresentation): {
|
|
83
|
+
query: string;
|
|
84
|
+
keys: string[];
|
|
85
|
+
named: string[];
|
|
86
|
+
referenceLabels: Record<string, string>;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* A pick's choices, where its column is a whole single-column reference: the
|
|
90
|
+
* records it points at, by name, fifty at most. Null where the column is a
|
|
91
|
+
* vocabulary (its values are the choices) or no section's table has it.
|
|
92
|
+
*/
|
|
93
|
+
export declare function pickQuery(lookups: AskLookups, sections: readonly Pick<AskedSection, 'table'>[], column: string): string | null;
|