@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,368 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a record page reads, as the requests its sections send.
|
|
3
|
+
*
|
|
4
|
+
* A record page used to reach its reader in three waves of requests — the
|
|
5
|
+
* root and the plan, then a request or two per section, then the history —
|
|
6
|
+
* and at 20 ms to the database each wave was a round of admissions and
|
|
7
|
+
* statements: a lender's loan finished at 0.9 s. The server now answers the
|
|
8
|
+
* whole page in one request (server/http/recordCompose.ts, and the tenant
|
|
9
|
+
* host's own): it plans the page, then asks each section's read on the
|
|
10
|
+
* section's behalf, through the same route and the same grants as the
|
|
11
|
+
* section's own request, and hands every answer back beside the plan. The
|
|
12
|
+
* client keeps them for the requests they answer (client/composedReads.ts),
|
|
13
|
+
* and a section that asks finds its answer waiting.
|
|
14
|
+
*
|
|
15
|
+
* So the one rule is that server and client build each request alike, and
|
|
16
|
+
* the builders live here, used by both: the sections' own modules call them
|
|
17
|
+
* for the request they send, and the server calls them to know what the
|
|
18
|
+
* sections will ask. A request built differently is only asked again — the
|
|
19
|
+
* section sends it, as it always did — so a drift costs a request, never a
|
|
20
|
+
* wrong answer.
|
|
21
|
+
*
|
|
22
|
+
* The record's own row is the one read that is not asked alike: every fields
|
|
23
|
+
* section, the header, the root probe and a custom section's record fields
|
|
24
|
+
* read the one row, each for its columns, and which of them ask together
|
|
25
|
+
* depends on what is drawn (a tab not yet opened asks nothing). The server
|
|
26
|
+
* reads every column any of them names, once, and each is answered with
|
|
27
|
+
* exactly its part (`rowPart`), as the client's own shared read already was
|
|
28
|
+
* (pageFieldsRead.ts).
|
|
29
|
+
*/
|
|
30
|
+
import { findTable, labelPath, primaryKey } from './schema.js';
|
|
31
|
+
import { DEFAULT_HISTORY_LIMIT, kindReading } from './pageModel.js';
|
|
32
|
+
import { assertNever } from './model.js';
|
|
33
|
+
import { andQuery, quoteValue } from './query.js';
|
|
34
|
+
import { tabMatches } from './addressParams.js';
|
|
35
|
+
import { recordView, referenceProjection } from './referenceModel.js';
|
|
36
|
+
import { tableAtPrefix } from './viewPaths.js';
|
|
37
|
+
import { appTargetFields } from './appLinks.js';
|
|
38
|
+
/** The route a record page is composed on. */
|
|
39
|
+
export const RECORD_COMPOSE_PATH = '/api/pages/compose';
|
|
40
|
+
/**
|
|
41
|
+
* A timeline stream's reads, as its section asks them (kit PageTimeline.tsx): its rows, where its author is a
|
|
42
|
+
* reference with the person's name beside it, read through the reference as a list column of it is; and where the
|
|
43
|
+
* stream has a far side, that side's rows. One rule for the section and the page's planned reads (`recordReads`),
|
|
44
|
+
* so a composed page's answer is the very read the section asks: a record page whose timeline was planned without
|
|
45
|
+
* the author's name asked it again, alone, once the page had drawn (a field report: a fifth round on a record).
|
|
46
|
+
*/
|
|
47
|
+
export function timelineReads(names, stream) {
|
|
48
|
+
if (stream.error || stream.empty || !stream.view)
|
|
49
|
+
return undefined;
|
|
50
|
+
const table = stream.from === undefined ? undefined : names.table(stream.from);
|
|
51
|
+
const reference = stream.by ? table?.columns.find((column) => column.name === stream.by)?.references : undefined;
|
|
52
|
+
const target = reference ? names.table(reference.table) : undefined;
|
|
53
|
+
const named = target && names.namePath(target);
|
|
54
|
+
const view = target && named && !primaryKey(target).includes(named)
|
|
55
|
+
? { ...stream.view, columns: [...(stream.view.columns ?? []), { path: `${stream.by}.${named}` }] }
|
|
56
|
+
: stream.view;
|
|
57
|
+
const side = stream.side?.view && !stream.side.error && stream.key?.length ? stream.side.view : undefined;
|
|
58
|
+
return side ? { view, side } : { view };
|
|
59
|
+
}
|
|
60
|
+
/** Where a table's rows are named, as a view path. */
|
|
61
|
+
const namePathOf = (names, table) => names.namePath ? names.namePath(table) : labelPath(names.schema, table, names.recordLabel(table.id));
|
|
62
|
+
/**
|
|
63
|
+
* The fields a section shows when it names none. In the Workbench, every
|
|
64
|
+
* column: it is the database as it is. In an App, every column a reader
|
|
65
|
+
* reads — not a key the database handed out (a lone numeric or uuid primary
|
|
66
|
+
* key, which opened a lead on "ID 2") and not a row version, the same two
|
|
67
|
+
* the scaffold leaves out of the fields it writes (server/scaffold.ts).
|
|
68
|
+
*/
|
|
69
|
+
export function defaultFieldPaths(base, app) {
|
|
70
|
+
const keys = base.columns.filter((c) => c.primaryKey);
|
|
71
|
+
const surrogate = (c) => c.primaryKey && keys.length === 1 && (/^(id|uuid|guid)$/i.test(c.name) || /int|serial|number|numeric|uuid/i.test(c.type ?? ''));
|
|
72
|
+
const version = (c) => /^(version|lock_version|row_version|rowversion|revision)$/i.test(c.name);
|
|
73
|
+
const read = base.columns.filter((c) => !app || !(surrogate(c) || version(c))).map((c) => c.name);
|
|
74
|
+
return read.length ? read : base.columns.map((c) => c.name);
|
|
75
|
+
}
|
|
76
|
+
/** A fields section's columns: what it shows, the names of what it references, the record's name, and its workflow's field. */
|
|
77
|
+
export function fieldsColumns(names, base, section) {
|
|
78
|
+
const paths = section.paths?.length ? [...section.paths] : defaultFieldPaths(base, names.app);
|
|
79
|
+
const namePath = namePathOf(names, base);
|
|
80
|
+
/* A headline also reads its second figure and every field its actions
|
|
81
|
+
fill a form from; they are fetched, not shown as facts. */
|
|
82
|
+
const extra = section.presentation === 'headline'
|
|
83
|
+
? [
|
|
84
|
+
...(section.subfigure ? [section.subfigure] : []),
|
|
85
|
+
...(section.was ? [section.was] : []),
|
|
86
|
+
...(section.actions ?? []).flatMap((action) => [
|
|
87
|
+
...Object.values(action.prefill ?? {}),
|
|
88
|
+
...(action.to ? appTargetFields(action.to) : []),
|
|
89
|
+
]),
|
|
90
|
+
].filter((path) => !paths.includes(path))
|
|
91
|
+
: [];
|
|
92
|
+
const projection = referenceProjection(names.schema, base, [...paths, ...new Set(extra)], section.names !== false && names.app, (table) => namePathOf(names, table));
|
|
93
|
+
const fetched = projection.fetched;
|
|
94
|
+
if (namePath && !fetched.includes(namePath))
|
|
95
|
+
fetched.push(namePath);
|
|
96
|
+
if (section.workflow && !fetched.includes(section.workflow.field))
|
|
97
|
+
fetched.push(section.workflow.field);
|
|
98
|
+
// A row-defined column's fields are the ones its record's `per` picks (definedFields.ts),
|
|
99
|
+
// through a reference too: `requested_item_id.answers` reads `requested_item_id.<per>`.
|
|
100
|
+
for (const path of paths) {
|
|
101
|
+
const through = names.defined ? definedThrough(names.schema, base.id, path, names.defined) : undefined;
|
|
102
|
+
const per = through?.binding.per;
|
|
103
|
+
const perPath = per === undefined ? undefined : through.prefix ? `${through.prefix}.${per}` : per;
|
|
104
|
+
if (perPath && !fetched.includes(perPath))
|
|
105
|
+
fetched.push(perPath);
|
|
106
|
+
}
|
|
107
|
+
return { fetched, labels: projection.labels };
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The row-defined column a fields path ends on (`resources.<r>.defined`):
|
|
111
|
+
* the record's own (`specs`) or one through references
|
|
112
|
+
* (`requested_item_id.answers`), with the table it lives on, the hops before
|
|
113
|
+
* it, and its binding. Undefined for any other path. A record shows the
|
|
114
|
+
* column's fields wherever its path is shown, not only on its own page.
|
|
115
|
+
*/
|
|
116
|
+
export function definedThrough(schema, baseId, path, defined) {
|
|
117
|
+
const cut = path.lastIndexOf('.');
|
|
118
|
+
const prefix = cut === -1 ? '' : path.slice(0, cut), column = path.slice(cut + 1);
|
|
119
|
+
const table = tableAtPrefix(schema, baseId, prefix);
|
|
120
|
+
const bound = table ? defined(table.id) : undefined;
|
|
121
|
+
if (!table || !bound || !Object.hasOwn(bound, column))
|
|
122
|
+
return undefined;
|
|
123
|
+
return { table, column, prefix, binding: bound[column] };
|
|
124
|
+
}
|
|
125
|
+
/** A record header's columns: its status, its facts, the names of what they reference, and the record's name. */
|
|
126
|
+
export function headerColumns(names, base, section) {
|
|
127
|
+
const projection = referenceProjection(names.schema, base, [...(section.status ? [section.status] : []), ...(section.paths ?? [])], names.app, (table) => namePathOf(names, table));
|
|
128
|
+
const fetched = projection.fetched;
|
|
129
|
+
const namePath = namePathOf(names, base);
|
|
130
|
+
if (namePath && !fetched.includes(namePath))
|
|
131
|
+
fetched.push(namePath);
|
|
132
|
+
return { fetched, labels: projection.labels };
|
|
133
|
+
}
|
|
134
|
+
/** The key as a filter on the record's own row, one equality per key column. */
|
|
135
|
+
function keyFilter(base, key) {
|
|
136
|
+
return { groups: [primaryKey(base).map((column) => ({ path: column, op: '=', value: key[column] }))] };
|
|
137
|
+
}
|
|
138
|
+
/** A read of the record's own row, for columns: the probe (`root`), a fields section (`fields`), the header (`header`), a custom section's record (`<index>:record`). */
|
|
139
|
+
export function rowBody(pageId, base, key, columns, part) {
|
|
140
|
+
return {
|
|
141
|
+
count: 'none',
|
|
142
|
+
view: {
|
|
143
|
+
id: `page:${pageId}:${part}`,
|
|
144
|
+
name: base.name,
|
|
145
|
+
base: base.id,
|
|
146
|
+
columns: columns.map((path) => ({ path })),
|
|
147
|
+
filter: keyFilter(base, key),
|
|
148
|
+
limit: 1,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/** The probe's columns: the key, and the record's name. */
|
|
153
|
+
function probeColumns(names, base) {
|
|
154
|
+
const namePath = namePathOf(names, base);
|
|
155
|
+
return [...primaryKey(base), ...(namePath ? [namePath] : [])];
|
|
156
|
+
}
|
|
157
|
+
/** A related list's first request: its planned view at the reader's page size, with the names and keys a row needs. */
|
|
158
|
+
export function listView(names, section, plan, rows) {
|
|
159
|
+
const table = names.table ? names.table(section.from ?? '') : findTable(names.schema, section.from ?? '');
|
|
160
|
+
const limit = section.limit ?? rows;
|
|
161
|
+
const view = plan.view && !section.limit ? { ...plan.view, limit } : plan.view;
|
|
162
|
+
const explicit = (target) => (names.recordLabel(target.id) === undefined ? undefined : namePathOf(names, target));
|
|
163
|
+
return view && table
|
|
164
|
+
? recordView(names.schema, table, view, names.app, (target) => namePathOf(names, target), explicit)
|
|
165
|
+
: {
|
|
166
|
+
view: view,
|
|
167
|
+
labelColumns: {},
|
|
168
|
+
hidden: [],
|
|
169
|
+
keyColumns: [],
|
|
170
|
+
labelColumn: undefined,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/** A grouped list's page of groups, as `/api/breakdown` takes it: the request the page's compose asks and the list asks again. */
|
|
174
|
+
export function groupsBody(groups, offset) {
|
|
175
|
+
return { def: groups, limit: groups.limit, offset };
|
|
176
|
+
}
|
|
177
|
+
/** A metric's measure: a count asked as a breakdown with no key, or the plan's own breakdown; none for a plain aggregate. */
|
|
178
|
+
export function metricMeasure(plan) {
|
|
179
|
+
const counted = plan.counts && plan.view && !plan.breakdown
|
|
180
|
+
? {
|
|
181
|
+
base: plan.view.base,
|
|
182
|
+
by: [],
|
|
183
|
+
measures: [{ fn: 'count', alias: 'value' }],
|
|
184
|
+
...(plan.view.filter ? { filter: plan.view.filter } : {}),
|
|
185
|
+
limit: 1,
|
|
186
|
+
}
|
|
187
|
+
: undefined;
|
|
188
|
+
return plan.breakdown ?? counted;
|
|
189
|
+
}
|
|
190
|
+
/** Whether the record satisfies a `when`: one bounded query, key and condition composed the way every fold is. */
|
|
191
|
+
export function whenBody(base, key, when) {
|
|
192
|
+
const keyText = primaryKey(base)
|
|
193
|
+
.map((c) => `${c} = ${quoteValue(String(key[c]))}`)
|
|
194
|
+
.join(' and ');
|
|
195
|
+
return { q: `${base.id} ${andQuery(keyText, when)}`, limit: 1, offset: 0, count: 'none' };
|
|
196
|
+
}
|
|
197
|
+
/** The first page of a record's history. */
|
|
198
|
+
export function historyBody(base, key, limit) {
|
|
199
|
+
return { table: base.id, key, limit };
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The sections a page draws when it opens on `tab`, as PageSections.tsx lays
|
|
203
|
+
* them out: a strip of named tabs draws the one asked for (the first, when
|
|
204
|
+
* none is) and every panel holding the record's own fields; a run of lists
|
|
205
|
+
* made into tabs draws the one asked for; everything else is drawn. The
|
|
206
|
+
* header is drawn in the head. What a closed tab would read is read when it
|
|
207
|
+
* is opened, as ever, and asked for nothing here.
|
|
208
|
+
*/
|
|
209
|
+
export function drawnSections(schema, page, tab, appPage) {
|
|
210
|
+
const drawn = new Set();
|
|
211
|
+
const shownAll = page.sections.map((section, index) => ({ section, index })).filter(({ section }) => !section.hidden);
|
|
212
|
+
const header = shownAll.find(({ section }) => section.kind === 'fields' && section.presentation === 'header');
|
|
213
|
+
if (header)
|
|
214
|
+
drawn.add(header.index);
|
|
215
|
+
const hasAside = page.sections.some((section) => section.region === 'aside' && !section.hidden);
|
|
216
|
+
const autoTabs = appPage ? page.listTabs === true : page.listTabs !== false;
|
|
217
|
+
const tabbed = (section) => section.kind === 'list' && section.presentation !== 'gallery' && (section.width === undefined || !appPage);
|
|
218
|
+
const lay = (items, listTabs, scoped) => {
|
|
219
|
+
for (let i = 0; i < items.length; i += 1) {
|
|
220
|
+
if (!(listTabs && autoTabs && tabbed(items[i].section))) {
|
|
221
|
+
drawn.add(items[i].index);
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
let end = i;
|
|
225
|
+
while (end + 1 < items.length && tabbed(items[end + 1].section))
|
|
226
|
+
end += 1;
|
|
227
|
+
const run = items.slice(i, end + 1);
|
|
228
|
+
if (run.length === 1)
|
|
229
|
+
drawn.add(run[0].index);
|
|
230
|
+
else {
|
|
231
|
+
const token = (item) => scoped
|
|
232
|
+
? `section:${item.index}`
|
|
233
|
+
: (item.section.title ?? findTable(schema, item.section.from ?? '')?.name ?? item.section.from ?? '');
|
|
234
|
+
const asked = run.findIndex((item) => tabMatches(token(item), tab));
|
|
235
|
+
drawn.add(run[asked === -1 ? 0 : asked].index);
|
|
236
|
+
}
|
|
237
|
+
i = end;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
for (const region of hasAside ? ['main', 'aside'] : [undefined]) {
|
|
241
|
+
const shown = shownAll.filter(({ section }) => !(section.kind === 'fields' && section.presentation === 'header') && (!region || (section.region ?? 'main') === region));
|
|
242
|
+
const scoped = region === 'aside';
|
|
243
|
+
const groups = [];
|
|
244
|
+
for (const item of shown) {
|
|
245
|
+
if (!item.section.tab)
|
|
246
|
+
continue;
|
|
247
|
+
const group = groups.find((g) => g.name === item.section.tab);
|
|
248
|
+
if (group)
|
|
249
|
+
group.items.push(item);
|
|
250
|
+
else
|
|
251
|
+
groups.push({ name: item.section.tab, items: [item] });
|
|
252
|
+
}
|
|
253
|
+
if (groups.length < 2) {
|
|
254
|
+
lay(shown, true, scoped);
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
const first = shown.findIndex((item) => item.section.tab);
|
|
258
|
+
lay(shown.slice(0, first), true, scoped);
|
|
259
|
+
const asked = groups.findIndex((group) => tabMatches(`tab:${group.name}`, tab));
|
|
260
|
+
groups.forEach((group, i) => {
|
|
261
|
+
if (i === (asked === -1 ? 0 : asked) || group.items.some(({ section }) => section.kind === 'fields'))
|
|
262
|
+
lay(group.items, false, scoped);
|
|
263
|
+
});
|
|
264
|
+
lay(shown.slice(first).filter((item) => !item.section.tab), true, scoped);
|
|
265
|
+
}
|
|
266
|
+
return drawn;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Every read a record page's sections will ask for when it opens on `tab`,
|
|
270
|
+
* given its plan: the record's row (every column any section drawn reads),
|
|
271
|
+
* and each other request as the section builds it. A hidden section, and
|
|
272
|
+
* one in a closed tab, reads nothing; a section behind a `when` is read
|
|
273
|
+
* too, and its condition asked, since the answer is only kept until it is
|
|
274
|
+
* asked for.
|
|
275
|
+
*/
|
|
276
|
+
export function recordPageReads(names, page, base, plans, key, options) {
|
|
277
|
+
const drawn = drawnSections(names.schema, page, options.tab, names.app);
|
|
278
|
+
/* Each reader of the row with its own columns, too: the one read of all of
|
|
279
|
+
them is refused whole where any column is, and then each is asked alone,
|
|
280
|
+
as the sections would have been. */
|
|
281
|
+
const parts = [{ part: 'root', columns: probeColumns(names, base) }];
|
|
282
|
+
const reads = [];
|
|
283
|
+
const planOf = (index) => plans.find((plan) => plan.index === index);
|
|
284
|
+
const view = (body) => reads.push({ path: '/api/view/run', body });
|
|
285
|
+
const breakdown = (def) => reads.push({ path: '/api/breakdown', body: { def } });
|
|
286
|
+
page.sections.forEach((section, index) => {
|
|
287
|
+
if (section.hidden || !drawn.has(index))
|
|
288
|
+
return;
|
|
289
|
+
if (section.when)
|
|
290
|
+
reads.push({ path: '/api/run', body: whenBody(base, key, section.when) });
|
|
291
|
+
const plan = planOf(index);
|
|
292
|
+
if (section.kind === 'fields') {
|
|
293
|
+
const header = section.presentation === 'header';
|
|
294
|
+
parts.push({
|
|
295
|
+
part: header ? 'header' : 'fields',
|
|
296
|
+
columns: (header ? headerColumns(names, base, section) : fieldsColumns(names, base, section)).fetched,
|
|
297
|
+
});
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (section.kind === 'history') {
|
|
301
|
+
if (options.history)
|
|
302
|
+
reads.push({ path: '/api/record-history', body: historyBody(base, key, section.limit ?? DEFAULT_HISTORY_LIMIT) });
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
/* A note reads nothing. Flow runs are fetched lazily by their section, behind the reader's own check
|
|
306
|
+
(server/recordFlows.ts), and a flow's diagram reads its steps when it is drawn, as the reader's rows
|
|
307
|
+
(PageFlowDiagram.tsx). */
|
|
308
|
+
if (kindReading(section.kind, 'none'))
|
|
309
|
+
return;
|
|
310
|
+
if (section.kind === 'custom' && section.record?.length)
|
|
311
|
+
parts.push({ part: `${index}:record`, columns: [...section.record] });
|
|
312
|
+
if (!plan || plan.error || plan.empty)
|
|
313
|
+
return;
|
|
314
|
+
switch (section.kind) {
|
|
315
|
+
case 'metric': {
|
|
316
|
+
const measure = metricMeasure(plan);
|
|
317
|
+
if (measure)
|
|
318
|
+
breakdown(measure);
|
|
319
|
+
else if (plan.view)
|
|
320
|
+
view({ view: plan.view });
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
case 'breakdown':
|
|
324
|
+
case 'chart':
|
|
325
|
+
if (plan.breakdown)
|
|
326
|
+
breakdown(plan.breakdown);
|
|
327
|
+
return;
|
|
328
|
+
case 'timeline':
|
|
329
|
+
for (const stream of plan.streams ?? []) {
|
|
330
|
+
const asked = timelineReads({
|
|
331
|
+
table: (id) => (names.table ? names.table(id) : findTable(names.schema, id)),
|
|
332
|
+
namePath: (table) => namePathOf(names, table),
|
|
333
|
+
}, stream);
|
|
334
|
+
if (asked)
|
|
335
|
+
view({ view: asked.view, offset: 0 });
|
|
336
|
+
if (asked?.side)
|
|
337
|
+
view({ view: asked.side, offset: 0 });
|
|
338
|
+
}
|
|
339
|
+
return;
|
|
340
|
+
case 'custom':
|
|
341
|
+
for (const read of Object.values(plan.reads ?? {}))
|
|
342
|
+
if (!read.error && !read.empty && read.view)
|
|
343
|
+
view({ view: read.view, offset: 0, count: 'none' });
|
|
344
|
+
for (const total of Object.values(plan.aggregates ?? {}))
|
|
345
|
+
if (!total.error && !total.empty && total.breakdown)
|
|
346
|
+
breakdown(total.breakdown);
|
|
347
|
+
return;
|
|
348
|
+
case 'list': {
|
|
349
|
+
/* A grouped list asks its groups first; each group's rows are asked of the keys that come back. */
|
|
350
|
+
if (section.group && plan.groups) {
|
|
351
|
+
reads.push({ path: '/api/breakdown', body: groupsBody(plan.groups, 0) });
|
|
352
|
+
if (plan.totals)
|
|
353
|
+
breakdown(plan.totals);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
const listed = listView(names, section, plan, options.rows).view;
|
|
357
|
+
if (listed)
|
|
358
|
+
view({ view: listed, offset: 0 });
|
|
359
|
+
if (plan.totals)
|
|
360
|
+
breakdown(plan.totals);
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
default:
|
|
364
|
+
assertNever(section.kind, 'page section kind');
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
return { row: [...new Set(parts.flatMap((part) => part.columns))], parts, reads };
|
|
368
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A record template: one row, with its references pulled in around it.
|
|
3
|
+
*
|
|
4
|
+
* The view composer as built answers "give me a table of X with columns from
|
|
5
|
+
* the things X points at" — one row per base record, joins flattened into
|
|
6
|
+
* columns. That is a useful shape and the wrong one for the question tablewalk
|
|
7
|
+
* actually exists to answer, which is "show me *this* work order, properly".
|
|
8
|
+
*
|
|
9
|
+
* That question wants a page: the work order's own fields, the customer's
|
|
10
|
+
* details inline because a work order without its customer's name is a
|
|
11
|
+
* riddle, and its parts and notes as tables underneath because there are
|
|
12
|
+
* several of each and a count is not enough.
|
|
13
|
+
*
|
|
14
|
+
* The difference from a list view is not cosmetic — it is what the thing is
|
|
15
|
+
* bound to. A list view is a *query*: it produces rows and you read them. A
|
|
16
|
+
* record template is bound to a **table**, not to a row, and applies to every
|
|
17
|
+
* row of it. Configure `work_order` once and every work order you ever walk
|
|
18
|
+
* to is laid out that way. That is what makes it worth configuring at all.
|
|
19
|
+
*
|
|
20
|
+
* Two consequences fall out, and both are why this shape earns its place:
|
|
21
|
+
*
|
|
22
|
+
* - A has-many relationship is finally answerable. In a list view it either
|
|
23
|
+
* multiplies rows or collapses to a count; here it is simply a table on
|
|
24
|
+
* the page, which is what anyone asking for "the order and its lines"
|
|
25
|
+
* meant in the first place.
|
|
26
|
+
* - Views stop being a dead end. A list view is somewhere you look; a
|
|
27
|
+
* record template is where a walk *arrives*, so views become part of the
|
|
28
|
+
* navigation rather than a parallel product beside it.
|
|
29
|
+
*/
|
|
30
|
+
import { type ColumnMeta, type DatabaseSchema, type ForeignKey, type TableMeta } from './schema.js';
|
|
31
|
+
/** A block of the base record's own fields, or of a to-one reference's. */
|
|
32
|
+
interface FieldSection {
|
|
33
|
+
kind: 'fields';
|
|
34
|
+
/** Shown above the block. Absent means no heading. */
|
|
35
|
+
title?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Paths, relative to the base. `reference` is the base's own column;
|
|
38
|
+
* `customer_id.name` is the customer's, pulled inline.
|
|
39
|
+
*/
|
|
40
|
+
paths: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A table of the rows that point at this record.
|
|
44
|
+
*
|
|
45
|
+
* Keyed by constraint name for the same reason aggregates are: a child can
|
|
46
|
+
* point at the same parent twice, and `work_order.parent_id` and
|
|
47
|
+
* `work_order.supersedes_id` are two different sections that would otherwise
|
|
48
|
+
* be indistinguishable.
|
|
49
|
+
*/
|
|
50
|
+
export interface ListSection {
|
|
51
|
+
kind: 'list';
|
|
52
|
+
title?: string;
|
|
53
|
+
/** Constraint name of the foreign key pointing back at this record. */
|
|
54
|
+
via: string;
|
|
55
|
+
/** Columns of the child table to show. Empty means a sensible default. */
|
|
56
|
+
columns: string[];
|
|
57
|
+
/** Rows to fetch per section. Bounded because a page is not a report. */
|
|
58
|
+
limit?: number;
|
|
59
|
+
orderBy?: {
|
|
60
|
+
column: string;
|
|
61
|
+
direction: 'asc' | 'desc';
|
|
62
|
+
}[];
|
|
63
|
+
}
|
|
64
|
+
type RecordSection = FieldSection | ListSection;
|
|
65
|
+
interface RecordTemplate {
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
/** The table this template lays out. Not a row — every row of it. */
|
|
69
|
+
base: string;
|
|
70
|
+
sections: RecordSection[];
|
|
71
|
+
/** Used for every record of this table unless another is chosen. */
|
|
72
|
+
isDefault?: boolean;
|
|
73
|
+
connection?: string;
|
|
74
|
+
source?: 'config' | 'saved';
|
|
75
|
+
}
|
|
76
|
+
/** Rows to show in an embedded list before it needs its own page. */
|
|
77
|
+
export declare const DEFAULT_LIST_LIMIT = 10;
|
|
78
|
+
/**
|
|
79
|
+
* How a table's own columns divide into blocks.
|
|
80
|
+
*
|
|
81
|
+
* Derived from what the schema already says rather than from a stored layout:
|
|
82
|
+
* keys and the label column identify, foreign keys link, dates measure, and
|
|
83
|
+
* anything named like an audit column is bookkeeping. Ordering is by what
|
|
84
|
+
* gets looked at first, not by declaration order.
|
|
85
|
+
*
|
|
86
|
+
* Lives here rather than in the renderer because it *is* the default
|
|
87
|
+
* template. Having the derivation in one place and the stored layout in
|
|
88
|
+
* another is how the two start disagreeing about what a record looks like.
|
|
89
|
+
*/
|
|
90
|
+
export declare function groupOwnColumns(table: TableMeta): Array<[string | null, ColumnMeta[]]>;
|
|
91
|
+
/**
|
|
92
|
+
* The template a table gets before anyone configures one.
|
|
93
|
+
*
|
|
94
|
+
* Derived rather than blank, because a blank record page is a worse starting
|
|
95
|
+
* point than the default layout the record view already produces, and because
|
|
96
|
+
* the fastest way to explain what a template *is* is to show someone one made
|
|
97
|
+
* of their own data.
|
|
98
|
+
*
|
|
99
|
+
* The rules are the ones the record view already uses, made explicit: the
|
|
100
|
+
* record's own fields first, then each to-one reference as its own labelled
|
|
101
|
+
* block, then each incoming relationship as a table.
|
|
102
|
+
*/
|
|
103
|
+
export declare function deriveTemplate(schema: DatabaseSchema, tableId: string): RecordTemplate | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Every column of a child table worth showing, in declaration order.
|
|
106
|
+
*
|
|
107
|
+
* All of them, not a summary. A summary is the right shape for a reference
|
|
108
|
+
* pulled *into* a record — a customer's forty fields would bury the work order
|
|
109
|
+
* they are attached to — and the wrong shape for a table of children, which is
|
|
110
|
+
* the thing you opened the record to read. `work_order_part` summarised down
|
|
111
|
+
* to one column of quantities is a list of numbers with nothing to attach them
|
|
112
|
+
* to.
|
|
113
|
+
*
|
|
114
|
+
* The join columns are still dropped: every row here carries the same value
|
|
115
|
+
* for them, so a column of one repeated value is width spent on nothing. The
|
|
116
|
+
* key stays, because it is what distinguishes the rows.
|
|
117
|
+
*
|
|
118
|
+
* Anyone who wants fewer can say so in the layout builder, which is the right
|
|
119
|
+
* order for a default — start from everything and subtract, rather than start
|
|
120
|
+
* from a guess and hunt for what is missing.
|
|
121
|
+
*/
|
|
122
|
+
export declare function listColumns(table: TableMeta, exclude?: string[]): string[];
|
|
123
|
+
/**
|
|
124
|
+
* A few columns that say what a row *is*.
|
|
125
|
+
*
|
|
126
|
+
* Keys and the columns forming the join are dropped: in a table of a work
|
|
127
|
+
* order's parts, every row has the same `work_order_id`, so a column of it is
|
|
128
|
+
* a column of one repeated value. What is left is what distinguishes the rows
|
|
129
|
+
* from each other, which is the only thing the section is there to show.
|
|
130
|
+
*/
|
|
131
|
+
export declare function summaryColumns(table: TableMeta, exclude?: string[], max?: number): string[];
|
|
132
|
+
interface ResolvedList {
|
|
133
|
+
section: ListSection;
|
|
134
|
+
fk: ForeignKey;
|
|
135
|
+
child: TableMeta;
|
|
136
|
+
/** Column on the child that carries the parent's key, per key column. */
|
|
137
|
+
join: Array<{
|
|
138
|
+
childColumn: string;
|
|
139
|
+
parentColumn: string;
|
|
140
|
+
}>;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Match each list section to the foreign key it names.
|
|
144
|
+
*
|
|
145
|
+
* A section whose constraint has since been dropped is returned as an error
|
|
146
|
+
* rather than skipped: a template that quietly stops showing a table looks
|
|
147
|
+
* exactly like a record that has no rows in it.
|
|
148
|
+
*/
|
|
149
|
+
export declare function resolveLists(schema: DatabaseSchema, template: RecordTemplate): {
|
|
150
|
+
lists: ResolvedList[];
|
|
151
|
+
errors: string[];
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Every path the base row itself has to supply.
|
|
155
|
+
*
|
|
156
|
+
* Collected across field sections so the record can be fetched in one query
|
|
157
|
+
* rather than one per section — a page with six reference blocks should not
|
|
158
|
+
* be six round trips.
|
|
159
|
+
*/
|
|
160
|
+
export declare function fieldPaths(template: RecordTemplate): string[];
|
|
161
|
+
/** Whether a template still says anything, after resolution. */
|
|
162
|
+
export declare function isEmpty(template: RecordTemplate): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* One layout as a config file writes it.
|
|
165
|
+
*
|
|
166
|
+
* `sections` is deliberately not `RecordSection[]`: a list section is keyed
|
|
167
|
+
* internally by constraint name (`via`), which is the right key — a child can
|
|
168
|
+
* point at a parent twice and the column alone would not say which — and the
|
|
169
|
+
* wrong thing to ask a person to type. So a config may say `via`, or say
|
|
170
|
+
* `from` and `whose` the way a page section does, and the naming is resolved
|
|
171
|
+
* against the schema when the layout is served.
|
|
172
|
+
*
|
|
173
|
+
* The authored words are the page section's — `whose`, `show`, `sort` — so
|
|
174
|
+
* one file speaks one language (docs/apps.md, "The respelling"). The parsed
|
|
175
|
+
* sections keep the internal field names (`path`, `paths`, `columns`,
|
|
176
|
+
* `orderBy`): the client and the server's resolver read those, and the
|
|
177
|
+
* respelling is of the surface a person types, not of the model.
|
|
178
|
+
*/
|
|
179
|
+
export interface ConfigLayout {
|
|
180
|
+
table: string;
|
|
181
|
+
connection?: string;
|
|
182
|
+
name?: string;
|
|
183
|
+
sections: Array<Record<string, unknown>>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Read the `layouts` section of a tablewalk.json.
|
|
187
|
+
*
|
|
188
|
+
* Throws on anything malformed rather than skipping it, naming the entry and
|
|
189
|
+
* the fix — the same rule `parsePagesConfig` follows, for the same reason: a
|
|
190
|
+
* layout that silently did not appear is a bug report that starts "I
|
|
191
|
+
* definitely wrote it".
|
|
192
|
+
*
|
|
193
|
+
* Structure only. Whether `customer_id` is a real column, or `invoice` a real
|
|
194
|
+
* table, needs a schema this runs long before — those are answered when the
|
|
195
|
+
* layout is served, and reported on the layout itself.
|
|
196
|
+
*/
|
|
197
|
+
export declare function parseLayoutsConfig(raw: unknown, where: string): ConfigLayout[];
|
|
198
|
+
export {};
|