@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,177 @@
|
|
|
1
|
+
export declare const COMPONENT_KINDS: readonly ['section', 'value', 'input', 'list', 'page'];
|
|
2
|
+
export type ComponentKind = (typeof COMPONENT_KINDS)[number];
|
|
3
|
+
export declare const COMPONENT_PROP_TYPES: readonly ['number', 'text', 'boolean', 'choice'];
|
|
4
|
+
/** One declared prop: JSON-safe, with its default and its bounds, so a value is checked at load. */
|
|
5
|
+
export type ComponentPropDecl = {
|
|
6
|
+
type: 'number';
|
|
7
|
+
default?: number;
|
|
8
|
+
min?: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'text';
|
|
12
|
+
default?: string;
|
|
13
|
+
max?: number;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'boolean';
|
|
16
|
+
default?: boolean;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'choice';
|
|
19
|
+
options: string[];
|
|
20
|
+
default?: string;
|
|
21
|
+
};
|
|
22
|
+
/** What `component()` returns: a name, a path relative to the App directory, a kind and its props. */
|
|
23
|
+
export interface ComponentDecl {
|
|
24
|
+
id: string;
|
|
25
|
+
module: string;
|
|
26
|
+
kind: ComponentKind;
|
|
27
|
+
props?: Record<string, ComponentPropDecl>;
|
|
28
|
+
}
|
|
29
|
+
/** The key a component is referenced by: lowercase, the file names it is served under start with it. */
|
|
30
|
+
export declare const COMPONENT_ID: RegExp;
|
|
31
|
+
/**
|
|
32
|
+
* How many named reads one custom section may declare. Its reads are asked together, one request each, so this
|
|
33
|
+
* bounds the fan-out of a single paint (the server runs one active connection per process); the section draws one
|
|
34
|
+
* skeleton until all are in, so more reads never shift the layout. Four was short of a real section (a list, its
|
|
35
|
+
* neighbours and a few tables to look names up in); eight keeps a paint at a handful of queries.
|
|
36
|
+
*/
|
|
37
|
+
export declare const MAX_CUSTOM_READS = 8;
|
|
38
|
+
/**
|
|
39
|
+
* How many aggregate reads (`figures`) one custom section may declare. Each is one breakdown, asked with the paint's
|
|
40
|
+
* other breakdowns in a single request (breakdownBatch.ts), so the bound is on the work one section adds to it.
|
|
41
|
+
*/
|
|
42
|
+
export declare const MAX_CUSTOM_FIGURES = 8;
|
|
43
|
+
/** The keys a declared read of rows takes, on a page and on a dashboard. */
|
|
44
|
+
export declare const PAGE_READ_KEYS: readonly ['from', 'whose', 'query', 'show', 'sort', 'limit'];
|
|
45
|
+
export declare const DASH_READ_KEYS: readonly ['from', 'query', 'show', 'sort', 'limit', 'over'];
|
|
46
|
+
/** What a total measures: the breakdown grammar's aggregates over one column of the resource (count takes none). */
|
|
47
|
+
declare const TOTAL_FUNCTIONS: readonly ['count', 'sum', 'avg', 'min', 'max'];
|
|
48
|
+
type TotalFunction = (typeof TOTAL_FUNCTIONS)[number];
|
|
49
|
+
/** Whether a value is a component declaration: what a display rule or a section names in place of its own words. */
|
|
50
|
+
export declare function isComponentDecl(value: unknown): value is Record<string, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* A component declaration, checked in shape. The file itself — that it
|
|
53
|
+
* exists, inside the App directory, and compiles — is the loader's to judge
|
|
54
|
+
* (it knows the directory); this is what can be said of the data alone.
|
|
55
|
+
*/
|
|
56
|
+
export declare function parseComponentDecl(raw: unknown, at: string, expected?: ComponentKind): ComponentDecl;
|
|
57
|
+
/**
|
|
58
|
+
* The props a placement hands its component: each value checked against the
|
|
59
|
+
* component's declaration and every default filled in, so the module reads
|
|
60
|
+
* exactly the shape its types promise. A prop the declaration does not name is
|
|
61
|
+
* refused, as an unknown key is everywhere else.
|
|
62
|
+
*/
|
|
63
|
+
export declare function componentPropValues(decl: ComponentDecl, raw: unknown, at: string): Record<string, unknown>;
|
|
64
|
+
/** One declared read of rows on a page: related to the record by `whose`, or the resource's own rows, narrowed. */
|
|
65
|
+
export interface PageCustomRead {
|
|
66
|
+
from: string;
|
|
67
|
+
/** Config `whose`: the path from `from` back to the page's record. Absent, the rows are not tied to it. */
|
|
68
|
+
path?: string;
|
|
69
|
+
filter?: string;
|
|
70
|
+
columns: string[];
|
|
71
|
+
/** Query-bar text, as authored; `orderBy` is what the planner runs. */
|
|
72
|
+
sort?: string;
|
|
73
|
+
orderBy?: Array<{
|
|
74
|
+
column: string;
|
|
75
|
+
direction: 'asc' | 'desc';
|
|
76
|
+
}>;
|
|
77
|
+
limit?: number;
|
|
78
|
+
}
|
|
79
|
+
/** One declared read of rows on a dashboard: the rows section's words, the window's `over` included. */
|
|
80
|
+
export interface DashCustomRead {
|
|
81
|
+
table: string;
|
|
82
|
+
query?: string;
|
|
83
|
+
show: string[];
|
|
84
|
+
sort?: string;
|
|
85
|
+
limit?: number;
|
|
86
|
+
over?: string;
|
|
87
|
+
/** Served, never authored: the query without its own window, as a rows section's. */
|
|
88
|
+
windowBase?: string;
|
|
89
|
+
}
|
|
90
|
+
export declare function parsePageReads(raw: unknown, at: string): Record<string, PageCustomRead> | undefined;
|
|
91
|
+
export declare function parseDashReads(raw: unknown, at: string): Record<string, DashCustomRead> | undefined;
|
|
92
|
+
/** One declared aggregate read on a page: a count, sum, average, minimum or maximum, tied to the record by `whose`. */
|
|
93
|
+
export interface PageCustomTotal {
|
|
94
|
+
from: string;
|
|
95
|
+
fn: TotalFunction;
|
|
96
|
+
/** The column measured; absent for a count. */
|
|
97
|
+
column?: string;
|
|
98
|
+
/** What the figure is grouped by, in the breakdown grammar ("status", "month opened_on"); absent, one figure. */
|
|
99
|
+
by?: string;
|
|
100
|
+
/** Config `whose`: the path from `from` back to the page's record. Absent, the resource's own rows. */
|
|
101
|
+
path?: string;
|
|
102
|
+
filter?: string;
|
|
103
|
+
limit?: number;
|
|
104
|
+
}
|
|
105
|
+
/** One declared aggregate read on a dashboard: a measure in the breakdown grammar, narrowed by the window's `over`. */
|
|
106
|
+
export interface DashCustomTotal {
|
|
107
|
+
table: string;
|
|
108
|
+
/** "count" or "sum amount": the breakdown grammar's measure. */
|
|
109
|
+
measure: string;
|
|
110
|
+
by?: string;
|
|
111
|
+
query?: string;
|
|
112
|
+
over?: string;
|
|
113
|
+
limit?: number;
|
|
114
|
+
/** Served, never authored: the query without its own window, as a rows section's. */
|
|
115
|
+
windowBase?: string;
|
|
116
|
+
}
|
|
117
|
+
export declare function parsePageTotals(raw: unknown, at: string): Record<string, PageCustomTotal> | undefined;
|
|
118
|
+
export declare function parseDashTotals(raw: unknown, at: string): Record<string, DashCustomTotal> | undefined;
|
|
119
|
+
/** How many groups a total with a `by` returns when it says no limit. */
|
|
120
|
+
export declare const groupsAsked: (limit: number | undefined) => number;
|
|
121
|
+
/** A record's own fields a page's custom section reads. */
|
|
122
|
+
export declare function parseRecordFields(raw: unknown, at: string): string[] | undefined;
|
|
123
|
+
/** A custom list presentation as the App serves it: the component, the columns it reads, its props. */
|
|
124
|
+
export interface CustomListPresentation {
|
|
125
|
+
kind: 'custom';
|
|
126
|
+
component: ComponentDecl;
|
|
127
|
+
show: string[];
|
|
128
|
+
props: Record<string, unknown>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* `customList(postStream, { show: ['body', 'author_id.display_name'] })`: a
|
|
132
|
+
* list view's rows drawn by the author's component. The platform keeps the
|
|
133
|
+
* query, the tabs, the filters, the sort, the paging and the bulk actions;
|
|
134
|
+
* `show` is what the query reads beside the keys, so every row the component
|
|
135
|
+
* receives carries exactly those columns.
|
|
136
|
+
*/
|
|
137
|
+
export declare function parseCustomList(raw: Record<string, unknown>, at: string): CustomListPresentation;
|
|
138
|
+
/** A free-form page as its `pages/*.page.tsx` file declares it, before it is served as the dashboard that draws it (appViews.ts). */
|
|
139
|
+
interface PageDecl {
|
|
140
|
+
component: ComponentDecl;
|
|
141
|
+
/** The resources the page reads, which gate it: a reader who cannot read one of them is not offered it. */
|
|
142
|
+
reads: string[];
|
|
143
|
+
/** The commands the page runs; any other is refused, in the browser and by the server. */
|
|
144
|
+
commands: string[];
|
|
145
|
+
/** The address parameters the page keeps its place in: `/{app}/pick-walk?list=12`. */
|
|
146
|
+
params: string[];
|
|
147
|
+
/** The loader that reads for it on the server, by its name in the commands module (`defineLoaders`). */
|
|
148
|
+
loader?: string;
|
|
149
|
+
props: Record<string, unknown>;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* `definePage({ reads: ['pick_list'], commands: ['pickList'], params: ['list'], component })`:
|
|
153
|
+
* a whole page drawn by the author's component. What it reads and runs is
|
|
154
|
+
* declared, so a reader who cannot read every one of its resources is not
|
|
155
|
+
* offered it, `mistri check` holds the module to it, and authority.lock
|
|
156
|
+
* records it; its place is kept in the address by the parameters it names,
|
|
157
|
+
* so a page reached by link opens where it was. A bracketed code leads each
|
|
158
|
+
* refusal, for `mistri check` (checkProblems.ts).
|
|
159
|
+
*/
|
|
160
|
+
export declare function parsePage(raw: Record<string, unknown>, at: string): PageDecl;
|
|
161
|
+
/**
|
|
162
|
+
* `inputs: { color: colorPicker }`: a component standing in a form's field —
|
|
163
|
+
* a resource's column in its edit and New forms, or a command's input in an
|
|
164
|
+
* action's or a signed-in form's command form. It draws the control and
|
|
165
|
+
* hands back a value; what the value must be is still the form's rules and
|
|
166
|
+
* the server's to judge.
|
|
167
|
+
*/
|
|
168
|
+
export declare function parseInputs(raw: unknown, at: string, options?: {
|
|
169
|
+
paths?: boolean;
|
|
170
|
+
}): Record<string, ComponentDecl> | undefined;
|
|
171
|
+
/** A command's input by its name or its path through groups (`trade.vin`), or undefined; a group itself is not one, nor are lines (their grid is the platform's). */
|
|
172
|
+
export declare function commandInputAt<F extends {
|
|
173
|
+
name: string;
|
|
174
|
+
type?: string;
|
|
175
|
+
fields?: readonly F[];
|
|
176
|
+
}>(fields: readonly F[], path: string): F | undefined;
|
|
177
|
+
export {};
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom components, as the App definition declares them: an author's own
|
|
3
|
+
* React module, referenced by path and placed only through a declared kind —
|
|
4
|
+
* a `custom` section on a page or a dashboard, a value renderer where a
|
|
5
|
+
* display rule stands, an input where a form draws a field, a list view's
|
|
6
|
+
* rows (`customList`) or a free-form page (`definePage` in `pages/*.page.tsx`).
|
|
7
|
+
*
|
|
8
|
+
* The definition stays data. `app.ts` is evaluated in a worker and crosses
|
|
9
|
+
* back by structured clone, so a component can never be embedded as a
|
|
10
|
+
* function: `component(id, { module })` is a name and a path, and the server
|
|
11
|
+
* compiles the module beside the App (packages/mistri/src/server/app/appComponents.ts). What
|
|
12
|
+
* the component reads is declared here too — the record's own fields and
|
|
13
|
+
* named reads of rows — so it is checked, planned and authorized like every
|
|
14
|
+
* built-in section, and the module only draws what it is handed.
|
|
15
|
+
*
|
|
16
|
+
* Author code is deployment code, trusted like `commands.ts`; the server
|
|
17
|
+
* stays the only security boundary. A signed-out visitor may meet one where
|
|
18
|
+
* the public grant already lets them read — a page, a list or a value over a
|
|
19
|
+
* resource `auth.public` opens — and every read it makes is the public
|
|
20
|
+
* grant's, refused on the server like any other; what a component declares
|
|
21
|
+
* it reads there is held to that grant as the App loads, so a public page
|
|
22
|
+
* never breaks for its visitors. The landing and public forms stay a closed
|
|
23
|
+
* set of kinds that never runs markup: no component stands on either.
|
|
24
|
+
*/
|
|
25
|
+
import { allowKeys, isRecord } from './model.js';
|
|
26
|
+
export const COMPONENT_KINDS = ['section', 'value', 'input', 'list', 'page'];
|
|
27
|
+
export const COMPONENT_PROP_TYPES = ['number', 'text', 'boolean', 'choice'];
|
|
28
|
+
/** The key a component is referenced by: lowercase, the file names it is served under start with it. */
|
|
29
|
+
export const COMPONENT_ID = /^[a-z][a-z0-9-]{0,47}$/;
|
|
30
|
+
/** What a component module may be: TypeScript or JavaScript, with or without JSX. */
|
|
31
|
+
const COMPONENT_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js'];
|
|
32
|
+
/**
|
|
33
|
+
* How many named reads one custom section may declare. Its reads are asked together, one request each, so this
|
|
34
|
+
* bounds the fan-out of a single paint (the server runs one active connection per process); the section draws one
|
|
35
|
+
* skeleton until all are in, so more reads never shift the layout. Four was short of a real section (a list, its
|
|
36
|
+
* neighbours and a few tables to look names up in); eight keeps a paint at a handful of queries.
|
|
37
|
+
*/
|
|
38
|
+
export const MAX_CUSTOM_READS = 8;
|
|
39
|
+
/** The keys `component()` writes. */
|
|
40
|
+
const COMPONENT_KEYS = ['id', 'module', 'kind', 'props'];
|
|
41
|
+
/** How many columns a custom list presentation reads beside the keys. */
|
|
42
|
+
const MAX_CUSTOM_LIST_SHOW = 32;
|
|
43
|
+
/**
|
|
44
|
+
* How many aggregate reads (`figures`) one custom section may declare. Each is one breakdown, asked with the paint's
|
|
45
|
+
* other breakdowns in a single request (breakdownBatch.ts), so the bound is on the work one section adds to it.
|
|
46
|
+
*/
|
|
47
|
+
export const MAX_CUSTOM_FIGURES = 8;
|
|
48
|
+
/** The keys a declared read of rows takes, on a page and on a dashboard. */
|
|
49
|
+
export const PAGE_READ_KEYS = ['from', 'whose', 'query', 'show', 'sort', 'limit'];
|
|
50
|
+
export const DASH_READ_KEYS = ['from', 'query', 'show', 'sort', 'limit', 'over'];
|
|
51
|
+
/** The keys a declared aggregate read takes, on a page and on a dashboard. */
|
|
52
|
+
const PAGE_TOTAL_KEYS = ['from', 'measure', 'by', 'whose', 'query', 'limit'];
|
|
53
|
+
const DASH_TOTAL_KEYS = ['from', 'measure', 'by', 'query', 'over', 'limit'];
|
|
54
|
+
/** What a total measures: the breakdown grammar's aggregates over one column of the resource (count takes none). */
|
|
55
|
+
const TOTAL_FUNCTIONS = ['count', 'sum', 'avg', 'min', 'max'];
|
|
56
|
+
const TOTAL_MEASURE = /^(count|(?:sum|avg|min|max)\s+[A-Za-z_][A-Za-z0-9_]*)$/;
|
|
57
|
+
/** The most groups one total returns, and what it returns when it says none. */
|
|
58
|
+
const MAX_TOTAL_GROUPS = 500;
|
|
59
|
+
const DEFAULT_TOTAL_GROUPS = 100;
|
|
60
|
+
const PATH = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/;
|
|
61
|
+
const NAME = /^[A-Za-z][A-Za-z0-9_]{0,39}$/;
|
|
62
|
+
/** Whether a value is a component declaration: what a display rule or a section names in place of its own words. */
|
|
63
|
+
export function isComponentDecl(value) {
|
|
64
|
+
return isRecord(value) && typeof value.module === 'string' && typeof value.id === 'string';
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A component declaration, checked in shape. The file itself — that it
|
|
68
|
+
* exists, inside the App directory, and compiles — is the loader's to judge
|
|
69
|
+
* (it knows the directory); this is what can be said of the data alone.
|
|
70
|
+
*/
|
|
71
|
+
export function parseComponentDecl(raw, at, expected) {
|
|
72
|
+
if (!isRecord(raw))
|
|
73
|
+
throw new Error(`${at} is not a component — declare it with component('id', { module: './widgets/Thing.tsx' }).`);
|
|
74
|
+
allowKeys(raw, COMPONENT_KEYS, `${at} (a component)`);
|
|
75
|
+
const id = raw.id;
|
|
76
|
+
if (typeof id !== 'string' || !COMPONENT_ID.test(id)) {
|
|
77
|
+
throw new Error(`${at} has a component id ${JSON.stringify(id)}: lowercase letters, digits and hyphens, starting with a letter, at most 48 characters.`);
|
|
78
|
+
}
|
|
79
|
+
const module = raw.module;
|
|
80
|
+
if (typeof module !== 'string' ||
|
|
81
|
+
!module.startsWith('./') ||
|
|
82
|
+
module.includes('\\') ||
|
|
83
|
+
module.split('/').some((part) => part === '..' || part === '') ||
|
|
84
|
+
!COMPONENT_EXTENSIONS.some((ext) => module.endsWith(ext))) {
|
|
85
|
+
throw new Error(`${at}: the component "${id}" names the module ${JSON.stringify(module)}. A module is a path inside the App directory, ` +
|
|
86
|
+
`written from it — './widgets/Thing.tsx' — ending in ${COMPONENT_EXTENSIONS.join(', ')}.`);
|
|
87
|
+
}
|
|
88
|
+
const kind = raw.kind === undefined ? 'section' : raw.kind;
|
|
89
|
+
if (!COMPONENT_KINDS.includes(kind)) {
|
|
90
|
+
throw new Error(`${at}: the component "${id}" has a kind of ${JSON.stringify(kind)}. Use ${COMPONENT_KINDS.map((k) => `"${k}"`).join(' or ')}.`);
|
|
91
|
+
}
|
|
92
|
+
if (expected && kind !== expected) {
|
|
93
|
+
throw new Error(`${at} names the component "${id}", ${KIND_WORDS[kind]}. ${PLACED[expected]} takes a component of kind "${expected}": ` +
|
|
94
|
+
`component('${id}', { module, kind: '${expected}' }).`);
|
|
95
|
+
}
|
|
96
|
+
const props = raw.props === undefined ? undefined : parsePropDecls(raw.props, `${at}: the component "${id}"`);
|
|
97
|
+
return { id, module, kind: kind, ...(props ? { props } : {}) };
|
|
98
|
+
}
|
|
99
|
+
/** What each kind is, and where each is placed, for a refusal that says both. */
|
|
100
|
+
const KIND_WORDS = {
|
|
101
|
+
section: 'a section',
|
|
102
|
+
value: 'a value renderer',
|
|
103
|
+
input: 'an input',
|
|
104
|
+
list: 'a list presentation',
|
|
105
|
+
page: 'a free-form page',
|
|
106
|
+
};
|
|
107
|
+
const PLACED = {
|
|
108
|
+
section: 'A custom section',
|
|
109
|
+
value: 'A display rule',
|
|
110
|
+
input: 'An input',
|
|
111
|
+
list: 'customList()',
|
|
112
|
+
page: 'A free-form page (pages/*.page.tsx)',
|
|
113
|
+
};
|
|
114
|
+
function parsePropDecls(raw, at) {
|
|
115
|
+
if (!isRecord(raw))
|
|
116
|
+
throw new Error(`${at} has "props" that are not an object of prop.number(), prop.text(), prop.bool() or prop.choice().`);
|
|
117
|
+
const out = {};
|
|
118
|
+
for (const [name, entry] of Object.entries(raw)) {
|
|
119
|
+
const here = `${at}, prop "${name}"`;
|
|
120
|
+
if (!NAME.test(name))
|
|
121
|
+
throw new Error(`${here}: a prop's name is a word of letters, digits and underscores.`);
|
|
122
|
+
if (!isRecord(entry) || !COMPONENT_PROP_TYPES.includes(entry.type)) {
|
|
123
|
+
throw new Error(`${here} is not a prop declaration — write prop.number(), prop.text(), prop.bool() or prop.choice([...]).`);
|
|
124
|
+
}
|
|
125
|
+
const decl = entry;
|
|
126
|
+
if (decl.type === 'number') {
|
|
127
|
+
allowKeys(decl, ['type', 'default', 'min', 'max'], here);
|
|
128
|
+
for (const key of ['min', 'max']) {
|
|
129
|
+
if (decl[key] !== undefined && (typeof decl[key] !== 'number' || !Number.isFinite(decl[key])))
|
|
130
|
+
throw new Error(`${here} has a "${key}" that is not a number.`);
|
|
131
|
+
}
|
|
132
|
+
if (decl.min !== undefined && decl.max !== undefined && decl.min > decl.max)
|
|
133
|
+
throw new Error(`${here} has a "min" above its "max".`);
|
|
134
|
+
}
|
|
135
|
+
else if (decl.type === 'text') {
|
|
136
|
+
allowKeys(decl, ['type', 'default', 'max'], here);
|
|
137
|
+
if (decl.max !== undefined && (!Number.isInteger(decl.max) || decl.max < 1))
|
|
138
|
+
throw new Error(`${here} has a "max" that is not a positive whole number.`);
|
|
139
|
+
}
|
|
140
|
+
else if (decl.type === 'boolean') {
|
|
141
|
+
allowKeys(decl, ['type', 'default'], here);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
allowKeys(decl, ['type', 'options', 'default'], here);
|
|
145
|
+
if (!Array.isArray(decl.options) ||
|
|
146
|
+
!decl.options.length ||
|
|
147
|
+
decl.options.some((option) => typeof option !== 'string' || !option.trim())) {
|
|
148
|
+
throw new Error(`${here} is a choice with no "options": name its values, prop.choice(['week', 'month']).`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/* A default is a value like any other: checked against its own declaration now,
|
|
152
|
+
so a component never receives what its declaration says it cannot. */
|
|
153
|
+
if (decl.default !== undefined)
|
|
154
|
+
propValue(decl, decl.default, `${here}, its default`);
|
|
155
|
+
out[name] = { ...decl };
|
|
156
|
+
}
|
|
157
|
+
return out;
|
|
158
|
+
}
|
|
159
|
+
function propValue(decl, value, at) {
|
|
160
|
+
switch (decl.type) {
|
|
161
|
+
case 'number':
|
|
162
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
163
|
+
throw new Error(`${at} is ${JSON.stringify(value)}, not a number.`);
|
|
164
|
+
if (decl.min !== undefined && value < decl.min)
|
|
165
|
+
throw new Error(`${at} is ${value}, below its min of ${decl.min}.`);
|
|
166
|
+
if (decl.max !== undefined && value > decl.max)
|
|
167
|
+
throw new Error(`${at} is ${value}, above its max of ${decl.max}.`);
|
|
168
|
+
return value;
|
|
169
|
+
case 'text':
|
|
170
|
+
if (typeof value !== 'string')
|
|
171
|
+
throw new Error(`${at} is ${JSON.stringify(value)}, not text.`);
|
|
172
|
+
if (decl.max !== undefined && value.length > decl.max)
|
|
173
|
+
throw new Error(`${at} is longer than its max of ${decl.max} characters.`);
|
|
174
|
+
return value;
|
|
175
|
+
case 'boolean':
|
|
176
|
+
if (typeof value !== 'boolean')
|
|
177
|
+
throw new Error(`${at} is ${JSON.stringify(value)}, not true or false.`);
|
|
178
|
+
return value;
|
|
179
|
+
case 'choice':
|
|
180
|
+
if (typeof value !== 'string' || !decl.options.includes(value))
|
|
181
|
+
throw new Error(`${at} is ${JSON.stringify(value)}; it is one of ${decl.options.map((o) => `"${o}"`).join(', ')}.`);
|
|
182
|
+
return value;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The props a placement hands its component: each value checked against the
|
|
187
|
+
* component's declaration and every default filled in, so the module reads
|
|
188
|
+
* exactly the shape its types promise. A prop the declaration does not name is
|
|
189
|
+
* refused, as an unknown key is everywhere else.
|
|
190
|
+
*/
|
|
191
|
+
export function componentPropValues(decl, raw, at) {
|
|
192
|
+
if (raw !== undefined && !isRecord(raw))
|
|
193
|
+
throw new Error(`${at} has "props" that are not an object.`);
|
|
194
|
+
const given = (raw ?? {});
|
|
195
|
+
const declared = decl.props ?? {};
|
|
196
|
+
for (const name of Object.keys(given)) {
|
|
197
|
+
if (!Object.hasOwn(declared, name)) {
|
|
198
|
+
const names = Object.keys(declared);
|
|
199
|
+
throw new Error(`${at} gives the prop "${name}", which the component "${decl.id}" does not declare. ${names.length ? `It declares: ${names.join(', ')}.` : 'It declares none.'}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const out = {};
|
|
203
|
+
for (const [name, prop] of Object.entries(declared)) {
|
|
204
|
+
const value = Object.hasOwn(given, name) ? given[name] : prop.default;
|
|
205
|
+
if (value !== undefined)
|
|
206
|
+
out[name] = propValue(prop, value, `${at}, prop "${name}"`);
|
|
207
|
+
}
|
|
208
|
+
return out;
|
|
209
|
+
}
|
|
210
|
+
function readShape(raw, at, keys) {
|
|
211
|
+
if (!isRecord(raw))
|
|
212
|
+
throw new Error(`${at} is not an object like { from: 'invoice', show: ['number', 'total'] }.`);
|
|
213
|
+
allowKeys(raw, keys, at);
|
|
214
|
+
if (typeof raw.from !== 'string' || !raw.from.trim())
|
|
215
|
+
throw new Error(`${at} has no "from": the resource its rows come from.`);
|
|
216
|
+
if (!Array.isArray(raw.show) || !raw.show.length || raw.show.some((path) => typeof path !== 'string' || !PATH.test(path.trim()))) {
|
|
217
|
+
throw new Error(`${at} has no "show": the columns the component reads, label paths welcome — ['number', 'customer_id.name'].`);
|
|
218
|
+
}
|
|
219
|
+
for (const key of ['query', 'sort', 'whose', 'over']) {
|
|
220
|
+
if (raw[key] !== undefined && (typeof raw[key] !== 'string' || !raw[key].trim()))
|
|
221
|
+
throw new Error(`${at} has a "${key}" that is not a non-empty string.`);
|
|
222
|
+
}
|
|
223
|
+
if (raw.limit !== undefined && (typeof raw.limit !== 'number' || !Number.isInteger(raw.limit) || raw.limit < 1 || raw.limit > 500)) {
|
|
224
|
+
throw new Error(`${at} has a "limit" that is not a whole number from 1 to 500.`);
|
|
225
|
+
}
|
|
226
|
+
return raw;
|
|
227
|
+
}
|
|
228
|
+
function reads(raw, at, one, { key = 'rows', most = MAX_CUSTOM_READS, noun = 'reads' } = {}) {
|
|
229
|
+
if (raw === undefined)
|
|
230
|
+
return undefined;
|
|
231
|
+
if (!isRecord(raw) || !Object.keys(raw).length)
|
|
232
|
+
throw new Error(`${at} has "${key}" that are not an object of named ${noun}: { runs: { from, show } }.`);
|
|
233
|
+
const names = Object.keys(raw);
|
|
234
|
+
if (names.length > most)
|
|
235
|
+
throw new Error(`${at} declares ${names.length} ${noun}; a custom section reads at most ${most}.`);
|
|
236
|
+
return Object.fromEntries(names.map((name) => {
|
|
237
|
+
if (!NAME.test(name))
|
|
238
|
+
throw new Error(`${at}: a read's name is a word of letters, digits and underscores, like "runs"; "${name}" is not.`);
|
|
239
|
+
return [name, one(raw[name], `${at}, ${key} "${name}"`)];
|
|
240
|
+
}));
|
|
241
|
+
}
|
|
242
|
+
export function parsePageReads(raw, at) {
|
|
243
|
+
return reads(raw, at, (entry, here) => {
|
|
244
|
+
const r = readShape(entry, here, PAGE_READ_KEYS);
|
|
245
|
+
return {
|
|
246
|
+
from: r.from.trim(),
|
|
247
|
+
...(r.whose === undefined ? {} : { path: r.whose.trim() }),
|
|
248
|
+
...(r.query === undefined ? {} : { filter: r.query.trim() }),
|
|
249
|
+
columns: r.show.map((path) => path.trim()),
|
|
250
|
+
...(r.sort === undefined ? {} : { sort: r.sort.trim() }),
|
|
251
|
+
...(r.limit === undefined ? {} : { limit: r.limit }),
|
|
252
|
+
};
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
export function parseDashReads(raw, at) {
|
|
256
|
+
return reads(raw, at, (entry, here) => {
|
|
257
|
+
const r = readShape(entry, here, DASH_READ_KEYS);
|
|
258
|
+
return {
|
|
259
|
+
table: r.from.trim(),
|
|
260
|
+
...(r.query === undefined ? {} : { query: r.query.trim() }),
|
|
261
|
+
show: r.show.map((path) => path.trim()),
|
|
262
|
+
...(r.sort === undefined ? {} : { sort: r.sort.trim() }),
|
|
263
|
+
...(r.limit === undefined ? {} : { limit: r.limit }),
|
|
264
|
+
...(r.over === undefined ? {} : { over: r.over.trim() }),
|
|
265
|
+
};
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function totalShape(raw, at, keys) {
|
|
269
|
+
if (!isRecord(raw))
|
|
270
|
+
throw new Error(`${at} is not an object like { from: 'invoice', measure: 'sum total' }.`);
|
|
271
|
+
allowKeys(raw, keys, at);
|
|
272
|
+
if (typeof raw.from !== 'string' || !raw.from.trim())
|
|
273
|
+
throw new Error(`${at} has no "from": the resource it measures.`);
|
|
274
|
+
if (typeof raw.measure !== 'string' || !TOTAL_MEASURE.test(raw.measure.trim().replace(/\s+/g, ' '))) {
|
|
275
|
+
throw new Error(`${at} has no "measure": "count", or ${TOTAL_FUNCTIONS.slice(1).join(', ')} and a column — 'sum amount'.`);
|
|
276
|
+
}
|
|
277
|
+
for (const key of ['by', 'query', 'whose', 'over']) {
|
|
278
|
+
if (raw[key] !== undefined && (typeof raw[key] !== 'string' || !raw[key].trim()))
|
|
279
|
+
throw new Error(`${at} has a "${key}" that is not a non-empty string.`);
|
|
280
|
+
}
|
|
281
|
+
if (raw.limit !== undefined) {
|
|
282
|
+
if (raw.by === undefined)
|
|
283
|
+
throw new Error(`${at} has a "limit" and no "by": a figure with no groups has no groups to cut.`);
|
|
284
|
+
if (typeof raw.limit !== 'number' || !Number.isInteger(raw.limit) || raw.limit < 1 || raw.limit > MAX_TOTAL_GROUPS)
|
|
285
|
+
throw new Error(`${at} has a "limit" that is not a whole number from 1 to ${MAX_TOTAL_GROUPS}.`);
|
|
286
|
+
}
|
|
287
|
+
return { ...raw, measure: raw.measure.trim().replace(/\s+/g, ' ') };
|
|
288
|
+
}
|
|
289
|
+
const totalReads = { key: 'figures', most: MAX_CUSTOM_FIGURES, noun: 'figures' };
|
|
290
|
+
export function parsePageTotals(raw, at) {
|
|
291
|
+
return reads(raw, at, (entry, here) => {
|
|
292
|
+
const r = totalShape(entry, here, PAGE_TOTAL_KEYS);
|
|
293
|
+
const [fn, column] = r.measure.split(' ');
|
|
294
|
+
return {
|
|
295
|
+
from: r.from.trim(),
|
|
296
|
+
fn,
|
|
297
|
+
...(column === undefined ? {} : { column }),
|
|
298
|
+
...(r.by === undefined ? {} : { by: r.by.trim() }),
|
|
299
|
+
...(r.whose === undefined ? {} : { path: r.whose.trim() }),
|
|
300
|
+
...(r.query === undefined ? {} : { filter: r.query.trim() }),
|
|
301
|
+
...(r.limit === undefined ? {} : { limit: r.limit }),
|
|
302
|
+
};
|
|
303
|
+
}, totalReads);
|
|
304
|
+
}
|
|
305
|
+
export function parseDashTotals(raw, at) {
|
|
306
|
+
return reads(raw, at, (entry, here) => {
|
|
307
|
+
const r = totalShape(entry, here, DASH_TOTAL_KEYS);
|
|
308
|
+
return {
|
|
309
|
+
table: r.from.trim(),
|
|
310
|
+
measure: r.measure,
|
|
311
|
+
...(r.by === undefined ? {} : { by: r.by.trim() }),
|
|
312
|
+
...(r.query === undefined ? {} : { query: r.query.trim() }),
|
|
313
|
+
...(r.over === undefined ? {} : { over: r.over.trim() }),
|
|
314
|
+
...(r.limit === undefined ? {} : { limit: r.limit }),
|
|
315
|
+
};
|
|
316
|
+
}, totalReads);
|
|
317
|
+
}
|
|
318
|
+
/** How many groups a total with a `by` returns when it says no limit. */
|
|
319
|
+
export const groupsAsked = (limit) => limit ?? DEFAULT_TOTAL_GROUPS;
|
|
320
|
+
/** A record's own fields a page's custom section reads. */
|
|
321
|
+
export function parseRecordFields(raw, at) {
|
|
322
|
+
if (raw === undefined)
|
|
323
|
+
return undefined;
|
|
324
|
+
if (!Array.isArray(raw) || !raw.length || raw.some((path) => typeof path !== 'string' || !PATH.test(path.trim()))) {
|
|
325
|
+
throw new Error(`${at} has a "record" that is not a list of the record's fields, label paths welcome — ['status', 'customer_id.name'].`);
|
|
326
|
+
}
|
|
327
|
+
return raw.map((path) => path.trim());
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* `customList(postStream, { show: ['body', 'author_id.display_name'] })`: a
|
|
331
|
+
* list view's rows drawn by the author's component. The platform keeps the
|
|
332
|
+
* query, the tabs, the filters, the sort, the paging and the bulk actions;
|
|
333
|
+
* `show` is what the query reads beside the keys, so every row the component
|
|
334
|
+
* receives carries exactly those columns.
|
|
335
|
+
*/
|
|
336
|
+
export function parseCustomList(raw, at) {
|
|
337
|
+
allowKeys(raw, ['kind', 'component', 'show', 'props'], `${at} (a custom list)`);
|
|
338
|
+
const component = parseComponentDecl(raw.component, `${at}, "component"`, 'list');
|
|
339
|
+
const show = raw.show;
|
|
340
|
+
if (!Array.isArray(show) ||
|
|
341
|
+
!show.length ||
|
|
342
|
+
show.length > MAX_CUSTOM_LIST_SHOW ||
|
|
343
|
+
show.some((path) => typeof path !== 'string' || !PATH.test(path.trim()))) {
|
|
344
|
+
throw new Error(`${at} has no "show": the columns its component reads, one to ${MAX_CUSTOM_LIST_SHOW}, label paths welcome — ['body', 'author_id.display_name'].`);
|
|
345
|
+
}
|
|
346
|
+
const columns = show.map((path) => path.trim());
|
|
347
|
+
if (new Set(columns).size !== columns.length)
|
|
348
|
+
throw new Error(`${at} names one column twice in "show".`);
|
|
349
|
+
return { kind: 'custom', component, show: columns, props: componentPropValues(component, raw.props, at) };
|
|
350
|
+
}
|
|
351
|
+
/** The most address parameters one page keeps. */
|
|
352
|
+
const MAX_PAGE_PARAMS = 8;
|
|
353
|
+
const PARAM = /^[a-z][a-z0-9_]{0,31}$/;
|
|
354
|
+
const LOADER = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
355
|
+
const words = (raw) => Array.isArray(raw) && raw.every((name) => typeof name === 'string' && name.trim() !== '');
|
|
356
|
+
/**
|
|
357
|
+
* `definePage({ reads: ['pick_list'], commands: ['pickList'], params: ['list'], component })`:
|
|
358
|
+
* a whole page drawn by the author's component. What it reads and runs is
|
|
359
|
+
* declared, so a reader who cannot read every one of its resources is not
|
|
360
|
+
* offered it, `mistri check` holds the module to it, and authority.lock
|
|
361
|
+
* records it; its place is kept in the address by the parameters it names,
|
|
362
|
+
* so a page reached by link opens where it was. A bracketed code leads each
|
|
363
|
+
* refusal, for `mistri check` (checkProblems.ts).
|
|
364
|
+
*/
|
|
365
|
+
export function parsePage(raw, at) {
|
|
366
|
+
const component = parseComponentDecl(raw.component, `${at}, "component"`, 'page');
|
|
367
|
+
const reads = raw.reads;
|
|
368
|
+
if (!words(reads) || !reads.length) {
|
|
369
|
+
throw new Error(`[page-reads] ${at} has no "reads": the resources the page reads — reads: ['pick_list', 'order_line']. A page reads nothing it does not declare.`);
|
|
370
|
+
}
|
|
371
|
+
const commands = raw.commands === undefined ? [] : raw.commands;
|
|
372
|
+
if (!words(commands))
|
|
373
|
+
throw new Error(`[page-commands] ${at} has "commands" that are not a list of command names: commands: ['pickList'].`);
|
|
374
|
+
const params = raw.params === undefined ? [] : raw.params;
|
|
375
|
+
if (!Array.isArray(params) ||
|
|
376
|
+
params.length > MAX_PAGE_PARAMS ||
|
|
377
|
+
params.some((name) => typeof name !== 'string' || !PARAM.test(name)) ||
|
|
378
|
+
params.includes('period')) {
|
|
379
|
+
throw new Error(`[page-params] ${at} has "params" that are not up to ${MAX_PAGE_PARAMS} lowercase words, like params: ['list']; "period" is a dashboard's.`);
|
|
380
|
+
}
|
|
381
|
+
if (raw.loader !== undefined && (typeof raw.loader !== 'string' || !LOADER.test(raw.loader))) {
|
|
382
|
+
throw new Error(`[page-loader] ${at} has a "loader" that is not a loader's name, as the commands module's defineLoaders() registers it.`);
|
|
383
|
+
}
|
|
384
|
+
return {
|
|
385
|
+
component,
|
|
386
|
+
reads: [...new Set(reads.map((name) => name.trim()))],
|
|
387
|
+
commands: [...new Set(commands.map((name) => name.trim()))],
|
|
388
|
+
params: [...new Set(params)],
|
|
389
|
+
...(raw.loader === undefined ? {} : { loader: raw.loader }),
|
|
390
|
+
props: componentPropValues(component, raw.props, at),
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* `inputs: { color: colorPicker }`: a component standing in a form's field —
|
|
395
|
+
* a resource's column in its edit and New forms, or a command's input in an
|
|
396
|
+
* action's or a signed-in form's command form. It draws the control and
|
|
397
|
+
* hands back a value; what the value must be is still the form's rules and
|
|
398
|
+
* the server's to judge.
|
|
399
|
+
*/
|
|
400
|
+
export function parseInputs(raw, at, options = {}) {
|
|
401
|
+
if (raw === undefined)
|
|
402
|
+
return undefined;
|
|
403
|
+
if (!isRecord(raw) || !Object.keys(raw).length)
|
|
404
|
+
throw new Error(`${at} has "inputs" that are not an object of field → input component: { color: colorPicker }.`);
|
|
405
|
+
/* A command's input inside a group is named by its path, `trade.vin`: in a repeating group, every row's. */
|
|
406
|
+
const named = options.paths ? /^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*$/ : /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
407
|
+
return Object.fromEntries(Object.entries(raw).map(([name, decl]) => {
|
|
408
|
+
if (!named.test(name))
|
|
409
|
+
throw new Error(`${at}, "inputs": "${name}" is not a field's name${options.paths ? ' or a path into a group (trade.vin)' : ''}.`);
|
|
410
|
+
return [name, parseComponentDecl(decl, `${at}, inputs "${name}"`, 'input')];
|
|
411
|
+
}));
|
|
412
|
+
}
|
|
413
|
+
/** A command's input by its name or its path through groups (`trade.vin`), or undefined; a group itself is not one, nor are lines (their grid is the platform's). */
|
|
414
|
+
export function commandInputAt(fields, path) {
|
|
415
|
+
const [head, ...rest] = path.split('.');
|
|
416
|
+
const field = fields.find((candidate) => candidate.name === head);
|
|
417
|
+
if (!field)
|
|
418
|
+
return undefined;
|
|
419
|
+
if (!rest.length)
|
|
420
|
+
return field.type === 'group' || field.type === 'lines' ? undefined : field;
|
|
421
|
+
return field.type === 'group' && field.fields ? commandInputAt(field.fields, rest.join('.')) : undefined;
|
|
422
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { PageDef, PageSection, SectionWidth } from './pageModel.js';
|
|
2
|
+
/** What a page's `document` takes. `label` names it (the verb on its record, its heading on paper); `description` is
|
|
3
|
+
the sender's lines under the letterhead's name. */
|
|
4
|
+
export declare const DOCUMENT_KEYS: readonly ['label', 'number', 'size', 'description'];
|
|
5
|
+
/** Sheet sizes: ISO A4, or US Letter. */
|
|
6
|
+
declare const DOCUMENT_SIZES: readonly ['a4', 'letter'];
|
|
7
|
+
export type DocumentSize = (typeof DOCUMENT_SIZES)[number];
|
|
8
|
+
export interface PageDocument {
|
|
9
|
+
/** "Invoice", "Packing slip", "Payslip": the verb on the record, and the sheet's heading. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** A field path of the base whose value is the document's number. Absent: the record's own name. */
|
|
12
|
+
number?: string;
|
|
13
|
+
/** Absent: the paper of the App's locale — Letter in North America and the Philippines, A4 elsewhere. */
|
|
14
|
+
size?: DocumentSize;
|
|
15
|
+
/** The sender's lines under the letterhead's name: an address, a registration. Newlines are kept. */
|
|
16
|
+
description?: string;
|
|
17
|
+
}
|
|
18
|
+
/** A page's document, as one page body states it. */
|
|
19
|
+
export declare function parseDocument(raw: unknown, at: string): PageDocument;
|
|
20
|
+
/**
|
|
21
|
+
* What a document's sections may be, refused section by section: paper has no
|
|
22
|
+
* aside, no tabs and nothing to operate, and a list on it is every line — a
|
|
23
|
+
* table whose header repeats on each sheet — never a gallery, a card or a
|
|
24
|
+
* page of rows. Its lists read every line, up to DOCUMENT_LINES, unless the
|
|
25
|
+
* author says fewer.
|
|
26
|
+
*/
|
|
27
|
+
export declare function documentSections(sections: readonly PageSection[], at: string): PageSection[];
|
|
28
|
+
/** The sheet a document is printed on: its own `size`, else the paper the App's (or tenant's) locale buys. */
|
|
29
|
+
export declare function paperSize(document: Pick<PageDocument, 'size'>, locale: string | undefined): DocumentSize;
|
|
30
|
+
/** Whether a page is a document rather than a screen. */
|
|
31
|
+
export declare const isDocument: (page: {
|
|
32
|
+
document?: unknown;
|
|
33
|
+
}) => boolean;
|
|
34
|
+
/**
|
|
35
|
+
* A document's key is the last segment of its record's address, where a record
|
|
36
|
+
* page's tab is said: `/orders/12/invoice`. A tab of the same word on a page
|
|
37
|
+
* over the same table would be two things at one address, and a record's page
|
|
38
|
+
* never opens through a document.
|
|
39
|
+
*/
|
|
40
|
+
export declare function documentProblems(pages: readonly PageDef[], pageOf: Readonly<Record<string, string | undefined>>, tabWord: (token: string) => string, where: string): string[];
|
|
41
|
+
/** The share of a 12-column sheet a section's width takes, as the page's grid says it. */
|
|
42
|
+
export declare const SHEET_SPAN: Readonly<Record<SectionWidth, number>>;
|
|
43
|
+
export {};
|