@lssm/lib.contracts 1.11.1 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_virtual/rolldown_runtime.js +1 -0
- package/dist/app-config/app-config.feature.js +1 -0
- package/dist/app-config/contracts.js +1 -1
- package/dist/app-config/docs/app-config.docblock.js +220 -0
- package/dist/app-config/events.js +1 -1
- package/dist/app-config/index.js +1 -1
- package/dist/app-config/lifecycle-contracts.js +1 -1
- package/dist/capabilities/docs/capabilities.docblock.js +1 -0
- package/dist/contract-registry/index.js +1 -0
- package/dist/contract-registry/schemas.js +1 -0
- package/dist/contract-registry/types.js +0 -0
- package/dist/data-views/docs/data-views.docblock.js +1 -0
- package/dist/docs/PUBLISHING.docblock.js +76 -0
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +350 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/meta.docs.js +13 -0
- package/dist/docs/presentations.js +1 -0
- package/dist/docs/registry.js +1 -0
- package/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +383 -0
- package/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +68 -0
- package/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +140 -0
- package/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +86 -0
- package/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +1 -0
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +58 -0
- package/dist/docs/tech/contracts/README.docblock.js +1 -0
- package/dist/docs/tech/contracts/create-subscription.docblock.js +1 -0
- package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +180 -0
- package/dist/docs/tech/contracts/migrations.docblock.js +1 -0
- package/dist/docs/tech/contracts/openapi-export.docblock.js +38 -0
- package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +62 -0
- package/dist/docs/tech/contracts/overlays.docblock.js +68 -0
- package/dist/docs/tech/contracts/tests.docblock.js +132 -0
- package/dist/docs/tech/contracts/themes.docblock.js +1 -0
- package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +106 -0
- package/dist/docs/tech/lifecycle-stage-system.docblock.js +213 -0
- package/dist/docs/tech/llm/llm-integration.docblock.js +289 -0
- package/dist/docs/tech/mcp-endpoints.docblock.js +1 -0
- package/dist/docs/tech/presentation-runtime.docblock.js +1 -0
- package/dist/docs/tech/schema/README.docblock.js +262 -0
- package/dist/docs/tech/studio/learning-events.docblock.js +1 -0
- package/dist/docs/tech/studio/learning-journeys.docblock.js +57 -0
- package/dist/docs/tech/studio/platform-admin-panel.docblock.js +63 -0
- package/dist/docs/tech/studio/project-access-teams.docblock.js +36 -0
- package/dist/docs/tech/studio/project-routing.docblock.js +1 -0
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +20 -0
- package/dist/docs/tech/studio/team-invitations.docblock.js +65 -0
- package/dist/docs/tech/studio/workspace-ops.docblock.js +1 -0
- package/dist/docs/tech/studio/workspaces.docblock.js +41 -0
- package/dist/docs/tech/telemetry-ingest.docblock.js +122 -0
- package/dist/docs/tech/templates/runtime.docblock.js +1 -0
- package/dist/docs/tech/vscode-extension.docblock.js +68 -0
- package/dist/docs/tech/workflows/overview.docblock.js +1 -0
- package/dist/docs/tech-contracts.docs.js +76 -0
- package/dist/docs/types.js +0 -0
- package/dist/events.js +1 -1
- package/dist/experiments/docs/experiments.docblock.js +128 -0
- package/dist/forms/docs/forms.docblock.js +1 -0
- package/dist/index.js +1 -1
- package/dist/install.js +1 -1
- package/dist/integrations/contracts.js +1 -1
- package/dist/integrations/docs/integrations.docblock.js +1 -0
- package/dist/integrations/index.js +1 -1
- package/dist/integrations/openbanking/contracts/accounts.js +1 -1
- package/dist/integrations/openbanking/contracts/balances.js +1 -1
- package/dist/integrations/openbanking/contracts/index.js +1 -1
- package/dist/integrations/openbanking/contracts/transactions.js +1 -1
- package/dist/integrations/openbanking/models.js +1 -1
- package/dist/integrations/openbanking/openbanking.feature.js +1 -0
- package/dist/integrations/providers/impls/index.js +1 -1
- package/dist/integrations/providers/impls/provider-factory.js +1 -1
- package/dist/integrations/providers/index.js +1 -1
- package/dist/integrations/providers/registry.js +1 -0
- package/dist/integrations/secrets/aws-secret-manager.js +1 -0
- package/dist/integrations/secrets/gcp-secret-manager.js +1 -1
- package/dist/integrations/secrets/index.js +1 -1
- package/dist/integrations/secrets/scaleway-secret-manager.js +1 -0
- package/dist/jobs/define-job.js +1 -0
- package/dist/jobs/gcp-cloud-tasks.js +1 -1
- package/dist/jobs/gcp-pubsub.js +1 -1
- package/dist/jobs/handlers/index.js +1 -1
- package/dist/jobs/handlers/ping-handler.js +1 -0
- package/dist/jobs/index.js +1 -1
- package/dist/jobs/memory-queue.js +1 -1
- package/dist/jobs/queue.js +1 -0
- package/dist/jobs/scaleway-sqs-queue.js +1 -0
- package/dist/knowledge/contracts.js +1 -1
- package/dist/knowledge/docs/knowledge.docblock.js +138 -0
- package/dist/llm/exporters.js +8 -0
- package/dist/llm/index.js +1 -0
- package/dist/llm/prompts.js +220 -0
- package/dist/llm/types.js +0 -0
- package/dist/node_modules/@pothos/plugin-complexity/esm/calculate-complexity.js +1 -0
- package/dist/node_modules/@pothos/plugin-complexity/esm/defaults.js +1 -0
- package/dist/node_modules/@pothos/plugin-complexity/esm/index.js +1 -0
- package/dist/node_modules/@pothos/plugin-complexity/esm/types.js +1 -0
- package/dist/node_modules/@pothos/plugin-complexity/esm/util.js +1 -0
- package/dist/node_modules/@pothos/plugin-complexity/esm/validator.js +1 -0
- package/dist/node_modules/@pothos/plugin-dataloader/esm/field-builder.js +1 -0
- package/dist/node_modules/@pothos/plugin-dataloader/esm/index.js +1 -0
- package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/index.js +1 -0
- package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/interface.js +1 -0
- package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/node.js +1 -0
- package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/object.js +1 -0
- package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/union.js +1 -0
- package/dist/node_modules/@pothos/plugin-dataloader/esm/schema-builder.js +1 -0
- package/dist/node_modules/@pothos/plugin-dataloader/esm/util.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/connection-helpers.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/field-builder.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/index.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/interface-ref.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/model-loader.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/node-ref.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/object-ref.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/prisma-field-builder.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/schema-builder.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/types.js +0 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/cursors.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/datamodel.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/deep-equal.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/description.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/get-client.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/loader-map.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/map-query.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/relation-map.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/selections.js +1 -0
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/usage.js +1 -0
- package/dist/node_modules/@pothos/plugin-tracing/esm/index.js +1 -0
- package/dist/node_modules/@pothos/plugin-tracing/esm/util.js +1 -0
- package/dist/node_modules/dataloader/index.js +7 -0
- package/dist/node_modules/graphql/error/GraphQLError.js +5 -0
- package/dist/node_modules/graphql/error/index.js +1 -0
- package/dist/node_modules/graphql/error/locatedError.js +1 -0
- package/dist/node_modules/graphql/error/syntaxError.js +1 -0
- package/dist/node_modules/graphql/execution/collectFields.js +1 -0
- package/dist/node_modules/graphql/execution/execute.js +1 -0
- package/dist/node_modules/graphql/execution/index.js +1 -0
- package/dist/node_modules/graphql/execution/mapAsyncIterator.js +1 -0
- package/dist/node_modules/graphql/execution/subscribe.js +1 -0
- package/dist/node_modules/graphql/execution/values.js +1 -0
- package/dist/node_modules/graphql/graphql.js +1 -0
- package/dist/node_modules/graphql/index.js +1 -0
- package/dist/node_modules/graphql/jsutils/Path.js +1 -0
- package/dist/node_modules/graphql/jsutils/devAssert.js +1 -0
- package/dist/node_modules/graphql/jsutils/didYouMean.js +1 -0
- package/dist/node_modules/graphql/jsutils/groupBy.js +1 -0
- package/dist/node_modules/graphql/jsutils/identityFunc.js +1 -0
- package/dist/node_modules/graphql/jsutils/inspect.js +1 -0
- package/dist/node_modules/graphql/jsutils/instanceOf.js +12 -0
- package/dist/node_modules/graphql/jsutils/invariant.js +1 -0
- package/dist/node_modules/graphql/jsutils/isAsyncIterable.js +1 -0
- package/dist/node_modules/graphql/jsutils/isIterableObject.js +1 -0
- package/dist/node_modules/graphql/jsutils/isObjectLike.js +1 -0
- package/dist/node_modules/graphql/jsutils/isPromise.js +1 -0
- package/dist/node_modules/graphql/jsutils/keyMap.js +1 -0
- package/dist/node_modules/graphql/jsutils/keyValMap.js +1 -0
- package/dist/node_modules/graphql/jsutils/mapValue.js +1 -0
- package/dist/node_modules/graphql/jsutils/memoize3.js +1 -0
- package/dist/node_modules/graphql/jsutils/naturalCompare.js +1 -0
- package/dist/node_modules/graphql/jsutils/printPathArray.js +1 -0
- package/dist/node_modules/graphql/jsutils/promiseForObject.js +1 -0
- package/dist/node_modules/graphql/jsutils/promiseReduce.js +1 -0
- package/dist/node_modules/graphql/jsutils/suggestionList.js +1 -0
- package/dist/node_modules/graphql/jsutils/toError.js +1 -0
- package/dist/node_modules/graphql/jsutils/toObjMap.js +1 -0
- package/dist/node_modules/graphql/language/ast.js +1 -0
- package/dist/node_modules/graphql/language/blockString.js +3 -0
- package/dist/node_modules/graphql/language/characterClasses.js +1 -0
- package/dist/node_modules/graphql/language/directiveLocation.js +1 -0
- package/dist/node_modules/graphql/language/index.js +1 -0
- package/dist/node_modules/graphql/language/kinds.js +1 -0
- package/dist/node_modules/graphql/language/lexer.js +3 -0
- package/dist/node_modules/graphql/language/location.js +1 -0
- package/dist/node_modules/graphql/language/parser.js +1 -0
- package/dist/node_modules/graphql/language/predicates.js +1 -0
- package/dist/node_modules/graphql/language/printLocation.js +2 -0
- package/dist/node_modules/graphql/language/printString.js +1 -0
- package/dist/node_modules/graphql/language/printer.js +34 -0
- package/dist/node_modules/graphql/language/schemaCoordinateLexer.js +1 -0
- package/dist/node_modules/graphql/language/source.js +1 -0
- package/dist/node_modules/graphql/language/tokenKind.js +1 -0
- package/dist/node_modules/graphql/language/visitor.js +1 -0
- package/dist/node_modules/graphql/type/assertName.js +1 -0
- package/dist/node_modules/graphql/type/definition.js +1 -0
- package/dist/node_modules/graphql/type/directives.js +1 -0
- package/dist/node_modules/graphql/type/index.js +1 -0
- package/dist/node_modules/graphql/type/introspection.js +3 -0
- package/dist/node_modules/graphql/type/scalars.js +1 -0
- package/dist/node_modules/graphql/type/schema.js +1 -0
- package/dist/node_modules/graphql/type/validate.js +3 -0
- package/dist/node_modules/graphql/utilities/TypeInfo.js +1 -0
- package/dist/node_modules/graphql/utilities/assertValidName.js +1 -0
- package/dist/node_modules/graphql/utilities/astFromValue.js +1 -0
- package/dist/node_modules/graphql/utilities/buildASTSchema.js +1 -0
- package/dist/node_modules/graphql/utilities/buildClientSchema.js +1 -0
- package/dist/node_modules/graphql/utilities/coerceInputValue.js +1 -0
- package/dist/node_modules/graphql/utilities/concatAST.js +1 -0
- package/dist/node_modules/graphql/utilities/extendSchema.js +1 -0
- package/dist/node_modules/graphql/utilities/findBreakingChanges.js +1 -0
- package/dist/node_modules/graphql/utilities/getIntrospectionQuery.js +107 -0
- package/dist/node_modules/graphql/utilities/getOperationAST.js +1 -0
- package/dist/node_modules/graphql/utilities/getOperationRootType.js +1 -0
- package/dist/node_modules/graphql/utilities/index.js +1 -0
- package/dist/node_modules/graphql/utilities/introspectionFromSchema.js +1 -0
- package/dist/node_modules/graphql/utilities/lexicographicSortSchema.js +1 -0
- package/dist/node_modules/graphql/utilities/printSchema.js +13 -0
- package/dist/node_modules/graphql/utilities/resolveSchemaCoordinate.js +1 -0
- package/dist/node_modules/graphql/utilities/separateOperations.js +1 -0
- package/dist/node_modules/graphql/utilities/sortValueNode.js +1 -0
- package/dist/node_modules/graphql/utilities/stripIgnoredCharacters.js +1 -0
- package/dist/node_modules/graphql/utilities/typeComparators.js +1 -0
- package/dist/node_modules/graphql/utilities/typeFromAST.js +1 -0
- package/dist/node_modules/graphql/utilities/valueFromAST.js +1 -0
- package/dist/node_modules/graphql/utilities/valueFromASTUntyped.js +1 -0
- package/dist/node_modules/graphql/validation/ValidationContext.js +1 -0
- package/dist/node_modules/graphql/validation/index.js +1 -0
- package/dist/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/KnownDirectivesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/KnownTypeNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/MaxIntrospectionDepthRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/ScalarLeafsRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js +1 -0
- package/dist/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +1 -0
- package/dist/node_modules/graphql/validation/specifiedRules.js +1 -0
- package/dist/node_modules/graphql/validation/validate.js +5 -0
- package/dist/node_modules/graphql/version.js +1 -0
- package/dist/onboarding-base.js +1 -1
- package/dist/openapi.js +1 -0
- package/dist/openbanking/docs/openbanking.docblock.js +109 -0
- package/dist/policy/docs/policy.docblock.js +1 -0
- package/dist/presentations/docs/presentations-conventions.docblock.js +8 -0
- package/dist/presentations.js +1 -1
- package/dist/presentations.v2.js +7 -1
- package/dist/prompt.js +1 -1
- package/dist/promptRegistry.js +1 -1
- package/dist/regenerator/docs/regenerator.docblock.js +184 -0
- package/dist/registry.js +1 -1
- package/dist/resources.js +1 -1
- package/dist/schema-to-markdown.js +10 -0
- package/dist/server/graphql-pothos.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/mcp/createMcpServer.js +1 -0
- package/dist/server/mcp/mcpTypes.js +0 -0
- package/dist/server/mcp/registerPresentations.js +1 -0
- package/dist/server/mcp/registerPrompts.js +3 -0
- package/dist/server/mcp/registerResources.js +1 -0
- package/dist/server/mcp/registerTools.js +1 -0
- package/dist/server/provider-mcp.js +1 -1
- package/dist/telemetry/docs/telemetry.docblock.js +139 -0
- package/package.json +353 -193
- package/dist/app-config/branding.d.ts +0 -55
- package/dist/app-config/contracts.d.ts +0 -244
- package/dist/app-config/events.d.ts +0 -122
- package/dist/app-config/index.d.ts +0 -8
- package/dist/app-config/lifecycle-contracts.d.ts +0 -382
- package/dist/app-config/lifecycle.d.ts +0 -27
- package/dist/app-config/runtime.d.ts +0 -114
- package/dist/app-config/spec.d.ts +0 -175
- package/dist/app-config/validation.d.ts +0 -47
- package/dist/capabilities/openbanking.d.ts +0 -9
- package/dist/capabilities.d.ts +0 -45
- package/dist/client/index.d.ts +0 -6
- package/dist/client/react/drivers/rn-reusables.d.ts +0 -22
- package/dist/client/react/drivers/shadcn.d.ts +0 -12
- package/dist/client/react/feature-render.d.ts +0 -20
- package/dist/client/react/form-render.d.ts +0 -91
- package/dist/client/react/index.d.ts +0 -5
- package/dist/contracts-adapter-hydration.d.ts +0 -15
- package/dist/contracts-adapter-input.d.ts +0 -10
- package/dist/data-views/query-generator.d.ts +0 -39
- package/dist/data-views/runtime.d.ts +0 -26
- package/dist/data-views.d.ts +0 -131
- package/dist/events.d.ts +0 -44
- package/dist/experiments/evaluator.d.ts +0 -37
- package/dist/experiments/spec-resolver.d.ts +0 -16
- package/dist/experiments/spec.d.ts +0 -89
- package/dist/features.d.ts +0 -87
- package/dist/forms.d.ts +0 -258
- package/dist/graphql-federation/dist/index.js +0 -1
- package/dist/index.d.ts +0 -130
- package/dist/install.d.ts +0 -76
- package/dist/integrations/binding.d.ts +0 -17
- package/dist/integrations/connection.d.ts +0 -51
- package/dist/integrations/contracts.d.ts +0 -435
- package/dist/integrations/health.d.ts +0 -21
- package/dist/integrations/index.d.ts +0 -53
- package/dist/integrations/openbanking/contracts/accounts.d.ts +0 -287
- package/dist/integrations/openbanking/contracts/balances.d.ts +0 -163
- package/dist/integrations/openbanking/contracts/index.d.ts +0 -9
- package/dist/integrations/openbanking/contracts/transactions.d.ts +0 -211
- package/dist/integrations/openbanking/guards.d.ts +0 -12
- package/dist/integrations/openbanking/models.d.ts +0 -228
- package/dist/integrations/openbanking/telemetry.d.ts +0 -15
- package/dist/integrations/providers/calendar.d.ts +0 -78
- package/dist/integrations/providers/elevenlabs.d.ts +0 -7
- package/dist/integrations/providers/email.d.ts +0 -86
- package/dist/integrations/providers/embedding.d.ts +0 -24
- package/dist/integrations/providers/gcs-storage.d.ts +0 -7
- package/dist/integrations/providers/gmail.d.ts +0 -7
- package/dist/integrations/providers/google-calendar.d.ts +0 -7
- package/dist/integrations/providers/impls/elevenlabs-voice.d.ts +0 -20
- package/dist/integrations/providers/impls/gcs-storage.d.ts +0 -24
- package/dist/integrations/providers/impls/gmail-inbound.d.ts +0 -26
- package/dist/integrations/providers/impls/gmail-outbound.d.ts +0 -18
- package/dist/integrations/providers/impls/google-calendar.d.ts +0 -23
- package/dist/integrations/providers/impls/index.d.ts +0 -15
- package/dist/integrations/providers/impls/mistral-embedding.d.ts +0 -23
- package/dist/integrations/providers/impls/mistral-llm.d.ts +0 -31
- package/dist/integrations/providers/impls/postmark-email.d.ts +0 -19
- package/dist/integrations/providers/impls/powens-client.d.ts +0 -124
- package/dist/integrations/providers/impls/powens-openbanking.d.ts +0 -27
- package/dist/integrations/providers/impls/provider-factory.d.ts +0 -26
- package/dist/integrations/providers/impls/qdrant-vector.d.ts +0 -24
- package/dist/integrations/providers/impls/stripe-payments.d.ts +0 -28
- package/dist/integrations/providers/impls/twilio-sms.d.ts +0 -20
- package/dist/integrations/providers/index.d.ts +0 -36
- package/dist/integrations/providers/llm.d.ts +0 -82
- package/dist/integrations/providers/mistral.d.ts +0 -7
- package/dist/integrations/providers/openbanking.d.ts +0 -128
- package/dist/integrations/providers/payments.d.ts +0 -109
- package/dist/integrations/providers/postmark.d.ts +0 -7
- package/dist/integrations/providers/powens.d.ts +0 -7
- package/dist/integrations/providers/qdrant.d.ts +0 -7
- package/dist/integrations/providers/sms.d.ts +0 -34
- package/dist/integrations/providers/storage.d.ts +0 -60
- package/dist/integrations/providers/stripe.d.ts +0 -7
- package/dist/integrations/providers/twilio-sms.d.ts +0 -7
- package/dist/integrations/providers/vector-store.d.ts +0 -43
- package/dist/integrations/providers/voice.d.ts +0 -34
- package/dist/integrations/runtime.d.ts +0 -99
- package/dist/integrations/secrets/env-secret-provider.d.ts +0 -31
- package/dist/integrations/secrets/gcp-secret-manager.d.ts +0 -32
- package/dist/integrations/secrets/index.d.ts +0 -5
- package/dist/integrations/secrets/manager.d.ts +0 -47
- package/dist/integrations/secrets/provider.d.ts +0 -52
- package/dist/integrations/spec.d.ts +0 -79
- package/dist/jobs/gcp-cloud-tasks.d.ts +0 -41
- package/dist/jobs/gcp-pubsub.d.ts +0 -25
- package/dist/jobs/handlers/gmail-sync-handler.d.ts +0 -9
- package/dist/jobs/handlers/index.d.ts +0 -3
- package/dist/jobs/handlers/storage-document-handler.d.ts +0 -12
- package/dist/jobs/index.d.ts +0 -7
- package/dist/jobs/memory-queue.d.ts +0 -18
- package/dist/jobs/queue.d.ts +0 -26
- package/dist/jsonschema.d.ts +0 -26
- package/dist/knowledge/binding.d.ts +0 -25
- package/dist/knowledge/contracts.d.ts +0 -316
- package/dist/knowledge/index.d.ts +0 -10
- package/dist/knowledge/ingestion/document-processor.d.ts +0 -24
- package/dist/knowledge/ingestion/embedding-service.d.ts +0 -12
- package/dist/knowledge/ingestion/gmail-adapter.d.ts +0 -18
- package/dist/knowledge/ingestion/index.d.ts +0 -6
- package/dist/knowledge/ingestion/storage-adapter.d.ts +0 -15
- package/dist/knowledge/ingestion/vector-indexer.d.ts +0 -18
- package/dist/knowledge/query/index.d.ts +0 -2
- package/dist/knowledge/query/service.d.ts +0 -29
- package/dist/knowledge/runtime.d.ts +0 -32
- package/dist/knowledge/source.d.ts +0 -32
- package/dist/knowledge/spaces/email-threads.d.ts +0 -7
- package/dist/knowledge/spaces/financial-docs.d.ts +0 -7
- package/dist/knowledge/spaces/financial-overview.d.ts +0 -7
- package/dist/knowledge/spaces/index.d.ts +0 -7
- package/dist/knowledge/spaces/product-canon.d.ts +0 -7
- package/dist/knowledge/spaces/support-faq.d.ts +0 -7
- package/dist/knowledge/spaces/uploaded-docs.d.ts +0 -7
- package/dist/knowledge/spec.d.ts +0 -52
- package/dist/markdown.d.ts +0 -21
- package/dist/migrations.d.ts +0 -52
- package/dist/onboarding-base.d.ts +0 -137
- package/dist/ownership.d.ts +0 -75
- package/dist/policy/engine.d.ts +0 -39
- package/dist/policy/opa-adapter.d.ts +0 -45
- package/dist/policy/spec.d.ts +0 -114
- package/dist/presentations.backcompat.d.ts +0 -7
- package/dist/presentations.d.ts +0 -96
- package/dist/presentations.v2.d.ts +0 -95
- package/dist/prompt.d.ts +0 -60
- package/dist/promptRegistry.d.ts +0 -15
- package/dist/regenerator/adapters.d.ts +0 -19
- package/dist/regenerator/executor.d.ts +0 -70
- package/dist/regenerator/index.d.ts +0 -7
- package/dist/regenerator/service.d.ts +0 -33
- package/dist/regenerator/sinks.d.ts +0 -26
- package/dist/regenerator/types.d.ts +0 -107
- package/dist/regenerator/utils.d.ts +0 -9
- package/dist/registry.d.ts +0 -72
- package/dist/resources.d.ts +0 -64
- package/dist/schema/dist/EnumType.js +0 -1
- package/dist/schema/dist/FieldType.js +0 -1
- package/dist/schema/dist/ScalarTypeEnum.js +0 -1
- package/dist/schema/dist/SchemaModel.js +0 -1
- package/dist/schema/dist/index.js +0 -1
- package/dist/server/graphql-pothos.d.ts +0 -31
- package/dist/server/graphql-schema-export.d.ts +0 -6
- package/dist/server/graphql-schema-export.js +0 -1
- package/dist/server/index.d.ts +0 -9
- package/dist/server/provider-mcp.d.ts +0 -51
- package/dist/server/rest-elysia.d.ts +0 -40
- package/dist/server/rest-express.d.ts +0 -16
- package/dist/server/rest-generic.d.ts +0 -32
- package/dist/server/rest-next-app.d.ts +0 -35
- package/dist/server/rest-next-mcp.d.ts +0 -11
- package/dist/server/rest-next-pages.d.ts +0 -9
- package/dist/spec.d.ts +0 -171
- package/dist/telemetry/anomaly.d.ts +0 -27
- package/dist/telemetry/index.d.ts +0 -4
- package/dist/telemetry/spec.d.ts +0 -98
- package/dist/telemetry/tracker.d.ts +0 -51
- package/dist/tests/index.d.ts +0 -3
- package/dist/tests/runner.d.ts +0 -43
- package/dist/tests/spec.d.ts +0 -89
- package/dist/themes.d.ts +0 -55
- package/dist/translations/catalog.d.ts +0 -28
- package/dist/translations/tenant.d.ts +0 -15
- package/dist/types/all.d.ts +0 -60
- package/dist/types.d.ts +0 -88
- package/dist/workflow/adapters/db-adapter.d.ts +0 -34
- package/dist/workflow/adapters/file-adapter.d.ts +0 -14
- package/dist/workflow/adapters/index.d.ts +0 -4
- package/dist/workflow/adapters/memory-store.d.ts +0 -18
- package/dist/workflow/expression.d.ts +0 -9
- package/dist/workflow/index.d.ts +0 -10
- package/dist/workflow/runner.d.ts +0 -74
- package/dist/workflow/sla-monitor.d.ts +0 -20
- package/dist/workflow/spec.d.ts +0 -99
- package/dist/workflow/state.d.ts +0 -35
- package/dist/workflow/validation.d.ts +0 -28
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.auth.better-auth-nextjs`,title:`Better Auth + Next.js integration (ContractSpec)`,summary:`How ContractSpec wires Better Auth into Next.js (server config, client singleton, and proxy cookie-only redirects).`,kind:`reference`,visibility:`public`,route:`/docs/tech/auth/better-auth-nextjs`,tags:[`auth`,`better-auth`,`nextjs`,`cookies`,`proxy`,`hmr`],body:`# Better Auth + Next.js integration (ContractSpec)
|
|
2
|
+
|
|
3
|
+
This repo uses Better Auth as the primary auth layer (sessions, organizations, teams, API keys, and OAuth).
|
|
4
|
+
|
|
5
|
+
## Server config (Better Auth)
|
|
6
|
+
|
|
7
|
+
- Source: \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
|
|
8
|
+
- Important: \`nextCookies()\` must be the **last** plugin in the Better Auth plugin list so \`Set-Cookie\` is applied correctly in Next.js environments.
|
|
9
|
+
|
|
10
|
+
## Better Auth Admin plugin
|
|
11
|
+
|
|
12
|
+
ContractSpec Studio enables the Better Auth **Admin plugin** to support platform-admin user operations (list users, impersonation, etc.).
|
|
13
|
+
|
|
14
|
+
- Server: \`admin()\` plugin in \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
|
|
15
|
+
- Client: \`adminClient()\` in \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\`
|
|
16
|
+
|
|
17
|
+
### PLATFORM_ADMIN ⇒ Better Auth admin role
|
|
18
|
+
|
|
19
|
+
Better Auth Admin endpoints authorize via \`user.role\`. ContractSpec enforces an org-driven rule:
|
|
20
|
+
|
|
21
|
+
- If the **active organization** has \`type = PLATFORM_ADMIN\`, the signed-in user is ensured to have \`User.role\` containing \`admin\`.
|
|
22
|
+
- This is applied in the session creation hook and re-checked in \`assertsPlatformAdmin()\`.
|
|
23
|
+
|
|
24
|
+
This keeps admin enablement deterministic and avoids manual role backfills.
|
|
25
|
+
|
|
26
|
+
## Client config (React web + Expo)
|
|
27
|
+
|
|
28
|
+
To avoid duplicate background refresh/polling loops in dev (Fast Refresh/HMR), the Better Auth client is implemented as a singleton cached on \`globalThis\`.
|
|
29
|
+
|
|
30
|
+
- Web client: \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\`
|
|
31
|
+
- Native client: \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.native.ts\`
|
|
32
|
+
|
|
33
|
+
Import guidance:
|
|
34
|
+
|
|
35
|
+
- If you only need the context/hook, prefer importing from \`@lssm/bundle.contractspec-studio/presentation/providers/auth\`.
|
|
36
|
+
- If you explicitly need the Better Auth client instance (e.g. admin impersonation, direct API calls), import from \`@lssm/bundle.contractspec-studio/presentation/providers/auth/client\`.
|
|
37
|
+
|
|
38
|
+
## Public routes (login / signup)
|
|
39
|
+
|
|
40
|
+
Public auth pages should avoid eager \`authClient\` initialization.
|
|
41
|
+
|
|
42
|
+
Pattern used:
|
|
43
|
+
|
|
44
|
+
- In the submit handler, dynamically import \`@lssm/bundle.contractspec-studio/presentation/providers/auth/index.web\` and call \`authClient.signIn.*\` / \`authClient.signUp.*\`.
|
|
45
|
+
|
|
46
|
+
This prevents session refresh behavior from starting just because a public page rendered.
|
|
47
|
+
|
|
48
|
+
## Next.js proxy auth (web-landing)
|
|
49
|
+
|
|
50
|
+
The Next.js proxy/middleware is used for **redirect decisions only**. It must not perform DB-backed session reads on every request.
|
|
51
|
+
|
|
52
|
+
- Source: \`packages/apps/web-landing/src/proxy.ts\`
|
|
53
|
+
- Approach: cookie-only checks via Better Auth cookies helpers:
|
|
54
|
+
- \`getSessionCookie(request)\`
|
|
55
|
+
- \`getCookieCache(request)\`
|
|
56
|
+
|
|
57
|
+
These checks are intentionally optimistic and should only gate routing. Full authorization must still be enforced on server-side actions/routes and GraphQL resolvers.
|
|
58
|
+
`}];e(t);export{t as tech_auth_better_auth_nextjs_DocBlocks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.contracts.README`,title:`Contracts: Specs, Registry, Handlers, Adapters`,summary:"- `packages/lssm/libs/contracts` defines the contracts core (SpecRegistry, ContractSpec, install helpers, REST/MCP adapters).",kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/README`,tags:[`tech`,`contracts`,`README`],body:"## Contracts: Specs, Registry, Handlers, Adapters\n\n### What lives where\n\n- `packages/lssm/libs/contracts` defines the contracts core (SpecRegistry, ContractSpec, install helpers, REST/MCP adapters).\n- `packages/lssm/libs/schema` defines the schema dictionary (`SchemaModel`, `FieldType`) used to describe I/O once and map to multiple targets (zod, GraphQL, JSON Schema).\n- App adapters (e.g. GraphQL) live close to the app. Example: `packages/hcircle/apps/api-coliving/src/graphql/contracts-adapter.ts`.\n\n### npm distribution\n\n- `@lssm/lib.contracts` (root) keeps the legacy \\\"everything\\\" surface for backward compatibility.\n- `@lssm/lib.contracts/client` exposes only browser-safe helpers (React renderers, client SDK, drivers). Import from this entry when bundling for the web or React Native to avoid dragging server adapters.\n- `@lssm/lib.contracts/server` covers HTTP/MCP adapters, registries, integrations, and other Node-only helpers.\n- `@lssm/lib.contracts/types` exports the runtime handler context utilities, while `@lssm/lib.contracts/types/all` re-exports every type alias/interface across the package via `export type` so consumers can import a single module for typings without shipping runtime code.\n- `@lssm/lib.schema`, `@lssm/lib.design-system`, `@lssm/lib.ui-kit`, `@lssm/lib.ui-kit-web`, `@lssm/lib.accessibility`, and the presentation runtime packages are published to npm alongside contracts; prefer the scoped packages to keep tree-shaking intact.\n- Bundlers with conditional exports should resolve subpaths first; keep root imports for server-only code paths.\n\n### Core concepts\n\n- **ContractSpec**: immutable description of an operation.\n - `meta`: `{ name, version, kind: 'query' | 'command' }`\n - `io`: `{ input: SchemaModel | zod schema, output: SchemaModel | zod schema }`\n - `policy`: `{ auth?: {...}, rateLimit?: {...}, flags?: string[] }`\n - `transport.gql.field?`: explicit GraphQL field name (otherwise derived via `defaultGqlField`).\n- **SpecRegistry**: registry of specs + handlers. Use `installOp(reg, spec, handler)` to attach a handler.\n- **Handler**: `(ctx, input) => Promise<output>` implementing the operation.\n- **CapabilitySpec**: canonical capability declaration stored in `src/capabilities.ts`. Tracks `meta` (`{ key, version, kind, title, description, domain, owners, tags, stability }`), `provides` surfaces (`operation`, `event`, `workflow`, `presentation`, `resource`), and `requires` which other capabilities must be present. Enforced during `installFeature`.\n- **PolicySpec**: declarative policy rules (`src/policy/spec.ts`) covering ABAC/ReBAC, consent + rate limit requirements, field-level controls, and PII guidance. `PolicyEngine` evaluates refs, while `OPAPolicyAdapter` lets OPA override/augment runtime decisions.\n- **TelemetrySpec**: analytics definitions (`src/telemetry/spec.ts`) describing event semantics, privacy level, retention, sampling, and anomaly detection. `TelemetryTracker` handles redaction/sampling, `TelemetryAnomalyMonitor` raises alerts, and specs integrate with contracts/workflows via `ctx.telemetry`.\n- **TestSpec**: declarative scenario definitions in `src/tests/spec.ts`. `TestRunner` executes fixtures/actions/assertions against a `SpecRegistry`, and the CLI (`contractspec test`) wraps the runner for automation.\n- **ExperimentSpec**: experiment definitions (`src/experiments/spec.ts`) describing variants, allocation strategies, and success metrics. `ExperimentEvaluator` assigns variants (random/sticky/targeted) and integrates with Policy/Telemetry for safe experimentation.\n- **AppBlueprintSpec / TenantAppConfig**: global blueprints and per-tenant overrides (`src/app-config/spec.ts`). `resolveAppConfig()` merges the two into a `ResolvedAppConfig`, while `composeAppConfig()` hydrates the merged view against registries and reports missing references for safe rollout.\n- **RegeneratorService**: background daemon (`src/regenerator/service.ts`) that consumes telemetry/error/behavior signals, evaluates regeneration rules, and produces `SpecChangeProposal`s for Studio review.\n- **DataViewSpec**: declarative data presentation layer in `src/data-views.ts`. Describes entity projections (`fields`, `filters`, `actions`) with `view.kind` (`list`, `table`, `detail`, `grid`), ties to query operations via `source.primary`, and exposes optional presentation-based empty/error states.\n- **ThemeSpec**: design token + component variant definitions in `src/themes.ts`. Supports inheritance (`extends`), tenant/user overrides, and component-specific variant metadata for the design system.\n- **MigrationSpec**: schema/data migration descriptors (`src/migrations.ts`) with ordered step plans, dependency tracking, and pre/post checks to support automated database/content migrations.\n- **WorkflowSpec**: typed definition of multi-step workflows living in `src/workflow/spec.ts`. `WorkflowRegistry` stores versioned specs, and `validateWorkflowSpec()` (in `src/workflow/validation.ts`) checks graph integrity, step references, and reachability.\n\n### Lifecycle\n\n1. Define the spec (I/O via `SchemaModel` or zod) in a vertical lib (e.g. `contracts-coliving`).\n2. Register it: `installOp(registry, spec, handler)` within the app/service.\n3. Expose it via an adapter (REST, GraphQL, MCP). Each adapter maps the I/O to its transport and enforces policy.\n4. Validate at runtime: parse `input` before executing, parse `output` before returning.\n\n### Adapters\n\n- **REST**: see `packages/lssm/libs/contracts/src/server/rest-*`. Binds routes, validates request/response, maps errors/policies.\n- **MCP**: see `packages/lssm/libs/contracts/src/server/provider-mcp.ts` (standalone MCP server) and `packages/lssm/libs/contracts/src/server/rest-next-mcp.ts` (MCP over Next.js route). Provides tools/resources/prompts.\n - Tools + resources are registered from Zod schemas.\n - Resource templates are keyed by full `ResourceMeta.uriTemplate` (e.g. `docs://list`, `docs://doc/{id}`), so multiple templates can share a scheme (`docs://*`) without collisions.\n- **GraphQL (Pothos)**: see `packages/lssm/libs/contracts/src/server/graphql-pothos.ts`. Adds Query/Mutation fields by transforming contract I/O to GraphQL types.\n\n### GraphQL adapter behaviour (summary)\n\n- Field naming: `spec.transport.gql.field` or `<name_with_dots>_v<version>`.\n- Input/Output types from `SchemaModel` (preferred) or fallback zod introspection.\n- Scalars: String/Int/Float/Boolean/Date/JSON; Objects/Arrays/Enums; unions for outputs; input unions => JSON.\n- Policy: auth gate checks GraphQL context; optional feature flag gating.\n- Complexity & tracing: attaches hints and records timings; log includes `{ specName, version }`.\n\n#### Returns mapping and hydration\n\n- `spec.transport.gql.returns` can declare the GraphQL return wrapper: e.g. `\"Spot\"` or `[Spot]`. If omitted, the adapter infers from `io.output` (SchemaModel) or `resourceRef.graphQLType`.\n- Resource outputs: when `io.output` is a `resourceRef(...)` or `transport.gql.resource` is set, the adapter will optionally hydrate via a `ResourceRegistry` using `contracts-adapter-hydration.ts`:\n - Grammar is parsed with `parseReturns()`.\n - Entities are resolved via `hydrateResourceIfNeeded(resources, result, { template, varName, returns })` after handler execution.\n\n### Resource outputs\n\n- Declare resource outputs using `resourceRef(uriTemplate, opts)`.\n- `opts.varName` (default `id`) selects the identifier field returned by the handler for URI substitution.\n- `opts.graphQLType` is the GraphQL return type name (e.g., `Spot`) or list form (e.g., `[Spot]`).\n- `opts.many: true` indicates the handler returns an array of resources. The handler type becomes an array of items that include the identifier field.\n\nExample:\n\n```ts\nio: {\n input: ListThingsInput,\n output: resourceRef('myapp://thing/{id}', { graphQLType: '[Thing]', many: true }),\n}\n```\n\nHandler return (simplified): `{ id: string | number }[]`.\n\n### Errors\n\n- Validation errors → transport 400/GraphQL UserInputError.\n- Policy/auth errors → 401/403 or GraphQL ForbiddenError.\n- Handler errors → mapped to transport error with safe message.\n\n### Versioning & naming\n\n- Keep `meta.version` monotonic. Clients should pin to a versioned field/key.\n- Avoid renaming existing fields; add new fields with new versions.\n\n### Ownership metadata (OwnerShipMeta)\n\nAll contracts, events, features, and presentations reference a shared ownership schema (source of truth in `packages/lssm/libs/contracts/src/ownership.ts`).\n\n- Required fields: `title`, `description`, `domain`, `owners[]`, `tags[]`, `stability`.\n- Curated enums: the library exports suggested constants for owners and tags; free-form strings are still allowed for forward-compatibility.\n- Operations (`spec.ts`): `meta` requires `stability`, `owners`, and `tags` alongside `name`, `version`, `kind`, `description`, `goal`, and `context`.\n- Presentations V2: `meta` is a partial of ownership plus `description`.\n- Events: may specify `ownership` (recommended) for discoverability and docs.\n\n### Quick start\n\n```ts\n// app bootstrap\nconst reg = new SpecRegistry();\ninstallOp(reg, BeginSignupSpec, beginSignupHandler);\nregisterContractsOnBuilder(gqlSchemaBuilder, reg); // GraphQL\n// or: createRestRouter(reg) // REST\n```\n"}];e(t);export{t as tech_contracts_README_DocBlocks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.contracts.create-subscription`,title:`Subscriptions via Better Auth Stripe`,summary:`This app uses Better Auth's Stripe plugin for subscription management.`,kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/create-subscription`,tags:[`tech`,`contracts`,`create-subscription`],body:"### Subscriptions via Better Auth Stripe\n\nThis app uses Better Auth's Stripe plugin for subscription management.\n\nKey endpoints:\n\n- `/api/auth/[...all]` – Better Auth server\n- `/api/auth/stripe/webhook` – Stripe webhook handled by Better Auth\n\nClient usage (org mode):\n\n```ts\nimport { subscription } from '@/lib/auth-client';\n\nawait subscription.upgrade({\n plan: 'core',\n annual: true,\n referenceId: activeOrganization?.id,\n successUrl: '/dashboard',\n cancelUrl: '/pricing',\n});\n```\n\nPlans are configured in `src/lib/auth.ts` referencing env-provided price IDs. See Better Auth Stripe docs: [plugins: Stripe](`https://better-auth.com/docs/plugins/stripe.mdx`) and [Using with organizations](`https://www.better-auth.com/docs/plugins/stripe#using-with-organizations`).\n\nLanding pricing UX\n\n- Components: `SectionEyebrow`, `PriceBadge`, `FeatureList`, `PriceCard`\n- Sections: `PricingSection`, `StoryPricingBenefits`\n- Canonical pricing source: `src/lib/pricing/config.ts`\n\nTrial period\n\n- Le plan « Essentiel » inclut une période d’essai gratuite de 30 jours.\n- Config côté auth: `freeTrial: { days: 30 }` dans `src/lib/auth.ts` (Better Auth Stripe plugin).\n- Config côté pricing: `trial: { days: 30 }` dans `src/lib/pricing/config.ts`.\n\nDashboard badges\n\n- Le `Tableau de bord` affiche des badges d’état d’abonnement:\n - « Essai · se termine le JJ/MM/AAAA » lorsque l’essai est en cours\n - « Abonnement actif » lorsque l’abonnement est actif\n - « Annulé · fin au terme de la période » lorsque la résiliation est planifiée\n- Composant: `components/dashboard/DashboardPage/molecules/Header.tsx`\n- Source des états: hook `useProfileBillingPage()` (`components/profile/ProfileBillingPage/hooks/useProfileBillingPage.tsx`)\n"}];e(t);export{t as tech_contracts_create_subscription_DocBlocks};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.contracts.graphql-typed-outputs`,title:`GraphQL Typed Outputs for Contracts`,summary:"Improved `@lssm/lib.contracts` to automatically generate proper GraphQL object types from `SchemaModel` outputs instead of defaulting to `JSON` scalar types.",kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/graphql-typed-outputs`,tags:[`tech`,`contracts`,`graphql-typed-outputs`],body:`# GraphQL Typed Outputs for Contracts
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Improved \`@lssm/lib.contracts\` to automatically generate proper GraphQL object types from \`SchemaModel\` outputs instead of defaulting to \`JSON\` scalar types.
|
|
6
|
+
|
|
7
|
+
## Problem
|
|
8
|
+
|
|
9
|
+
Previously, when GraphQL operations were defined using contracts with \`SchemaModel\` outputs, the GraphQL schema would default to returning \`JSON\` scalar types. This meant:
|
|
10
|
+
|
|
11
|
+
- GraphQL clients couldn't query specific fields
|
|
12
|
+
- No type safety for operation outputs
|
|
13
|
+
- Codegen would fail with "must have a selection of subfields" errors
|
|
14
|
+
|
|
15
|
+
## Solution
|
|
16
|
+
|
|
17
|
+
### 1. Auto-Type Registration in \`graphql-pothos.ts\`
|
|
18
|
+
|
|
19
|
+
**File**: \`packages/lssm/libs/contracts/src/server/graphql-pothos.ts\`
|
|
20
|
+
|
|
21
|
+
**Changes**:
|
|
22
|
+
|
|
23
|
+
- Scan all contract specs and collect their \`SchemaModel\` outputs
|
|
24
|
+
- Automatically register GraphQL object types for each \`SchemaModel\`
|
|
25
|
+
- Map field types from SchemaModel to proper GraphQL scalar types
|
|
26
|
+
- Update \`resolveGraphQLTypeName\` to check for \`SchemaModel\` names before defaulting to \`JSON\`
|
|
27
|
+
|
|
28
|
+
**Key Code**:
|
|
29
|
+
|
|
30
|
+
\`\`\`typescript
|
|
31
|
+
// Build a map of output types we need to register
|
|
32
|
+
const outputTypeCache = new Map<string, AnySchemaModel>();
|
|
33
|
+
for (const spec of reg.listSpecs()) {
|
|
34
|
+
const out = spec.io.output as AnySchemaModel | ResourceRefDescriptor<boolean>;
|
|
35
|
+
if (out && 'getZod' in out && typeof out.getZod === 'function') {
|
|
36
|
+
const model = out as AnySchemaModel;
|
|
37
|
+
const typeName = model.config?.name ?? 'UnknownOutput';
|
|
38
|
+
if (!outputTypeCache.has(typeName)) {
|
|
39
|
+
outputTypeCache.set(typeName, model);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Register all output types as GraphQL object types
|
|
45
|
+
for (const [typeName, model] of outputTypeCache.entries()) {
|
|
46
|
+
builder.objectType(typeName, {
|
|
47
|
+
fields: (t) => {
|
|
48
|
+
// Map each field from SchemaModel to GraphQL field
|
|
49
|
+
// ...
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
\`\`\`
|
|
54
|
+
|
|
55
|
+
### 2. Fix Contract Definitions
|
|
56
|
+
|
|
57
|
+
**File**: \`packages/hcircle/libs/contracts-coliving/src/interactions/onboarding/org/contracts.ts\`
|
|
58
|
+
|
|
59
|
+
**Changes**:
|
|
60
|
+
|
|
61
|
+
- Changed \`GetOrgOnboardingDraftSpec\` from \`defineCommand\` to \`defineQuery\` (read-only operation)
|
|
62
|
+
- Added \`defineQuery\` import
|
|
63
|
+
|
|
64
|
+
**Before**:
|
|
65
|
+
|
|
66
|
+
\`\`\`typescript
|
|
67
|
+
export const GetOrgOnboardingDraftSpec = defineCommand({
|
|
68
|
+
// ...
|
|
69
|
+
});
|
|
70
|
+
\`\`\`
|
|
71
|
+
|
|
72
|
+
**After**:
|
|
73
|
+
|
|
74
|
+
\`\`\`typescript
|
|
75
|
+
export const GetOrgOnboardingDraftSpec = defineQuery({
|
|
76
|
+
// ...
|
|
77
|
+
});
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
### 3. Update All GraphQL Queries
|
|
81
|
+
|
|
82
|
+
Updated all GraphQL operation calls to select proper subfields based on the output type:
|
|
83
|
+
|
|
84
|
+
#### Output Types and Their Fields
|
|
85
|
+
|
|
86
|
+
1. **\`CreateOrgOutput\`**:
|
|
87
|
+
- \`organizationId: ID!\`
|
|
88
|
+
- \`orgType: String!\`
|
|
89
|
+
|
|
90
|
+
2. **\`CompleteUserOnboardingOutput\`**:
|
|
91
|
+
- \`success: Boolean!\`
|
|
92
|
+
- \`userId: ID!\`
|
|
93
|
+
|
|
94
|
+
3. **\`CompleteOrgOnboardingOutput\`**:
|
|
95
|
+
- \`success: Boolean!\`
|
|
96
|
+
- \`organizationId: ID!\`
|
|
97
|
+
- \`orgType: String!\`
|
|
98
|
+
|
|
99
|
+
4. **\`OnboardingDraft\`** (from resource_ref):
|
|
100
|
+
- \`id: ID!\`
|
|
101
|
+
- \`organizationId: ID!\`
|
|
102
|
+
- \`data: JSON!\`
|
|
103
|
+
- \`createdAt: DateTime!\`
|
|
104
|
+
- \`updatedAt: DateTime!\`
|
|
105
|
+
|
|
106
|
+
5. **\`GetOnboardingDraftOutput\`**:
|
|
107
|
+
- \`id: ID\`
|
|
108
|
+
- \`organizationId: ID\`
|
|
109
|
+
- \`data: JSON\`
|
|
110
|
+
- \`createdAt: DateTime\`
|
|
111
|
+
- \`updatedAt: DateTime\`
|
|
112
|
+
|
|
113
|
+
6. **\`DeleteOnboardingDraftOutput\`**:
|
|
114
|
+
- \`ok: Boolean!\` _(note: not \`success\`)_
|
|
115
|
+
|
|
116
|
+
#### Files Updated
|
|
117
|
+
|
|
118
|
+
1. \`/packages/hcircle/apps/mobile-coliving/src/app/onboarding-org-select.tsx\`
|
|
119
|
+
2. \`/packages/hcircle/apps/mobile-coliving/src/app/onboarding-org.tsx\`
|
|
120
|
+
3. \`/packages/hcircle/apps/mobile-coliving/src/app/onboarding-user.tsx\`
|
|
121
|
+
4. \`/packages/hcircle/apps/web-coliving/src/app/onboarding/user/page.tsx\`
|
|
122
|
+
5. \`/packages/hcircle/apps/web-coliving/src/components/onboarding/OnboardingFlow.tsx\`
|
|
123
|
+
6. \`/packages/hcircle/apps/web-coliving/src/components/onboarding/OrgSelectionFlow.tsx\`
|
|
124
|
+
|
|
125
|
+
**Example Before**:
|
|
126
|
+
|
|
127
|
+
\`\`\`graphql
|
|
128
|
+
mutation CreateOrg($orgType: String!, $name: String!, $slug: String!) {
|
|
129
|
+
createOrganization(input: { orgType: $orgType, name: $name, slug: $slug })
|
|
130
|
+
}
|
|
131
|
+
\`\`\`
|
|
132
|
+
|
|
133
|
+
**Example After**:
|
|
134
|
+
|
|
135
|
+
\`\`\`graphql
|
|
136
|
+
mutation CreateOrg($orgType: String!, $name: String!, $slug: String!) {
|
|
137
|
+
createOrganization(input: { orgType: $orgType, name: $name, slug: $slug }) {
|
|
138
|
+
organizationId
|
|
139
|
+
orgType
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
\`\`\`
|
|
143
|
+
|
|
144
|
+
## Benefits
|
|
145
|
+
|
|
146
|
+
1. **Type Safety**: Full type safety for GraphQL operation outputs
|
|
147
|
+
2. **Auto-Generated Types**: No need to manually specify \`returns\` in contract transport config
|
|
148
|
+
3. **Better DX**: GraphQL clients can now query specific fields and benefit from autocomplete
|
|
149
|
+
4. **Consistency**: All \`SchemaModel\` outputs are automatically typed in GraphQL
|
|
150
|
+
5. **Backward Compatible**: Operations with explicit \`returns\` config still work as before
|
|
151
|
+
|
|
152
|
+
## Testing
|
|
153
|
+
|
|
154
|
+
All GraphQL codegen now passes:
|
|
155
|
+
|
|
156
|
+
\`\`\`bash
|
|
157
|
+
cd packages/hcircle/libs/gql-client-coliving
|
|
158
|
+
bun graphql-codegen --config codegen.ts # ✅ Success
|
|
159
|
+
\`\`\`
|
|
160
|
+
|
|
161
|
+
## Migration Guide for Other Verticals
|
|
162
|
+
|
|
163
|
+
To apply this to other verticals (e.g., Artisanos, Strit):
|
|
164
|
+
|
|
165
|
+
1. **No code changes needed** - the improved \`graphql-pothos.ts\` automatically handles all \`SchemaModel\` outputs
|
|
166
|
+
2. **Update GraphQL queries** - Add field selections to queries that previously returned \`JSON\`
|
|
167
|
+
3. **Fix query/command mismatches** - Ensure read-only operations use \`defineQuery\` instead of \`defineCommand\`
|
|
168
|
+
|
|
169
|
+
## Future Improvements
|
|
170
|
+
|
|
171
|
+
1. Add support for nested \`SchemaModel\` references (currently only supports scalar fields)
|
|
172
|
+
2. Add support for array fields of SchemaModels
|
|
173
|
+
3. Consider auto-generating field selections based on the output type to reduce boilerplate
|
|
174
|
+
|
|
175
|
+
## Related Documentation
|
|
176
|
+
|
|
177
|
+
- [Contracts README](../../packages/lssm/libs/contracts/README.md)
|
|
178
|
+
- [Onboarding System](./hcircle/IMPLEMENTATION_COMPLETE.md)
|
|
179
|
+
- [GraphQL Architecture](./graphql/architecture.md)
|
|
180
|
+
`}];e(t);export{t as tech_contracts_graphql_typed_outputs_DocBlocks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.contracts.migrations`,title:`MigrationSpec Overview`,summary:"`MigrationSpec` provides a declarative plan for schema/data/validation steps so migrations can be generated, reviewed, and executed safely by tooling. Each spec captures ownership metadata, ordered up/down steps, and optional dependency information. Runtime tooling can consume the spec to run SQL/data scripts with pre/post checks and produce audit logs.",kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/migrations`,tags:[`tech`,`contracts`,`migrations`],body:"# MigrationSpec Overview\n\n## Purpose\n\n`MigrationSpec` provides a declarative plan for schema/data/validation steps so migrations can be generated, reviewed, and executed safely by tooling. Each spec captures ownership metadata, ordered up/down steps, and optional dependency information. Runtime tooling can consume the spec to run SQL/data scripts with pre/post checks and produce audit logs.\n\n## Location\n\n- Spec + registry: `packages/libs/contracts/src/migrations.ts`\n- Tests: `packages/.../migrations.test.ts`\n\n## Schema\n\n```ts\nexport interface MigrationSpec {\n meta: MigrationMeta; // ownership metadata + { name, version }\n plan: {\n up: MigrationStep[]; // required forward plan\n down?: MigrationStep[];// optional rollback steps\n };\n dependencies?: string[]; // optional list of migration keys this depends on\n}\n```\n\n- **MigrationStep**\n - `kind`: `'schema' | 'data' | 'validation'`\n - Shared fields: `description?`, `timeoutMs?`, `retries?`, `preChecks?`, `postChecks?`\n - `schema`: `sql` string executed in transactional context\n - `data`: arbitrary `script` (e.g., JS/TS snippet, path to file, instructions)\n - `validation`: `assertion` expression verifying state (e.g., SQL returning boolean)\n- **MigrationCheck** (`preChecks`/`postChecks`)\n - `description`: human context\n - `expression`: expression or SQL snippet to evaluate before/after the step\n- **Dependencies**\n - Array of migration keys (`\"boundedContext.namespace.timestamp_slug\"`) used to ensure the registry executes prerequisites first\n\n## Registry Usage\n\n```ts\nimport { MigrationRegistry } from '@lssm/lib.contracts/migrations';\nimport { AddUsersMigration } from './migrations/core.db.2025_01_add_users';\n\nconst registry = new MigrationRegistry();\nregistry.register(AddUsersMigration);\n\nconst migration = registry.get('core.db.2025_01_add_users');\nconst all = registry.list(); // sorted by name/version\n```\n\n## Authoring Guidelines\n\n1. Name migrations with timestamped slugs (`domain.db.YYYY_MM_description`) for clarity.\n2. Capture ownership metadata (`owners`, `tags`, `stability`) so tooling can route approvals.\n3. Prefer small, reversible steps. Use `plan.down` when safe; otherwise document fallback.\n4. Use `preChecks`/`postChecks` for critical invariants (row counts, schema existence).\n5. Specify dependencies explicitly to avoid parallel execution hazards.\n6. For large data scripts, use `script` as a pointer (URL, file path) rather than embedding code directly.\n\n## Tooling Roadmap\n\nUpcoming CLI support (Phase 4 plan):\n\n- `contractspec create --type migration` (scaffolds spec skeleton)\n- `contractspec build <migration>` (generate executor harness)\n- `contractspec migrate create/up/down/status` orchestration commands\n\nThe current implementation focuses on the spec/registry foundation so downstream tooling can be layered iteratively.\n\n"}];e(t);export{t as tech_contracts_migrations_DocBlocks};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.contracts.openapi-export`,title:`OpenAPI export (OpenAPI 3.1) from SpecRegistry`,summary:`Generate a deterministic OpenAPI document from a SpecRegistry using jsonSchemaForSpec + REST transport metadata.`,kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/openapi-export`,tags:[`contracts`,`openapi`,`rest`],body:`## OpenAPI export (OpenAPI 3.1) from SpecRegistry
|
|
2
|
+
|
|
3
|
+
### Purpose
|
|
4
|
+
|
|
5
|
+
ContractSpec specs can be exported into an **OpenAPI 3.1** document for tooling (SDK generation, docs, gateways).
|
|
6
|
+
|
|
7
|
+
The export is **spec-first**:
|
|
8
|
+
|
|
9
|
+
- Uses \`jsonSchemaForSpec(spec)\` for input/output JSON Schema (from SchemaModel → zod → JSON Schema)
|
|
10
|
+
- Uses \`spec.transport.rest.method/path\` when present
|
|
11
|
+
- Falls back to deterministic defaults:
|
|
12
|
+
- Method: \`POST\` for commands, \`GET\` for queries
|
|
13
|
+
- Path: \`defaultRestPath(name, version)\` → \`/<dot/name>/v<version>\`
|
|
14
|
+
|
|
15
|
+
### Library API
|
|
16
|
+
|
|
17
|
+
- Function: \`openApiForRegistry(registry, options?)\`
|
|
18
|
+
- Location: \`@lssm/lib.contracts/openapi\`
|
|
19
|
+
|
|
20
|
+
### CLI
|
|
21
|
+
|
|
22
|
+
Export OpenAPI from a registry module:
|
|
23
|
+
|
|
24
|
+
\`\`\`bash
|
|
25
|
+
contractspec openapi --registry ./src/registry.ts --out ./openapi.json
|
|
26
|
+
\`\`\`
|
|
27
|
+
|
|
28
|
+
The registry module must export one of:
|
|
29
|
+
|
|
30
|
+
- \`registry: SpecRegistry\`
|
|
31
|
+
- \`default(): SpecRegistry | Promise<SpecRegistry>\`
|
|
32
|
+
- \`createRegistry(): SpecRegistry | Promise<SpecRegistry>\`
|
|
33
|
+
|
|
34
|
+
### Notes / limitations (current)
|
|
35
|
+
|
|
36
|
+
- Responses are generated as a basic \`200\` response (plus schemas when available).
|
|
37
|
+
- Query (GET) inputs are currently represented as a JSON request body when an input schema exists.
|
|
38
|
+
- Errors are not yet expanded into OpenAPI responses; that will be added when we standardize error envelopes.`}];e(t);export{t as tech_contracts_openapi_export_DocBlocks};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.contracts.ops-to-presentation-linking`,title:`Ops ↔ Presentation linking (V2)`,summary:`This document explains how operations (ContractSpec) are linked to Presentations (PresentationDescriptorV2) via Feature modules.`,kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/ops-to-presentation-linking`,tags:[`tech`,`contracts`,`ops-to-presentation-linking`],body:`### Ops ↔ Presentation linking (V2)
|
|
2
|
+
|
|
3
|
+
This document explains how operations (ContractSpec) are linked to Presentations (PresentationDescriptorV2) via Feature modules.
|
|
4
|
+
|
|
5
|
+
- Location: \`@lssm/lib.contracts/src/features.ts\`
|
|
6
|
+
- Field: \`FeatureModuleSpec.opToPresentation?: { op: { name; version }; pres: { name; version } }[]\`
|
|
7
|
+
- Validation: \`installFeature()\` validates that linked ops exist in \`SpecRegistry\` and linked presentations exist in the registry, and that declared targets are present.
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
|
|
11
|
+
\`\`\`ts
|
|
12
|
+
import type { SpecRegistry } from '@lssm/lib.contracts/src/registry';
|
|
13
|
+
import { FeatureRegistry, createFeatureModule } from '@lssm/lib.contracts';
|
|
14
|
+
|
|
15
|
+
export function buildFeaturesWithOps(ops: SpecRegistry) {
|
|
16
|
+
const features = new FeatureRegistry();
|
|
17
|
+
features.register(
|
|
18
|
+
createFeatureModule(
|
|
19
|
+
{
|
|
20
|
+
key: 'myapp.widgets.linkage',
|
|
21
|
+
title: 'Widgets (linked)',
|
|
22
|
+
description: 'Links create/update ops to UI presentations',
|
|
23
|
+
domain: 'widgets',
|
|
24
|
+
tags: ['widgets', 'linkage'],
|
|
25
|
+
stability: 'beta',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
operations: [
|
|
29
|
+
{ name: 'widgets.create', version: 1 },
|
|
30
|
+
{ name: 'widgets.update', version: 1 },
|
|
31
|
+
],
|
|
32
|
+
presentations: [{ name: 'myapp.widgets.editor.page', version: 1 }],
|
|
33
|
+
opToPresentation: [
|
|
34
|
+
{
|
|
35
|
+
op: { name: 'widgets.create', version: 1 },
|
|
36
|
+
pres: { name: 'myapp.widgets.editor.page', version: 1 },
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
op: { name: 'widgets.update', version: 1 },
|
|
40
|
+
pres: { name: 'myapp.widgets.editor.page', version: 1 },
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
presentationsTargets: [
|
|
44
|
+
{
|
|
45
|
+
name: 'myapp.widgets.editor.page',
|
|
46
|
+
version: 1,
|
|
47
|
+
targets: ['react', 'markdown'],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
return { features };
|
|
54
|
+
}
|
|
55
|
+
\`\`\`
|
|
56
|
+
|
|
57
|
+
Notes
|
|
58
|
+
|
|
59
|
+
- This enables traceability: the UI flow that realizes an op is discoverable via the feature catalog.
|
|
60
|
+
- Presentations can target multiple outputs (\`react\`, \`markdown\`, \`application/json\`, \`application/xml\`).
|
|
61
|
+
- Use \`renderFeaturePresentation()\` to render a descriptor to a given target with a component map.
|
|
62
|
+
`}];e(t);export{t as tech_contracts_ops_to_presentation_linking_DocBlocks};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.contracts.overlays`,title:`OverlaySpec Implementation`,summary:"OverlaySpecs allow tenants/users to adapt presentation without duplicating code. Implementation lives in `@lssm/lib.overlay-engine`.",kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/overlays`,tags:[`tech`,`contracts`,`overlays`],body:`# OverlaySpec Implementation
|
|
2
|
+
|
|
3
|
+
OverlaySpecs allow tenants/users to adapt presentation without duplicating code. Implementation lives in \`@lssm/lib.overlay-engine\`.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
\`\`\`ts
|
|
8
|
+
interface OverlaySpec {
|
|
9
|
+
overlayId: string;
|
|
10
|
+
version: string;
|
|
11
|
+
appliesTo: {
|
|
12
|
+
capability?: string;
|
|
13
|
+
workflow?: string;
|
|
14
|
+
dataView?: string;
|
|
15
|
+
presentation?: string;
|
|
16
|
+
tenantId?: string;
|
|
17
|
+
userId?: string;
|
|
18
|
+
role?: string;
|
|
19
|
+
device?: string;
|
|
20
|
+
};
|
|
21
|
+
modifications: OverlayModification[];
|
|
22
|
+
}
|
|
23
|
+
\`\`\`
|
|
24
|
+
|
|
25
|
+
Supported modifications:
|
|
26
|
+
|
|
27
|
+
- \`hideField\`
|
|
28
|
+
- \`renameLabel\`
|
|
29
|
+
- \`reorderFields\`
|
|
30
|
+
- \`setDefault\`
|
|
31
|
+
- \`addHelpText\`
|
|
32
|
+
- \`makeRequired\`
|
|
33
|
+
|
|
34
|
+
## Signing
|
|
35
|
+
|
|
36
|
+
Overlays must be signed. Use the signer helper:
|
|
37
|
+
|
|
38
|
+
\`\`\`ts
|
|
39
|
+
import { signOverlay } from '@lssm/lib.overlay-engine/signer';
|
|
40
|
+
|
|
41
|
+
const signed = await signOverlay(overlay, privateKeyPem);
|
|
42
|
+
registry.register(signed);
|
|
43
|
+
\`\`\`
|
|
44
|
+
|
|
45
|
+
Keys are stored in \`OverlaySigningKey\` (Prisma) and referenced by the \`Overlay\` model for auditing.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
`}];e(t);export{t as tech_contracts_overlays_DocBlocks};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.contracts.tests`,title:`TestSpec & TestRunner`,summary:"Use `TestSpec` to describe end-to-end scenarios for contracts and workflows. Specs live alongside your contracts and exercise the same SpecRegistry handlers the app uses.",kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/tests`,tags:[`tech`,`contracts`,`tests`],body:`## TestSpec & TestRunner
|
|
2
|
+
|
|
3
|
+
Use \`TestSpec\` to describe end-to-end scenarios for contracts and workflows. Specs live alongside your contracts and exercise the same SpecRegistry handlers the app uses.
|
|
4
|
+
|
|
5
|
+
- Types & registry: \`packages/libs/contracts/src/tests/spec.ts\`
|
|
6
|
+
- Runtime runner: \`packages/libs/contracts/src/tests/runner.ts\`
|
|
7
|
+
- CLI: \`contractspec test\`
|
|
8
|
+
|
|
9
|
+
### Structure
|
|
10
|
+
|
|
11
|
+
\`\`\`ts
|
|
12
|
+
export interface TestSpec {
|
|
13
|
+
meta: TestSpecMeta;
|
|
14
|
+
target: TestTarget; // contract or workflow
|
|
15
|
+
fixtures?: Fixture[]; // optional shared setup before each scenario
|
|
16
|
+
scenarios: TestScenario[];
|
|
17
|
+
coverage?: CoverageRequirement;
|
|
18
|
+
}
|
|
19
|
+
\`\`\`
|
|
20
|
+
|
|
21
|
+
- \`Fixture\`: run an operation before the scenario (\`operation\`, optional \`input\`)
|
|
22
|
+
- \`Action\`: operation input that the scenario exercises
|
|
23
|
+
- \`Assertion\`:
|
|
24
|
+
- \`expectOutput\` \`{ match }\` deep-equals the handler output
|
|
25
|
+
- \`expectError\` \`{ messageIncludes? }\` ensures an error was thrown
|
|
26
|
+
- \`expectEvents\` \`{ events: [{ name, version, min?, max? }] }\` checks emitted events
|
|
27
|
+
|
|
28
|
+
### Example
|
|
29
|
+
|
|
30
|
+
\`\`\`ts
|
|
31
|
+
import { defineCommand, type TestSpec } from '@lssm/lib.contracts';
|
|
32
|
+
|
|
33
|
+
export const AddNumbersSpec = defineCommand({
|
|
34
|
+
meta: { name: 'math.add', version: 1, /* … */ },
|
|
35
|
+
io: {
|
|
36
|
+
input: AddNumbersInput,
|
|
37
|
+
output: AddNumbersOutput,
|
|
38
|
+
},
|
|
39
|
+
policy: { auth: 'user' },
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const MathAddTests: TestSpec = {
|
|
43
|
+
meta: {
|
|
44
|
+
name: 'math.add.tests',
|
|
45
|
+
version: 1,
|
|
46
|
+
title: 'Math add scenarios',
|
|
47
|
+
owners: ['@team.math'],
|
|
48
|
+
tags: ['math'],
|
|
49
|
+
stability: StabilityEnum.Experimental,
|
|
50
|
+
},
|
|
51
|
+
target: { type: 'contract', operation: { name: 'math.add' } },
|
|
52
|
+
scenarios: [
|
|
53
|
+
{
|
|
54
|
+
name: 'adds positive numbers',
|
|
55
|
+
when: {
|
|
56
|
+
operation: { name: 'math.add' },
|
|
57
|
+
input: { a: 2, b: 3 },
|
|
58
|
+
},
|
|
59
|
+
then: [
|
|
60
|
+
{ type: 'expectOutput', match: { sum: 5 } },
|
|
61
|
+
{
|
|
62
|
+
type: 'expectEvents',
|
|
63
|
+
events: [{ name: 'math.sum_calculated', version: 1, min: 1 }],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
\`\`\`
|
|
70
|
+
|
|
71
|
+
### Running tests
|
|
72
|
+
|
|
73
|
+
1. Register the contract handlers in a \`SpecRegistry\`:
|
|
74
|
+
|
|
75
|
+
\`\`\`ts
|
|
76
|
+
export function createRegistry() {
|
|
77
|
+
const registry = new SpecRegistry();
|
|
78
|
+
registry.register(AddNumbersSpec);
|
|
79
|
+
registry.bind(AddNumbersSpec, addNumbersHandler);
|
|
80
|
+
return registry;
|
|
81
|
+
}
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
2. Run the CLI:
|
|
85
|
+
|
|
86
|
+
\`\`\`
|
|
87
|
+
contractspec test apps/math/tests/math.add.tests.ts \\
|
|
88
|
+
--registry apps/math/tests/registry.ts
|
|
89
|
+
\`\`\`
|
|
90
|
+
|
|
91
|
+
- The CLI loads the TestSpec, instantiates the registry (via the provided module), and executes each scenario via \`TestRunner\`.
|
|
92
|
+
- \`--json\` outputs machine-readable results.
|
|
93
|
+
|
|
94
|
+
### Programmatic usage
|
|
95
|
+
|
|
96
|
+
\`\`\`ts
|
|
97
|
+
const runner = new TestRunner({
|
|
98
|
+
registry,
|
|
99
|
+
createContext: () => ({ actor: 'user', organizationId: 'tenant-1' }),
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const result = await runner.run(MathAddTests);
|
|
103
|
+
console.log(result.passed, result.failed);
|
|
104
|
+
\`\`\`
|
|
105
|
+
|
|
106
|
+
- \`createContext\` can supply default \`HandlerCtx\` values.
|
|
107
|
+
- \`beforeEach\` / \`afterEach\` hooks let you seed databases or reset state.
|
|
108
|
+
|
|
109
|
+
### Best practices
|
|
110
|
+
|
|
111
|
+
- Keep fixtures idempotent so scenarios can run in parallel in the future.
|
|
112
|
+
- Use \`expectEvents\` to guard analytics/telemetry expectations.
|
|
113
|
+
- Add specs to \`TestRegistry\` for discovery and documentation.
|
|
114
|
+
- \`coverage\` captures desired coverage metrics (enforced by future tooling).
|
|
115
|
+
- Pair TestSpec files with CI using \`contractspec test --json\` and fail builds when \`failed > 0\`.
|
|
116
|
+
|
|
117
|
+
### Mocking with Bun's \`vi\`
|
|
118
|
+
|
|
119
|
+
- Pass a single function type to \`vi.fn<TFunction>()\` so calls retain typed arguments:
|
|
120
|
+
|
|
121
|
+
\`\`\`ts
|
|
122
|
+
const handler = vi.fn<typeof fetch>();
|
|
123
|
+
const fetchImpl: typeof fetch = ((...args) => handler(...args)) as typeof fetch;
|
|
124
|
+
Object.defineProperty(fetchImpl, 'preconnect', {
|
|
125
|
+
value: vi.fn<typeof fetch.preconnect>(),
|
|
126
|
+
});
|
|
127
|
+
\`\`\`
|
|
128
|
+
|
|
129
|
+
- When you need to inspect calls, use the typed mock (\`handler.mock.calls\`) rather than casting to \`any\`.
|
|
130
|
+
- Narrow optional request data defensively (e.g., check for headers before reading them) so tests remain type-safe under strict \`tsconfig\` settings.
|
|
131
|
+
|
|
132
|
+
`}];e(t);export{t as tech_contracts_tests_DocBlocks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.contracts.themes`,title:`ThemeSpec Overview`,summary:"`ThemeSpec` defines a structured, versioned source of truth for design tokens, component variants, and scoped overrides. Use it to describe how tenants or individual users should experience the design system without hand-maintaining ad-hoc theme files. Specs live in `@lssm/lib.contracts`, making them accessible to generators, docs, and runtime tooling.",kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/themes`,tags:[`tech`,`contracts`,`themes`],body:"# ThemeSpec Overview\n\n## Purpose\n\n`ThemeSpec` defines a structured, versioned source of truth for design tokens, component variants, and scoped overrides. Use it to describe how tenants or individual users should experience the design system without hand-maintaining ad-hoc theme files. Specs live in `@lssm/lib.contracts`, making them accessible to generators, docs, and runtime tooling.\n\n## Location\n\n- Types & registry: `packages/libs/contracts/src/themes.ts`\n- Design tokens bridge: `packages/libs/design-system/src/theme/*`\n\n## Schema\n\n```ts\nexport interface ThemeSpec {\n meta: ThemeMeta; // ownership metadata + { name, version, extends?, scopes? }\n tokens: ThemeTokens; // design tokens grouped by colors, radii, space, etc.\n components?: ComponentVariantSpec[]; // per-component variant configuration\n overrides?: ThemeOverride[]; // scoped tenant/user overrides\n}\n```\n\n- **ThemeMeta**\n - `name`: fully-qualified identifier (e.g., `design.pastel`)\n - `version`: increment when tokens/variants change in a breaking way\n - `extends?`: optional `{ name, version }` pointer to a base theme\n - `scopes?`: default scopes where the theme applies (`global`, `tenant`, `user`)\n- **ThemeTokens**\n - `colors`, `radii`, `space`, `typography`, `shadows`, `motion`\n - Each entry is a map of `{ value: T; description?: string }`\n- **ComponentVariantSpec**\n - `component`: design-system component key (e.g., `Button`, `NavMain`)\n - `variants`: map of variant names → `{ props?, tokens? }`\n- **ThemeOverride**\n - `scope`: `'global' | 'tenant' | 'user'`\n - `target`: identifier (e.g., `tenant:artisanos`, `user:123`)\n - `tokens?` / `components?`: partial token/variant overrides for the target\n\n## Registry Usage\n\n```ts\nimport { ThemeRegistry } from '@lssm/lib.contracts/themes';\nimport { PastelTheme } from './themes/design.pastel';\n\nconst themes = new ThemeRegistry();\nthemes.register(PastelTheme);\n\nconst theme = themes.get('design.pastel');\nconst tenantVariant = themes\n .get('design.pastel')\n ?.overrides?.find((o) => o.target === 'tenant:artisanos');\n```\n\nThe registry guarantees `name + version` uniqueness and exposes `list()` for discovery tooling.\n\n## Rendering\n\nThe design system consumes specs (via adapters you provide) to build runtime tokens. A simple adapter might:\n\n1. Resolve the base theme + applicable overrides.\n2. Merge token maps using `ThemeTokens`.\n3. Feed the result into `mapTokensForPlatform` in `@lssm/lib.design-system`.\n\n```ts\nimport { ThemeRegistry } from '@lssm/lib.contracts/themes';\nimport { mapTokensForPlatform } from '@lssm/lib.design-system';\n\nfunction resolveTokens(registry: ThemeRegistry, ref: ThemeRef, ctx: { tenant?: string; user?: string }) {\n const spec = registry.get(ref.name, ref.version);\n if (!spec) throw new Error('Theme not found');\n\n const tokens = deepMerge(spec.tokens, collectOverrides(spec.overrides, ctx));\n return mapTokensForPlatform(tokens);\n}\n```\n\n## Authoring Guidelines\n\n1. Keep token names aligned with the design-system defaults (`background`, `mutedForeground`, etc.).\n2. Use `extends` to create layered themes (base brand → tenant tweaks → user-level overrides).\n3. Document variants with `description` to help designers and automation understand intent.\n4. Prefer scoped overrides (`tenant:foo`) instead of duplicating the entire theme per tenant.\n5. When tokens influence multiple components, capture them in `tokens` and keep `components` for API-level variant wiring.\n\n## CLI (Future Work)\n\nThe `contractspec` CLI does not yet scaffold theme specs. Planned additions:\n\n- `contractspec create --type theme`\n- `contractspec build <theme.theme.ts>` → generate design-system adapters\n\nFor now, author specs manually and register them alongside contract bundles.\n\n"}];e(t);export{t as tech_contracts_themes_DocBlocks};
|