@wildo-ai/saas-specifications 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/_core/application-specification-family-identity.schemas.d.ts +9 -0
- package/dist/esm/_core/application-specification-family-identity.schemas.d.ts.map +1 -1
- package/dist/esm/_core/application-specification-family-identity.schemas.js +9 -0
- package/dist/esm/_core/application-specification-family-identity.schemas.js.map +1 -1
- package/dist/esm/_core/brand/brand-name-choice.d.ts +136 -0
- package/dist/esm/_core/brand/brand-name-choice.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-choice.js +193 -0
- package/dist/esm/_core/brand/brand-name-choice.js.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-generation.schemas.d.ts +108 -0
- package/dist/esm/_core/brand/brand-name-screening-generation.schemas.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-generation.schemas.js +59 -0
- package/dist/esm/_core/brand/brand-name-screening-generation.schemas.js.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-validation.d.ts +51 -0
- package/dist/esm/_core/brand/brand-name-screening-validation.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-validation.js +157 -0
- package/dist/esm/_core/brand/brand-name-screening-validation.js.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-view.d.ts +120 -0
- package/dist/esm/_core/brand/brand-name-screening-view.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-view.js +47 -0
- package/dist/esm/_core/brand/brand-name-screening-view.js.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening.family-aspects.d.ts +3 -0
- package/dist/esm/_core/brand/brand-name-screening.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening.family-aspects.js +42 -0
- package/dist/esm/_core/brand/brand-name-screening.family-aspects.js.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening.schemas.d.ts +310 -0
- package/dist/esm/_core/brand/brand-name-screening.schemas.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening.schemas.js +272 -0
- package/dist/esm/_core/brand/brand-name-screening.schemas.js.map +1 -0
- package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts +23 -0
- package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts.map +1 -1
- package/dist/esm/_core/brand/brand-snapshot.schemas.js +32 -0
- package/dist/esm/_core/brand/brand-snapshot.schemas.js.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.d.ts +10 -0
- package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts +57 -0
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js +89 -0
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.d.ts +79 -19
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.js +61 -11
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.js.map +1 -1
- package/dist/esm/_core/build-plan/build-plan.family-aspects.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan.family-aspects.js +18 -2
- package/dist/esm/_core/build-plan/build-plan.family-aspects.js.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.d.ts +28 -4
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js +53 -5
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts +24 -4
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.js +64 -4
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.js.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot.schemas.d.ts +59 -0
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot.schemas.d.ts.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot.schemas.js +64 -0
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot.schemas.js.map +1 -1
- package/dist/esm/_core/business-model-lite/pricing-plan.schemas.d.ts +3 -0
- package/dist/esm/_core/business-model-lite/pricing-plan.schemas.d.ts.map +1 -1
- package/dist/esm/_core/business-model-lite/pricing-plan.schemas.js +16 -0
- package/dist/esm/_core/business-model-lite/pricing-plan.schemas.js.map +1 -1
- package/dist/esm/_core/capability-composition/capability-composition-validation.d.ts +7 -1
- package/dist/esm/_core/capability-composition/capability-composition-validation.d.ts.map +1 -1
- package/dist/esm/_core/capability-composition/capability-composition-validation.js +34 -28
- package/dist/esm/_core/capability-composition/capability-composition-validation.js.map +1 -1
- package/dist/esm/_core/capability-composition/capability-composition.schemas.d.ts +75 -4
- package/dist/esm/_core/capability-composition/capability-composition.schemas.d.ts.map +1 -1
- package/dist/esm/_core/capability-composition/capability-composition.schemas.js +62 -4
- package/dist/esm/_core/capability-composition/capability-composition.schemas.js.map +1 -1
- package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.d.ts.map +1 -1
- package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.js +7 -0
- package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.js.map +1 -1
- package/dist/esm/_core/compliance-documents/launch-blockers.schemas.d.ts +153 -0
- package/dist/esm/_core/compliance-documents/launch-blockers.schemas.d.ts.map +1 -0
- package/dist/esm/_core/compliance-documents/launch-blockers.schemas.js +241 -0
- package/dist/esm/_core/compliance-documents/launch-blockers.schemas.js.map +1 -0
- package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.d.ts +8 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.d.ts.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.js +19 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.js.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.d.ts +61 -3
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.d.ts.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.js +73 -3
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.js.map +1 -1
- package/dist/esm/_core/experience-plan/experience-plan.family-aspects.js +1 -1
- package/dist/esm/_core/experience-plan/experience-plan.family-aspects.js.map +1 -1
- package/dist/esm/_core/experience-plan/experience-plan.schemas.d.ts.map +1 -1
- package/dist/esm/_core/experience-plan/experience-plan.schemas.js +1 -0
- package/dist/esm/_core/experience-plan/experience-plan.schemas.js.map +1 -1
- package/dist/esm/_core/family-aspects.registry.d.ts.map +1 -1
- package/dist/esm/_core/family-aspects.registry.js +2 -0
- package/dist/esm/_core/family-aspects.registry.js.map +1 -1
- package/dist/esm/_core/index.d.ts +6 -0
- package/dist/esm/_core/index.d.ts.map +1 -1
- package/dist/esm/_core/index.js +6 -0
- package/dist/esm/_core/index.js.map +1 -1
- package/dist/esm/_core/integration-plan/integration-plan.family-aspects.d.ts.map +1 -1
- package/dist/esm/_core/integration-plan/integration-plan.family-aspects.js +5 -1
- package/dist/esm/_core/integration-plan/integration-plan.family-aspects.js.map +1 -1
- package/dist/esm/_core/market/market-icp.schemas.d.ts +7 -0
- package/dist/esm/_core/market/market-icp.schemas.d.ts.map +1 -1
- package/dist/esm/_core/market/market-icp.schemas.js +7 -0
- package/dist/esm/_core/market/market-icp.schemas.js.map +1 -1
- package/dist/esm/_core/market/market-language-coverage.d.ts +62 -0
- package/dist/esm/_core/market/market-language-coverage.d.ts.map +1 -0
- package/dist/esm/_core/market/market-language-coverage.js +48 -0
- package/dist/esm/_core/market/market-language-coverage.js.map +1 -0
- package/dist/esm/_core/market/market-snapshot-validation.js +2 -2
- package/dist/esm/_core/market/market-snapshot-validation.js.map +1 -1
- package/dist/esm/application-creation/application-creator-inputs.application-creation.schemas.d.ts +63 -2
- package/dist/esm/application-creation/application-creator-inputs.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/application-creator-inputs.application-creation.schemas.js +73 -5
- package/dist/esm/application-creation/application-creator-inputs.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation/application-line.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/application-line.application-creation.schemas.js +2 -0
- package/dist/esm/application-creation/application-line.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts +28 -0
- package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/playbooks.application-creation.schemas.js +19 -1
- package/dist/esm/application-creation/playbooks.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.d.ts +1 -0
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.js +1 -0
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation.exports.d.ts +7 -0
- package/dist/esm/application-creation.exports.d.ts.map +1 -1
- package/dist/esm/application-creation.exports.js +7 -0
- package/dist/esm/application-creation.exports.js.map +1 -1
- package/dist/esm/assurance/application-risk-signals.derivations.d.ts +20 -0
- package/dist/esm/assurance/application-risk-signals.derivations.d.ts.map +1 -1
- package/dist/esm/assurance/application-risk-signals.derivations.js +81 -0
- package/dist/esm/assurance/application-risk-signals.derivations.js.map +1 -1
- package/dist/esm/assurance/governed-document-release.d.ts +9 -0
- package/dist/esm/assurance/governed-document-release.d.ts.map +1 -1
- package/dist/esm/assurance/governed-document-release.js +9 -0
- package/dist/esm/assurance/governed-document-release.js.map +1 -1
- package/dist/esm/companion-exports.d.ts +10 -1
- package/dist/esm/companion-exports.d.ts.map +1 -1
- package/dist/esm/companion-exports.js.map +1 -1
- package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.d.ts +1 -0
- package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/esm/assurance/__tests__/authority-evaluation-instant.fixture.d.ts +0 -24
- package/dist/esm/assurance/__tests__/authority-evaluation-instant.fixture.d.ts.map +0 -1
- package/dist/esm/assurance/__tests__/authority-evaluation-instant.fixture.js +0 -24
- package/dist/esm/assurance/__tests__/authority-evaluation-instant.fixture.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business-model-lite-snapshot-generation.schemas.js","sourceRoot":"","sources":["../../../../../src/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,gBAAgB,EAAkC,MAAM,wCAAwC,CAAC;AAC7K,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAE1E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,YAAY,CAAC;IACxD,yFAAyF;IAC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AAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;YAC7E,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;YACjF,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,IAAI,CAAC,uBAAuB,EAAE,CAAC;SAChH,CAAC,CAAC;KACJ,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { NonEmptyStringSchema } from '../market/market-references.schemas';\nimport { BusinessModelLiteSnapshotSchema, BusinessModelLiteSnapshotVersion, RevenueModelKind, type BusinessModelLiteSnapshot } from './business-model-lite-snapshot.schemas';\nimport { PRICING_PLAN_REF_PREFIX } from './business-model-references.schemas';\nimport { applyFamilyRefPrefix } from '../utils/family-ref-stamping';\nimport { PricingModelAxis } from './pricing-plan.schemas';\n\nconst SemanticSlugSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);\n\n/**\n * The STRICT contract a provider answers for the business-model family.\n *\n * ## Why the family schema is not this contract\n *\n * `BusinessModelLiteSnapshotSchema` is permissive on purpose — it is what a hand-authored file is\n * parsed against, and `plans: default([])` is a legitimate \"not sketched yet\" state for a human. A\n * provider handed that same schema can satisfy it with `{}`, which is the vacuity class already\n * closed on vision, roadmap, requirements and the build plan: schema-valid, validator-clean, and\n * carrying no information a reader could act on. So the generation contract requires at least one\n * plan and a classified revenue model, and stamps refs in the trusted runtime rather than asking the\n * model to produce them.\n *\n * ## Nullable rather than optional, deliberately\n *\n * Every optional field is `.nullable()` and required, matching the sibling contracts: an omitted key\n * and a considered \"there is none\" are different answers, and a provider that may simply drop a key\n * gives no way to tell them apart. The normalizer turns `null` back into absence.\n */\nexport const PricingPlanGenerationSchema = z.strictObject({\n /** Stamped into `pricing-plan-<slug>` by the runtime — the model never authors a ref. */\n slug: SemanticSlugSchema,\n name: NonEmptyStringSchema,\n /** Free prose (\"$29 / user / month\", \"contact us\") — never a parsed money type at sketch depth. */\n pricePoint: NonEmptyStringSchema.nullable(),\n billingPeriod: NonEmptyStringSchema.nullable(),\n pricingModel: z.enum(PricingModelAxis).nullable(),\n includes: NonEmptyStringSchema.nullable(),\n targetSummary: NonEmptyStringSchema.nullable(),\n /** Market ICP refs this plan is sold to. The family validator resolves them when a set is supplied. */\n targetIcpRefs: z.array(NonEmptyStringSchema),\n /** Requirement refs this plan unlocks — the traceability foundation reads to derive billing. */\n includesRequirementRefs: z.array(NonEmptyStringSchema),\n});\nexport type PricingPlanGeneration = z.infer<typeof PricingPlanGenerationSchema>;\n\nexport const BusinessModelLiteSnapshotGenerationSchema = z.strictObject({\n /**\n * Required here though optional on the family schema. An unclassified revenue model is precisely\n * the fact `bottom_up.foundation` derives the billing capability from, so a snapshot that omits it\n * costs the reader the one thing this family exists to tell them.\n */\n revenueModel: z.enum(RevenueModelKind),\n plans: z.array(PricingPlanGenerationSchema).min(1),\n}).superRefine((generated, context) => {\n // Keyed on the STAMPED form, not on the authored slug, because `applyFamilyRefPrefix` is deliberately\n // not injective: `team` and `pricing-plan-team` are two distinct slugs that both become\n // `pricing-plan-team`. Checking the slug would let that pair through and produce two plans sharing one\n // ref, which makes every `includesRequirementRefs` traceability edge pointing back at it ambiguous.\n const seen = new Set<string>();\n generated.plans.forEach((plan, index) => {\n const ref = applyFamilyRefPrefix(plan.slug, PRICING_PLAN_REF_PREFIX);\n if (seen.has(ref)) {\n context.addIssue({ code: 'custom', path: ['plans', index, 'slug'], message: `duplicate pricing-plan slug \"${plan.slug}\" (normalizes to \"${ref}\")` });\n return;\n }\n seen.add(ref);\n });\n});\nexport type BusinessModelLiteSnapshotGeneration = z.infer<typeof BusinessModelLiteSnapshotGenerationSchema>;\n\n/** Normalize strict provider output into canonical persisted application truth. */\nexport function parseBusinessModelLiteSnapshotGeneration(input: unknown): BusinessModelLiteSnapshot {\n const generated = BusinessModelLiteSnapshotGenerationSchema.parse(input);\n return BusinessModelLiteSnapshotSchema.parse({\n version: BusinessModelLiteSnapshotVersion.V1,\n revenueModel: generated.revenueModel,\n plans: generated.plans.map((plan) => ({\n ref: applyFamilyRefPrefix(plan.slug, PRICING_PLAN_REF_PREFIX),\n name: plan.name,\n ...(plan.pricePoint === null ? {} : { pricePoint: plan.pricePoint }),\n ...(plan.billingPeriod === null ? {} : { billingPeriod: plan.billingPeriod }),\n ...(plan.pricingModel === null ? {} : { pricingModel: plan.pricingModel }),\n ...(plan.includes === null ? {} : { includes: plan.includes }),\n ...(plan.targetSummary === null ? {} : { targetSummary: plan.targetSummary }),\n ...(plan.targetIcpRefs.length === 0 ? {} : { targetIcpRefs: plan.targetIcpRefs }),\n ...(plan.includesRequirementRefs.length === 0 ? {} : { includesRequirementRefs: plan.includesRequirementRefs }),\n })),\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"business-model-lite-snapshot-generation.schemas.js","sourceRoot":"","sources":["../../../../../src/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,kBAAkB,EAAE,gBAAgB,EAAkC,MAAM,wCAAwC,CAAC;AACjM,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,4BAA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AC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;YAC1E,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC9D,GAAG,CAAC,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;YAC7E,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;YACjF,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC/G,GAAG,CAAC,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;SAC9E,CAAC,CAAC;KACJ,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { NonEmptyStringSchema } from '../market/market-references.schemas';\nimport { BusinessModelLiteSnapshotSchema, BusinessModelLiteSnapshotVersion, PricingTiersStatus, RevenueModelKind, type BusinessModelLiteSnapshot } from './business-model-lite-snapshot.schemas';\nimport { PRICING_PLAN_REF_PREFIX } from './business-model-references.schemas';\nimport { applyFamilyRefPrefix } from '../utils/family-ref-stamping';\nimport { PricingModelAxis } from './pricing-plan.schemas';\n\nconst SemanticSlugSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);\n\n/**\n * The STRICT contract a provider answers for the business-model family.\n *\n * ## Why the family schema is not this contract\n *\n * `BusinessModelLiteSnapshotSchema` is permissive on purpose — it is what a hand-authored file is\n * parsed against, and `plans: default([])` is a legitimate \"not sketched yet\" state for a human. A\n * provider handed that same schema can satisfy it with `{}`, which is the vacuity class already\n * closed on vision, roadmap, requirements and the build plan: schema-valid, validator-clean, and\n * carrying no information a reader could act on. So the generation contract requires a classified\n * revenue model AND a declared `pricingTiers` status, and stamps refs in the trusted runtime rather\n * than asking the model to produce them.\n *\n * ## An empty `plans` is a statement, never a default\n *\n * This contract used to require `plans.min(1)`. That closed the vacuity hole and opened a worse one:\n * a creator who answered \"not decided yet\" left the model no honest output — it had to invent a\n * tier, and the evaluation treatment correctly refused any tier the creator did not name. Every run\n * failed, at roughly 20k tokens each (app-creation-test-004, 2026-10-01).\n *\n * The non-vacuity guarantee now comes from the STATUS rather than the count: `plans` may be empty only\n * when `pricingTiers` is `UNDECIDED`, and the status is required, so `{ revenueModel, plans: [] }`\n * still fails. Whether the declared status is TRUE of the interview is the judge's question, not the\n * schema's — a schema cannot read the creator's answers.\n *\n * The superRefine also holds `proposalBasis` to the status: present on every plan of a `PROPOSED`\n * sketch, absent on every plan of a `CREATOR_STATED` one.\n *\n * ## Nullable rather than optional, deliberately\n *\n * Every optional field is `.nullable()` and required, matching the sibling contracts: an omitted key\n * and a considered \"there is none\" are different answers, and a provider that may simply drop a key\n * gives no way to tell them apart. The normalizer turns `null` back into absence.\n */\nexport const PricingPlanGenerationSchema = z.strictObject({\n /** Stamped into `pricing-plan-<slug>` by the runtime — the model never authors a ref. */\n slug: SemanticSlugSchema,\n name: NonEmptyStringSchema,\n /** Free prose (\"$29 / user / month\", \"contact us\") — never a parsed money type at sketch depth. */\n pricePoint: NonEmptyStringSchema.nullable(),\n billingPeriod: NonEmptyStringSchema.nullable(),\n pricingModel: z.enum(PricingModelAxis).nullable(),\n includes: NonEmptyStringSchema.nullable(),\n targetSummary: NonEmptyStringSchema.nullable(),\n /** Market ICP refs this plan is sold to. The family validator resolves them when a set is supplied. */\n targetIcpRefs: z.array(NonEmptyStringSchema),\n /** Requirement refs this plan unlocks — the traceability foundation reads to derive billing. */\n includesRequirementRefs: z.array(NonEmptyStringSchema),\n /** What a PROPOSED plan was derived from; `null` on a creator-stated plan. See `PricingPlanConfig.proposalBasis`. */\n proposalBasis: NonEmptyStringSchema.nullable(),\n});\nexport type PricingPlanGeneration = z.infer<typeof PricingPlanGenerationSchema>;\n\nexport const BusinessModelLiteSnapshotGenerationSchema = z.strictObject({\n /**\n * Required here though optional on the family schema. An unclassified revenue model is precisely\n * the fact `bottom_up.foundation` derives the billing capability from, so a snapshot that omits it\n * costs the reader the one thing this family exists to tell them.\n */\n revenueModel: z.enum(RevenueModelKind),\n /**\n * Required here though optional on the family schema: it is what lets an empty `plans` be an\n * answer (\"the creator has not decided\") rather than an omission. See `PricingTiersStatus`.\n */\n pricingTiers: z.enum(PricingTiersStatus),\n plans: z.array(PricingPlanGenerationSchema),\n}).superRefine((generated, context) => {\n if (generated.pricingTiers === PricingTiersStatus.UNDECIDED) {\n if (generated.plans.length > 0) {\n context.addIssue({\n code: 'custom',\n path: ['plans'],\n message: 'pricingTiers is \"undecided\" but plans are present — an undecided sketch carries no plans; declare \"creator_stated\" or \"proposed\" instead.',\n });\n }\n } else if (generated.plans.length === 0) {\n context.addIssue({\n code: 'custom',\n path: ['plans'],\n message: `pricingTiers is \"${generated.pricingTiers}\" but no plan is present — record at least one plan, or declare \"undecided\" when the creator has not decided the tiers.`,\n });\n }\n generated.plans.forEach((plan, index) => {\n if (generated.pricingTiers === PricingTiersStatus.PROPOSED && plan.proposalBasis === null) {\n context.addIssue({ code: 'custom', path: ['plans', index, 'proposalBasis'], message: 'a proposed plan must state its proposalBasis — the ICP and requirements it was derived from.' });\n }\n if (generated.pricingTiers === PricingTiersStatus.CREATOR_STATED && plan.proposalBasis !== null) {\n context.addIssue({ code: 'custom', path: ['plans', index, 'proposalBasis'], message: 'a creator-stated plan carries no proposalBasis — a basis claims a proposal nobody asked for.' });\n }\n });\n\n // Keyed on the STAMPED form, not on the authored slug, because `applyFamilyRefPrefix` is deliberately\n // not injective: `team` and `pricing-plan-team` are two distinct slugs that both become\n // `pricing-plan-team`. Checking the slug would let that pair through and produce two plans sharing one\n // ref, which makes every `includesRequirementRefs` traceability edge pointing back at it ambiguous.\n const seen = new Set<string>();\n generated.plans.forEach((plan, index) => {\n const ref = applyFamilyRefPrefix(plan.slug, PRICING_PLAN_REF_PREFIX);\n if (seen.has(ref)) {\n context.addIssue({ code: 'custom', path: ['plans', index, 'slug'], message: `duplicate pricing-plan slug \"${plan.slug}\" (normalizes to \"${ref}\")` });\n return;\n }\n seen.add(ref);\n });\n});\nexport type BusinessModelLiteSnapshotGeneration = z.infer<typeof BusinessModelLiteSnapshotGenerationSchema>;\n\n/** Normalize strict provider output into canonical persisted application truth. */\nexport function parseBusinessModelLiteSnapshotGeneration(input: unknown): BusinessModelLiteSnapshot {\n const generated = BusinessModelLiteSnapshotGenerationSchema.parse(input);\n return BusinessModelLiteSnapshotSchema.parse({\n version: BusinessModelLiteSnapshotVersion.V1,\n revenueModel: generated.revenueModel,\n pricingTiers: generated.pricingTiers,\n plans: generated.plans.map((plan) => ({\n ref: applyFamilyRefPrefix(plan.slug, PRICING_PLAN_REF_PREFIX),\n name: plan.name,\n ...(plan.pricePoint === null ? {} : { pricePoint: plan.pricePoint }),\n ...(plan.billingPeriod === null ? {} : { billingPeriod: plan.billingPeriod }),\n ...(plan.pricingModel === null ? {} : { pricingModel: plan.pricingModel }),\n ...(plan.includes === null ? {} : { includes: plan.includes }),\n ...(plan.targetSummary === null ? {} : { targetSummary: plan.targetSummary }),\n ...(plan.targetIcpRefs.length === 0 ? {} : { targetIcpRefs: plan.targetIcpRefs }),\n ...(plan.includesRequirementRefs.length === 0 ? {} : { includesRequirementRefs: plan.includesRequirementRefs }),\n ...(plan.proposalBasis === null ? {} : { proposalBasis: plan.proposalBasis }),\n })),\n });\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BusinessModelLiteSnapshot } from './business-model-lite-snapshot.schemas';
|
|
2
2
|
/**
|
|
3
3
|
* @wildo_source:part:start business-model.snapshot.validation facet:layer:specification facet:family:business-model
|
|
4
4
|
*
|
|
@@ -15,7 +15,7 @@ import type { BusinessModelLiteSnapshot } from './business-model-lite-snapshot.s
|
|
|
15
15
|
* check for type-asserted fixtures that bypass parsing, and the fail-soft
|
|
16
16
|
* cross-family ICP / requirement ref resolution.
|
|
17
17
|
*
|
|
18
|
-
* Rule table —
|
|
18
|
+
* Rule table — 10 kinds (scaffold depth, Phase J1 — deeper pricing / revenue
|
|
19
19
|
* analysis is Phase J2):
|
|
20
20
|
*
|
|
21
21
|
* | Kind | Severity | Trigger |
|
|
@@ -23,7 +23,9 @@ import type { BusinessModelLiteSnapshot } from './business-model-lite-snapshot.s
|
|
|
23
23
|
* | `INVALID_REF_FORMAT` | ERROR | A plan ref fails the shared pattern (single source of truth with the Zod schema). Defence in depth for type-asserted fixtures. |
|
|
24
24
|
* | `DUPLICATE_REF` | ERROR | Two plans share a ref — the collection silently loses one entity to last-wins indexing. |
|
|
25
25
|
* | `DUPLICATE_CROSS_REF` | WARN | The same target/include-ref is listed more than once on ONE plan's cross-ref list — the repeat is noise the catalog silently dedupes. Intra-snapshot, so it runs UNCONDITIONALLY (no external set needed) — each cross-ref list is its own namespace. |
|
|
26
|
-
* | `NO_PLANS` | WARN | `plans` empty — the business model sketches no pricing. |
|
|
26
|
+
* | `NO_PLANS` | WARN | `plans` empty and nobody has said why — the business model sketches no pricing. SILENT when `pricingTiers` is `UNDECIDED`: there the emptiness is the creator's recorded answer, not owed work. |
|
|
27
|
+
* | `PRICING_TIERS_CONTRADICT_PLANS` | ERROR | The declared `pricingTiers` disagrees with `plans`: `undecided` with plans present, or `creator_stated` / `proposed` with none. |
|
|
28
|
+
* | `PROPOSAL_BASIS_MISMATCH` | ERROR | A plan of a `proposed` sketch has no `proposalBasis`, or a plan of a `creator_stated` one has one. Read through `resolvePricingTiersStatus`, so a hand-authored file with plans and no status counts as stated. |
|
|
27
29
|
* | `NO_REVENUE_MODEL` | WARN | `plans` are authored but the product-level `revenueModel` is unset — the pricing sketch is classified per-plan (`PricingModelAxis`) but the product's headline revenue model is undeclared. GATED on `plans.length > 0`: an empty snapshot is already fully described by `NO_PLANS`, so this fires only for the sharper "sketched pricing, forgot the revenue model" state (no redundant double-warn on `{}`). |
|
|
28
30
|
* | `STALE_AUTHORED` | WARN | Any plan's `authored.lastAuthoredAt + reviewCadence < now`. No check when `reviewCadence` is undefined or `AS_NEEDED`. |
|
|
29
31
|
* | `UNKNOWN_ICP_REF` | ERROR | A `targetIcpRefs` entry does not resolve in `options.availableIcpRefs`. SKIPPED (fail-soft) when no set is passed — the families are decoupled and the catalog resolves refs. |
|
|
@@ -61,8 +63,26 @@ export declare enum BusinessModelLiteSnapshotIssueKind {
|
|
|
61
63
|
* NOT a duplicate.
|
|
62
64
|
*/
|
|
63
65
|
DUPLICATE_CROSS_REF = "duplicate_cross_ref",
|
|
64
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* `plans` empty and no recorded reason — the business model sketches no
|
|
68
|
+
* pricing (WARN). Not raised when `pricingTiers` is `UNDECIDED`: a considered
|
|
69
|
+
* "not decided yet" is an answer, and warning on it would teach the reader to
|
|
70
|
+
* skim the warning that means work is owed.
|
|
71
|
+
*/
|
|
65
72
|
NO_PLANS = "no_plans",
|
|
73
|
+
/**
|
|
74
|
+
* The declared `pricingTiers` and the `plans` collection contradict each
|
|
75
|
+
* other — `undecided` while plans are present, or `creator_stated` /
|
|
76
|
+
* `proposed` with no plan. ERROR: one of the two statements is false, and a
|
|
77
|
+
* reader cannot tell which.
|
|
78
|
+
*/
|
|
79
|
+
PRICING_TIERS_CONTRADICT_PLANS = "pricing_tiers_contradict_plans",
|
|
80
|
+
/**
|
|
81
|
+
* A plan's `proposalBasis` disagrees with where the tiers came from — missing
|
|
82
|
+
* on a plan of a `proposed` sketch (a proposal nobody can check), or present
|
|
83
|
+
* on a plan the creator stated (a proposal nobody made). ERROR.
|
|
84
|
+
*/
|
|
85
|
+
PROPOSAL_BASIS_MISMATCH = "proposal_basis_mismatch",
|
|
66
86
|
/**
|
|
67
87
|
* `plans` are authored but the product-level `revenueModel` is unset. The
|
|
68
88
|
* pricing sketch classifies HOW each plan scales (`PricingModelAxis`) but
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business-model-lite-snapshot-validation.d.ts","sourceRoot":"","sources":["../../../../../src/_core/business-model-lite/business-model-lite-snapshot-validation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"business-model-lite-snapshot-validation.d.ts","sourceRoot":"","sources":["../../../../../src/_core/business-model-lite/business-model-lite-snapshot-validation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiD,KAAK,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAEvI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,oBAAY,kCAAkC;IAC5C;;;;;OAKG;IACH,kBAAkB,uBAAuB;IACzC;;;OAGG;IACH,aAAa,kBAAkB;IAC/B;;;;;;;;OAQG;IACH,mBAAmB,wBAAwB;IAC3C;;;;;OAKG;IACH,QAAQ,aAAa;IACrB;;;;;OAKG;IACH,8BAA8B,mCAAmC;IACjE;;;;OAIG;IACH,uBAAuB,4BAA4B;IACnD;;;;;;;;OAQG;IACH,gBAAgB,qBAAqB;IACrC,iGAAiG;IACjG,cAAc,mBAAmB;IACjC;;;;OAIG;IACH,eAAe,oBAAoB;IACnC;;;;OAIG;IACH,uBAAuB,4BAA4B;CACpD;AAED,oBAAY,sCAAsC;IAChD,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,kCAAkC,CAAC;IACzC,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,sCAAsC,CAAC;CAClD;AAED,MAAM,WAAW,yCAAyC;IACxD,gDAAgD;IAChD,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,8BAA8B,EAAE,CAAC;CAC1C;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,wCAAwC;IACvD,8FAA8F;IAC9F,GAAG,CAAC,EAAE,IAAI,CAAC;IACX;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAChD;AAeD,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,yBAAyB,EACnC,OAAO,CAAC,EAAE,wCAAwC,GACjD,yCAAyC,CAe3C;AA0MD,gEAAgE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReviewCadence } from '../market/market-authored-metadata.schemas.js';
|
|
2
2
|
import { PRICING_PLAN_REF_PATTERN } from './business-model-references.schemas.js';
|
|
3
|
+
import { PricingTiersStatus, resolvePricingTiersStatus } from './business-model-lite-snapshot.schemas.js';
|
|
3
4
|
/**
|
|
4
5
|
* @wildo_source:part:start business-model.snapshot.validation facet:layer:specification facet:family:business-model
|
|
5
6
|
*
|
|
@@ -16,7 +17,7 @@ import { PRICING_PLAN_REF_PATTERN } from './business-model-references.schemas.js
|
|
|
16
17
|
* check for type-asserted fixtures that bypass parsing, and the fail-soft
|
|
17
18
|
* cross-family ICP / requirement ref resolution.
|
|
18
19
|
*
|
|
19
|
-
* Rule table —
|
|
20
|
+
* Rule table — 10 kinds (scaffold depth, Phase J1 — deeper pricing / revenue
|
|
20
21
|
* analysis is Phase J2):
|
|
21
22
|
*
|
|
22
23
|
* | Kind | Severity | Trigger |
|
|
@@ -24,7 +25,9 @@ import { PRICING_PLAN_REF_PATTERN } from './business-model-references.schemas.js
|
|
|
24
25
|
* | `INVALID_REF_FORMAT` | ERROR | A plan ref fails the shared pattern (single source of truth with the Zod schema). Defence in depth for type-asserted fixtures. |
|
|
25
26
|
* | `DUPLICATE_REF` | ERROR | Two plans share a ref — the collection silently loses one entity to last-wins indexing. |
|
|
26
27
|
* | `DUPLICATE_CROSS_REF` | WARN | The same target/include-ref is listed more than once on ONE plan's cross-ref list — the repeat is noise the catalog silently dedupes. Intra-snapshot, so it runs UNCONDITIONALLY (no external set needed) — each cross-ref list is its own namespace. |
|
|
27
|
-
* | `NO_PLANS` | WARN | `plans` empty — the business model sketches no pricing. |
|
|
28
|
+
* | `NO_PLANS` | WARN | `plans` empty and nobody has said why — the business model sketches no pricing. SILENT when `pricingTiers` is `UNDECIDED`: there the emptiness is the creator's recorded answer, not owed work. |
|
|
29
|
+
* | `PRICING_TIERS_CONTRADICT_PLANS` | ERROR | The declared `pricingTiers` disagrees with `plans`: `undecided` with plans present, or `creator_stated` / `proposed` with none. |
|
|
30
|
+
* | `PROPOSAL_BASIS_MISMATCH` | ERROR | A plan of a `proposed` sketch has no `proposalBasis`, or a plan of a `creator_stated` one has one. Read through `resolvePricingTiersStatus`, so a hand-authored file with plans and no status counts as stated. |
|
|
28
31
|
* | `NO_REVENUE_MODEL` | WARN | `plans` are authored but the product-level `revenueModel` is unset — the pricing sketch is classified per-plan (`PricingModelAxis`) but the product's headline revenue model is undeclared. GATED on `plans.length > 0`: an empty snapshot is already fully described by `NO_PLANS`, so this fires only for the sharper "sketched pricing, forgot the revenue model" state (no redundant double-warn on `{}`). |
|
|
29
32
|
* | `STALE_AUTHORED` | WARN | Any plan's `authored.lastAuthoredAt + reviewCadence < now`. No check when `reviewCadence` is undefined or `AS_NEEDED`. |
|
|
30
33
|
* | `UNKNOWN_ICP_REF` | ERROR | A `targetIcpRefs` entry does not resolve in `options.availableIcpRefs`. SKIPPED (fail-soft) when no set is passed — the families are decoupled and the catalog resolves refs. |
|
|
@@ -63,8 +66,26 @@ export var BusinessModelLiteSnapshotIssueKind;
|
|
|
63
66
|
* NOT a duplicate.
|
|
64
67
|
*/
|
|
65
68
|
BusinessModelLiteSnapshotIssueKind["DUPLICATE_CROSS_REF"] = "duplicate_cross_ref";
|
|
66
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* `plans` empty and no recorded reason — the business model sketches no
|
|
71
|
+
* pricing (WARN). Not raised when `pricingTiers` is `UNDECIDED`: a considered
|
|
72
|
+
* "not decided yet" is an answer, and warning on it would teach the reader to
|
|
73
|
+
* skim the warning that means work is owed.
|
|
74
|
+
*/
|
|
67
75
|
BusinessModelLiteSnapshotIssueKind["NO_PLANS"] = "no_plans";
|
|
76
|
+
/**
|
|
77
|
+
* The declared `pricingTiers` and the `plans` collection contradict each
|
|
78
|
+
* other — `undecided` while plans are present, or `creator_stated` /
|
|
79
|
+
* `proposed` with no plan. ERROR: one of the two statements is false, and a
|
|
80
|
+
* reader cannot tell which.
|
|
81
|
+
*/
|
|
82
|
+
BusinessModelLiteSnapshotIssueKind["PRICING_TIERS_CONTRADICT_PLANS"] = "pricing_tiers_contradict_plans";
|
|
83
|
+
/**
|
|
84
|
+
* A plan's `proposalBasis` disagrees with where the tiers came from — missing
|
|
85
|
+
* on a plan of a `proposed` sketch (a proposal nobody can check), or present
|
|
86
|
+
* on a plan the creator stated (a proposal nobody made). ERROR.
|
|
87
|
+
*/
|
|
88
|
+
BusinessModelLiteSnapshotIssueKind["PROPOSAL_BASIS_MISMATCH"] = "proposal_basis_mismatch";
|
|
68
89
|
/**
|
|
69
90
|
* `plans` are authored but the product-level `revenueModel` is unset. The
|
|
70
91
|
* pricing sketch classifies HOW each plan scales (`PricingModelAxis`) but
|
|
@@ -113,6 +134,7 @@ export function validateBusinessModelLiteSnapshot(snapshot, options) {
|
|
|
113
134
|
detectDuplicateRefs(snapshot, issues);
|
|
114
135
|
detectDuplicateCrossRefs(snapshot, issues);
|
|
115
136
|
detectIncompleteness(snapshot, issues);
|
|
137
|
+
detectPricingTiersDisagreement(snapshot, issues);
|
|
116
138
|
detectStaleAuthored(snapshot, options?.now ?? new Date(), issues);
|
|
117
139
|
detectUnknownCrossRefs(snapshot, options, issues);
|
|
118
140
|
const ok = issues.every(issue => issue.severity !== BusinessModelLiteSnapshotIssueSeverity.ERROR);
|
|
@@ -172,7 +194,7 @@ function detectDuplicateCrossRefs(snapshot, issues) {
|
|
|
172
194
|
});
|
|
173
195
|
}
|
|
174
196
|
function detectIncompleteness(snapshot, issues) {
|
|
175
|
-
if (snapshot.plans.length === 0) {
|
|
197
|
+
if (snapshot.plans.length === 0 && resolvePricingTiersStatus(snapshot) !== PricingTiersStatus.UNDECIDED) {
|
|
176
198
|
issues.push({
|
|
177
199
|
kind: BusinessModelLiteSnapshotIssueKind.NO_PLANS,
|
|
178
200
|
path: 'plans',
|
|
@@ -192,6 +214,44 @@ function detectIncompleteness(snapshot, issues) {
|
|
|
192
214
|
});
|
|
193
215
|
}
|
|
194
216
|
}
|
|
217
|
+
function detectPricingTiersDisagreement(snapshot, issues) {
|
|
218
|
+
const declared = snapshot.pricingTiers;
|
|
219
|
+
if (declared === PricingTiersStatus.UNDECIDED && snapshot.plans.length > 0) {
|
|
220
|
+
issues.push({
|
|
221
|
+
kind: BusinessModelLiteSnapshotIssueKind.PRICING_TIERS_CONTRADICT_PLANS,
|
|
222
|
+
path: 'pricingTiers',
|
|
223
|
+
message: `pricingTiers is "undecided" but ${snapshot.plans.length} plan(s) are present — remove the plans, or declare where they came from.`,
|
|
224
|
+
severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
if ((declared === PricingTiersStatus.CREATOR_STATED || declared === PricingTiersStatus.PROPOSED) && snapshot.plans.length === 0) {
|
|
228
|
+
issues.push({
|
|
229
|
+
kind: BusinessModelLiteSnapshotIssueKind.PRICING_TIERS_CONTRADICT_PLANS,
|
|
230
|
+
path: 'pricingTiers',
|
|
231
|
+
message: `pricingTiers is "${declared}" but no plan is present — record the plans, or declare "undecided".`,
|
|
232
|
+
severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
const resolved = resolvePricingTiersStatus(snapshot);
|
|
236
|
+
snapshot.plans.forEach((entry, index) => {
|
|
237
|
+
if (resolved === PricingTiersStatus.PROPOSED && entry.proposalBasis === undefined) {
|
|
238
|
+
issues.push({
|
|
239
|
+
kind: BusinessModelLiteSnapshotIssueKind.PROPOSAL_BASIS_MISMATCH,
|
|
240
|
+
path: `plans[${index}].proposalBasis`,
|
|
241
|
+
message: `Plan "${entry.ref}" is a proposal but states no proposalBasis — name the ICP and requirements it was derived from.`,
|
|
242
|
+
severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
if (resolved === PricingTiersStatus.CREATOR_STATED && entry.proposalBasis !== undefined) {
|
|
246
|
+
issues.push({
|
|
247
|
+
kind: BusinessModelLiteSnapshotIssueKind.PROPOSAL_BASIS_MISMATCH,
|
|
248
|
+
path: `plans[${index}].proposalBasis`,
|
|
249
|
+
message: `Plan "${entry.ref}" was stated by the creator but carries a proposalBasis — remove it, or declare pricingTiers "proposed".`,
|
|
250
|
+
severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
195
255
|
function detectStaleAuthored(snapshot, now, issues) {
|
|
196
256
|
const checkOne = (authored, path) => {
|
|
197
257
|
if (authored?.reviewCadence === undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business-model-lite-snapshot-validation.js","sourceRoot":"","sources":["../../../../../src/_core/business-model-lite/business-model-lite-snapshot-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAG3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAG/E;;;;;;;;;;;;;;;;;;;;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AO,CAAC,wBAAyB,CAAC,GAAG,CAAC,MAAM,CAAC;oBAAE,OAAO;gBAC1D,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,kCAAkC,CAAC,uBAAuB;oBAChE,IAAI,EAAE,SAAS,KAAK,6BAA6B,QAAQ,GAAG;oBAC5D,OAAO,EAAE,oBAAoB,MAAM,cAAc,KAAK,CAAC,GAAG,yDAAyD;oBACnH,QAAQ,EAAE,sCAAsC,CAAC,KAAK;iBACvD,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AACD,gEAAgE","sourcesContent":["import { ReviewCadence } from '../market/market-authored-metadata.schemas';\nimport type { BusinessModelAuthoredMetadata } from './business-model-authored-metadata.schemas';\nimport type { PricingPlanConfig } from './pricing-plan.schemas';\nimport { PRICING_PLAN_REF_PATTERN } from './business-model-references.schemas';\nimport type { BusinessModelLiteSnapshot } from './business-model-lite-snapshot.schemas';\n\n/**\n * @wildo_source:part:start business-model.snapshot.validation facet:layer:specification facet:family:business-model\n *\n * Authoring-consistency validator for an assembled\n * `BusinessModelLiteSnapshot`.\n *\n * The function is a **pure**, **typed** graph walker over the snapshot — no\n * Zod introspection, no registry access, no I/O (the `_core` validator\n * convention shared with `validateMarketSnapshot` / `validateVisionSnapshot`\n * / `validateRequirementsSnapshot` / `validateRoadmapSnapshot` /\n * `validateAssertionSpecificationSnapshot`). Zod already enforces structural\n * validity (ref formats at parse time); this walker adds the cross-entity +\n * completeness checks Zod cannot express, the defence-in-depth ref-format\n * check for type-asserted fixtures that bypass parsing, and the fail-soft\n * cross-family ICP / requirement ref resolution.\n *\n * Rule table — 8 kinds (scaffold depth, Phase J1 — deeper pricing / revenue\n * analysis is Phase J2):\n *\n * | Kind | Severity | Trigger |\n * |----------------------------|----------|--------------------------------------------------------------------------------|\n * | `INVALID_REF_FORMAT` | ERROR | A plan ref fails the shared pattern (single source of truth with the Zod schema). Defence in depth for type-asserted fixtures. |\n * | `DUPLICATE_REF` | ERROR | Two plans share a ref — the collection silently loses one entity to last-wins indexing. |\n * | `DUPLICATE_CROSS_REF` | WARN | The same target/include-ref is listed more than once on ONE plan's cross-ref list — the repeat is noise the catalog silently dedupes. Intra-snapshot, so it runs UNCONDITIONALLY (no external set needed) — each cross-ref list is its own namespace. |\n * | `NO_PLANS` | WARN | `plans` empty — the business model sketches no pricing. |\n * | `NO_REVENUE_MODEL` | WARN | `plans` are authored but the product-level `revenueModel` is unset — the pricing sketch is classified per-plan (`PricingModelAxis`) but the product's headline revenue model is undeclared. GATED on `plans.length > 0`: an empty snapshot is already fully described by `NO_PLANS`, so this fires only for the sharper \"sketched pricing, forgot the revenue model\" state (no redundant double-warn on `{}`). |\n * | `STALE_AUTHORED` | WARN | Any plan's `authored.lastAuthoredAt + reviewCadence < now`. No check when `reviewCadence` is undefined or `AS_NEEDED`. |\n * | `UNKNOWN_ICP_REF` | ERROR | A `targetIcpRefs` entry does not resolve in `options.availableIcpRefs`. SKIPPED (fail-soft) when no set is passed — the families are decoupled and the catalog resolves refs. |\n * | `UNKNOWN_REQUIREMENT_REF` | ERROR | An `includesRequirementRefs` entry does not resolve in `options.availableRequirementRefs`. SKIPPED (fail-soft) when no set is passed. |\n *\n * There is deliberately NO `DUPLICATE_SEQUENCE` detector: pricing plans (unlike\n * roadmap phases) are NOT inherently ordered, so the family carries no\n * `sequence` axis to collide on.\n *\n * Severity is a TS enum (project rule — enums over literal unions). The\n * validator never mutates the snapshot. Issue ordering is detector-order\n * then walk-order — NOT a stable contract; callers group/sort by `kind` +\n * `severity` themselves.\n */\nexport enum BusinessModelLiteSnapshotIssueKind {\n /**\n * A plan ref violates its kebab-case prefix contract. The Zod schema\n * rejects this at parse time; the detector remains as defence in depth for\n * callers that bypass parsing (tests building snapshots with type-asserted\n * fixtures). ERROR.\n */\n INVALID_REF_FORMAT = 'invalid_ref_format',\n /**\n * Two plans share a ref. The collection is addressed by ref downstream, so\n * a duplicate silently drops one plan. ERROR.\n */\n DUPLICATE_REF = 'duplicate_ref',\n /**\n * The same ICP / requirement ref appears more than once on ONE plan's\n * cross-ref list. The repeat carries no meaning — the catalog dedupes it\n * (or double-counts it in coverage). WARN, not ERROR: the plan is still\n * valid, the authoring is just untidy. Runs unconditionally (intra-\n * snapshot, needs no external set); each cross-ref list is its own\n * namespace, so the same string appearing once in each of the two lists is\n * NOT a duplicate.\n */\n DUPLICATE_CROSS_REF = 'duplicate_cross_ref',\n /** `plans` empty — the business model sketches no pricing (WARN). */\n NO_PLANS = 'no_plans',\n /**\n * `plans` are authored but the product-level `revenueModel` is unset. The\n * pricing sketch classifies HOW each plan scales (`PricingModelAxis`) but\n * leaves the product's headline \"how it makes money\" undeclared. WARN, not\n * ERROR: the model is still structurally valid, just under-classified.\n * GATED on `plans.length > 0` — a fully-empty snapshot is already covered\n * by `NO_PLANS`, so this never double-warns on `{}`; it fires only for the\n * sharper \"sketched pricing, forgot the revenue model\" state.\n */\n NO_REVENUE_MODEL = 'no_revenue_model',\n /** `lastAuthoredAt + reviewCadence < now` (WARN — market/vision/requirements/roadmap parity). */\n STALE_AUTHORED = 'stale_authored',\n /**\n * A `targetIcpRefs` entry does not resolve against the supplied ICP-ref\n * set — a dangling cross-family reference. ERROR when a set is supplied;\n * the whole check is SKIPPED (fail-soft) when it is not.\n */\n UNKNOWN_ICP_REF = 'unknown_icp_ref',\n /**\n * An `includesRequirementRefs` entry does not resolve against the supplied\n * requirement-ref set. ERROR when a set is supplied; SKIPPED (fail-soft)\n * when it is not.\n */\n UNKNOWN_REQUIREMENT_REF = 'unknown_requirement_ref',\n}\n\nexport enum BusinessModelLiteSnapshotIssueSeverity {\n ERROR = 'error',\n WARN = 'warn',\n}\n\nexport interface BusinessModelLiteSnapshotIssue {\n kind: BusinessModelLiteSnapshotIssueKind;\n /** Dotted path inside the snapshot (e.g. `'plans[2].ref'`). */\n path: string;\n message: string;\n severity: BusinessModelLiteSnapshotIssueSeverity;\n}\n\nexport interface BusinessModelLiteSnapshotValidationResult {\n /** `true` iff no issue has severity `ERROR`. */\n ok: boolean;\n issues: BusinessModelLiteSnapshotIssue[];\n}\n\n/**\n * Options for this family validator.\n *\n * ## The cross-family sets are OPT-IN, and omitting one SKIPS its check\n *\n * A family validator sees one family. It cannot resolve a reference into another family's\n * vocabulary unless you hand it that family's refs — so each `available*Refs` option is the caller\n * saying \"I have this context, use it\". Omit one and the matching check does not run: no issue is\n * reported, and the absence looks exactly like a snapshot with no such reference.\n *\n * That is deliberate — the families are decoupled on purpose — but it means a validator called with\n * the snapshot alone is checking this family's INTERNAL consistency only. If you want dangling\n * cross-family references caught, supply the sets; if you validate one family in isolation, expect\n * them to be found later by whatever holds every family at once.\n */\nexport interface ValidateBusinessModelLiteSnapshotOptions {\n /** Override \"now\" for `STALE_AUTHORED` checks (test affordance). Defaults to `new Date()`. */\n now?: Date;\n /**\n * Resolvable market ICP refs. When supplied, every `targetIcpRefs` entry\n * not in the set is reported as `UNKNOWN_ICP_REF`. When omitted, the check\n * is skipped entirely (fail-soft — the business-model family is decoupled\n * from the market family; the catalog owns resolution).\n */\n availableIcpRefs?: ReadonlySet<string>;\n /**\n * Resolvable functional-requirement refs. Same skip-when-omitted semantics\n * as `availableIcpRefs`, reported as `UNKNOWN_REQUIREMENT_REF`.\n */\n availableRequirementRefs?: ReadonlySet<string>;\n}\n\n/**\n * Days-per-cadence mapping, mirrored from the market / vision / requirements\n * / roadmap / assertions validators (module-local there too — a shared\n * promotion is part of the deferred authored-metadata generalization).\n */\nconst REVIEW_CADENCE_TO_DAYS: Record<ReviewCadence, number> = {\n [ReviewCadence.WEEKLY]: 7,\n [ReviewCadence.MONTHLY]: 31,\n [ReviewCadence.QUARTERLY]: 92,\n [ReviewCadence.YEARLY]: 366,\n [ReviewCadence.AS_NEEDED]: Number.POSITIVE_INFINITY,\n};\n\nexport function validateBusinessModelLiteSnapshot(\n snapshot: BusinessModelLiteSnapshot,\n options?: ValidateBusinessModelLiteSnapshotOptions,\n): BusinessModelLiteSnapshotValidationResult {\n const issues: BusinessModelLiteSnapshotIssue[] = [];\n\n detectInvalidRefFormats(snapshot, issues);\n detectDuplicateRefs(snapshot, issues);\n detectDuplicateCrossRefs(snapshot, issues);\n detectIncompleteness(snapshot, issues);\n detectStaleAuthored(snapshot, options?.now ?? new Date(), issues);\n detectUnknownCrossRefs(snapshot, options, issues);\n\n const ok = issues.every(\n issue => issue.severity !== BusinessModelLiteSnapshotIssueSeverity.ERROR,\n );\n return { ok, issues };\n}\n\n// ────────────────────────────────────────────────────────────────────\n// Detectors — one per rule, kept small and independently testable.\n// ────────────────────────────────────────────────────────────────────\n\nfunction detectInvalidRefFormats(\n snapshot: BusinessModelLiteSnapshot,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n snapshot.plans.forEach((entry, index) => {\n if (PRICING_PLAN_REF_PATTERN.test(entry.ref)) return;\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.INVALID_REF_FORMAT,\n path: `plans[${index}].ref`,\n message: `Pricing-plan ref \"${entry.ref}\" is not kebab-case with the \"pricing-plan-\" prefix.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n });\n}\n\nfunction detectDuplicateRefs(\n snapshot: BusinessModelLiteSnapshot,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n const seen = new Set<string>();\n snapshot.plans.forEach((entry, index) => {\n if (!seen.has(entry.ref)) {\n seen.add(entry.ref);\n return;\n }\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.DUPLICATE_REF,\n path: `plans[${index}].ref`,\n message: `Duplicate ref \"${entry.ref}\" in plans — refs must be unique; the collection is addressed by ref downstream.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n });\n}\n\nfunction detectDuplicateCrossRefs(\n snapshot: BusinessModelLiteSnapshot,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n const checkList = (\n refs: readonly string[] | undefined,\n entry: PricingPlanConfig,\n path: string,\n ): void => {\n if (refs === undefined) return;\n const seen = new Set<string>();\n refs.forEach((ref, refIndex) => {\n if (!seen.has(ref)) {\n seen.add(ref);\n return;\n }\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.DUPLICATE_CROSS_REF,\n path: `${path}[${refIndex}]`,\n message: `Cross-ref \"${ref}\" is listed more than once on plan \"${entry.ref}\" (${path}). Remove the duplicate.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.WARN,\n });\n });\n };\n\n snapshot.plans.forEach((entry, index) => {\n checkList(entry.targetIcpRefs, entry, `plans[${index}].targetIcpRefs`);\n checkList(\n entry.includesRequirementRefs,\n entry,\n `plans[${index}].includesRequirementRefs`,\n );\n });\n}\n\nfunction detectIncompleteness(\n snapshot: BusinessModelLiteSnapshot,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n if (snapshot.plans.length === 0) {\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.NO_PLANS,\n path: 'plans',\n message: 'Business model sketches no pricing plans — it describes no way the product is sold.',\n severity: BusinessModelLiteSnapshotIssueSeverity.WARN,\n });\n }\n // Gated on plans being present: an empty snapshot is already covered by\n // NO_PLANS, so this fires only for the sharper \"pricing is sketched but the\n // product's headline revenue model is undeclared\" state.\n if (snapshot.plans.length > 0 && snapshot.revenueModel === undefined) {\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.NO_REVENUE_MODEL,\n path: 'revenueModel',\n message: 'Pricing plans are authored but revenueModel is unset — classify how the product makes money (RevenueModelKind).',\n severity: BusinessModelLiteSnapshotIssueSeverity.WARN,\n });\n }\n}\n\nfunction detectStaleAuthored(\n snapshot: BusinessModelLiteSnapshot,\n now: Date,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n const checkOne = (\n authored: BusinessModelAuthoredMetadata | undefined,\n path: string,\n ): void => {\n if (authored?.reviewCadence === undefined) return;\n const days = REVIEW_CADENCE_TO_DAYS[authored.reviewCadence];\n if (!Number.isFinite(days)) return;\n const lastAuthored = new Date(authored.lastAuthoredAt).getTime();\n if (Number.isNaN(lastAuthored)) return;\n const ageDays = (now.getTime() - lastAuthored) / (24 * 60 * 60 * 1000);\n if (ageDays <= days) return;\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.STALE_AUTHORED,\n path,\n message: `Pricing plan at \"${path}\" is ${Math.floor(ageDays)} days old (cadence ${authored.reviewCadence} ⇒ ${days}d). Re-author or remove the cadence.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.WARN,\n });\n };\n\n snapshot.plans.forEach((entry, index) =>\n checkOne(entry.authored, `plans[${index}].authored`),\n );\n}\n\nfunction detectUnknownCrossRefs(\n snapshot: BusinessModelLiteSnapshot,\n options: ValidateBusinessModelLiteSnapshotOptions | undefined,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n snapshot.plans.forEach((entry, index) => {\n if (options?.availableIcpRefs !== undefined) {\n entry.targetIcpRefs?.forEach((icpRef, refIndex) => {\n if (options.availableIcpRefs!.has(icpRef)) return;\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.UNKNOWN_ICP_REF,\n path: `plans[${index}].targetIcpRefs[${refIndex}]`,\n message: `ICP ref \"${icpRef}\" on plan \"${entry.ref}\" does not resolve in the supplied ICP-ref set.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n });\n }\n if (options?.availableRequirementRefs !== undefined) {\n entry.includesRequirementRefs?.forEach((reqRef, refIndex) => {\n if (options.availableRequirementRefs!.has(reqRef)) return;\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.UNKNOWN_REQUIREMENT_REF,\n path: `plans[${index}].includesRequirementRefs[${refIndex}]`,\n message: `Requirement ref \"${reqRef}\" on plan \"${entry.ref}\" does not resolve in the supplied requirement-ref set.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n });\n }\n });\n}\n/** @wildo_source:part:end business-model.snapshot.validation */\n"]}
|
|
1
|
+
{"version":3,"file":"business-model-lite-snapshot-validation.js","sourceRoot":"","sources":["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","sourcesContent":["import { ReviewCadence } from '../market/market-authored-metadata.schemas';\nimport type { BusinessModelAuthoredMetadata } from './business-model-authored-metadata.schemas';\nimport type { PricingPlanConfig } from './pricing-plan.schemas';\nimport { PRICING_PLAN_REF_PATTERN } from './business-model-references.schemas';\nimport { PricingTiersStatus, resolvePricingTiersStatus, type BusinessModelLiteSnapshot } from './business-model-lite-snapshot.schemas';\n\n/**\n * @wildo_source:part:start business-model.snapshot.validation facet:layer:specification facet:family:business-model\n *\n * Authoring-consistency validator for an assembled\n * `BusinessModelLiteSnapshot`.\n *\n * The function is a **pure**, **typed** graph walker over the snapshot — no\n * Zod introspection, no registry access, no I/O (the `_core` validator\n * convention shared with `validateMarketSnapshot` / `validateVisionSnapshot`\n * / `validateRequirementsSnapshot` / `validateRoadmapSnapshot` /\n * `validateAssertionSpecificationSnapshot`). Zod already enforces structural\n * validity (ref formats at parse time); this walker adds the cross-entity +\n * completeness checks Zod cannot express, the defence-in-depth ref-format\n * check for type-asserted fixtures that bypass parsing, and the fail-soft\n * cross-family ICP / requirement ref resolution.\n *\n * Rule table — 10 kinds (scaffold depth, Phase J1 — deeper pricing / revenue\n * analysis is Phase J2):\n *\n * | Kind | Severity | Trigger |\n * |----------------------------|----------|--------------------------------------------------------------------------------|\n * | `INVALID_REF_FORMAT` | ERROR | A plan ref fails the shared pattern (single source of truth with the Zod schema). Defence in depth for type-asserted fixtures. |\n * | `DUPLICATE_REF` | ERROR | Two plans share a ref — the collection silently loses one entity to last-wins indexing. |\n * | `DUPLICATE_CROSS_REF` | WARN | The same target/include-ref is listed more than once on ONE plan's cross-ref list — the repeat is noise the catalog silently dedupes. Intra-snapshot, so it runs UNCONDITIONALLY (no external set needed) — each cross-ref list is its own namespace. |\n * | `NO_PLANS` | WARN | `plans` empty and nobody has said why — the business model sketches no pricing. SILENT when `pricingTiers` is `UNDECIDED`: there the emptiness is the creator's recorded answer, not owed work. |\n * | `PRICING_TIERS_CONTRADICT_PLANS` | ERROR | The declared `pricingTiers` disagrees with `plans`: `undecided` with plans present, or `creator_stated` / `proposed` with none. |\n * | `PROPOSAL_BASIS_MISMATCH` | ERROR | A plan of a `proposed` sketch has no `proposalBasis`, or a plan of a `creator_stated` one has one. Read through `resolvePricingTiersStatus`, so a hand-authored file with plans and no status counts as stated. |\n * | `NO_REVENUE_MODEL` | WARN | `plans` are authored but the product-level `revenueModel` is unset — the pricing sketch is classified per-plan (`PricingModelAxis`) but the product's headline revenue model is undeclared. GATED on `plans.length > 0`: an empty snapshot is already fully described by `NO_PLANS`, so this fires only for the sharper \"sketched pricing, forgot the revenue model\" state (no redundant double-warn on `{}`). |\n * | `STALE_AUTHORED` | WARN | Any plan's `authored.lastAuthoredAt + reviewCadence < now`. No check when `reviewCadence` is undefined or `AS_NEEDED`. |\n * | `UNKNOWN_ICP_REF` | ERROR | A `targetIcpRefs` entry does not resolve in `options.availableIcpRefs`. SKIPPED (fail-soft) when no set is passed — the families are decoupled and the catalog resolves refs. |\n * | `UNKNOWN_REQUIREMENT_REF` | ERROR | An `includesRequirementRefs` entry does not resolve in `options.availableRequirementRefs`. SKIPPED (fail-soft) when no set is passed. |\n *\n * There is deliberately NO `DUPLICATE_SEQUENCE` detector: pricing plans (unlike\n * roadmap phases) are NOT inherently ordered, so the family carries no\n * `sequence` axis to collide on.\n *\n * Severity is a TS enum (project rule — enums over literal unions). The\n * validator never mutates the snapshot. Issue ordering is detector-order\n * then walk-order — NOT a stable contract; callers group/sort by `kind` +\n * `severity` themselves.\n */\nexport enum BusinessModelLiteSnapshotIssueKind {\n /**\n * A plan ref violates its kebab-case prefix contract. The Zod schema\n * rejects this at parse time; the detector remains as defence in depth for\n * callers that bypass parsing (tests building snapshots with type-asserted\n * fixtures). ERROR.\n */\n INVALID_REF_FORMAT = 'invalid_ref_format',\n /**\n * Two plans share a ref. The collection is addressed by ref downstream, so\n * a duplicate silently drops one plan. ERROR.\n */\n DUPLICATE_REF = 'duplicate_ref',\n /**\n * The same ICP / requirement ref appears more than once on ONE plan's\n * cross-ref list. The repeat carries no meaning — the catalog dedupes it\n * (or double-counts it in coverage). WARN, not ERROR: the plan is still\n * valid, the authoring is just untidy. Runs unconditionally (intra-\n * snapshot, needs no external set); each cross-ref list is its own\n * namespace, so the same string appearing once in each of the two lists is\n * NOT a duplicate.\n */\n DUPLICATE_CROSS_REF = 'duplicate_cross_ref',\n /**\n * `plans` empty and no recorded reason — the business model sketches no\n * pricing (WARN). Not raised when `pricingTiers` is `UNDECIDED`: a considered\n * \"not decided yet\" is an answer, and warning on it would teach the reader to\n * skim the warning that means work is owed.\n */\n NO_PLANS = 'no_plans',\n /**\n * The declared `pricingTiers` and the `plans` collection contradict each\n * other — `undecided` while plans are present, or `creator_stated` /\n * `proposed` with no plan. ERROR: one of the two statements is false, and a\n * reader cannot tell which.\n */\n PRICING_TIERS_CONTRADICT_PLANS = 'pricing_tiers_contradict_plans',\n /**\n * A plan's `proposalBasis` disagrees with where the tiers came from — missing\n * on a plan of a `proposed` sketch (a proposal nobody can check), or present\n * on a plan the creator stated (a proposal nobody made). ERROR.\n */\n PROPOSAL_BASIS_MISMATCH = 'proposal_basis_mismatch',\n /**\n * `plans` are authored but the product-level `revenueModel` is unset. The\n * pricing sketch classifies HOW each plan scales (`PricingModelAxis`) but\n * leaves the product's headline \"how it makes money\" undeclared. WARN, not\n * ERROR: the model is still structurally valid, just under-classified.\n * GATED on `plans.length > 0` — a fully-empty snapshot is already covered\n * by `NO_PLANS`, so this never double-warns on `{}`; it fires only for the\n * sharper \"sketched pricing, forgot the revenue model\" state.\n */\n NO_REVENUE_MODEL = 'no_revenue_model',\n /** `lastAuthoredAt + reviewCadence < now` (WARN — market/vision/requirements/roadmap parity). */\n STALE_AUTHORED = 'stale_authored',\n /**\n * A `targetIcpRefs` entry does not resolve against the supplied ICP-ref\n * set — a dangling cross-family reference. ERROR when a set is supplied;\n * the whole check is SKIPPED (fail-soft) when it is not.\n */\n UNKNOWN_ICP_REF = 'unknown_icp_ref',\n /**\n * An `includesRequirementRefs` entry does not resolve against the supplied\n * requirement-ref set. ERROR when a set is supplied; SKIPPED (fail-soft)\n * when it is not.\n */\n UNKNOWN_REQUIREMENT_REF = 'unknown_requirement_ref',\n}\n\nexport enum BusinessModelLiteSnapshotIssueSeverity {\n ERROR = 'error',\n WARN = 'warn',\n}\n\nexport interface BusinessModelLiteSnapshotIssue {\n kind: BusinessModelLiteSnapshotIssueKind;\n /** Dotted path inside the snapshot (e.g. `'plans[2].ref'`). */\n path: string;\n message: string;\n severity: BusinessModelLiteSnapshotIssueSeverity;\n}\n\nexport interface BusinessModelLiteSnapshotValidationResult {\n /** `true` iff no issue has severity `ERROR`. */\n ok: boolean;\n issues: BusinessModelLiteSnapshotIssue[];\n}\n\n/**\n * Options for this family validator.\n *\n * ## The cross-family sets are OPT-IN, and omitting one SKIPS its check\n *\n * A family validator sees one family. It cannot resolve a reference into another family's\n * vocabulary unless you hand it that family's refs — so each `available*Refs` option is the caller\n * saying \"I have this context, use it\". Omit one and the matching check does not run: no issue is\n * reported, and the absence looks exactly like a snapshot with no such reference.\n *\n * That is deliberate — the families are decoupled on purpose — but it means a validator called with\n * the snapshot alone is checking this family's INTERNAL consistency only. If you want dangling\n * cross-family references caught, supply the sets; if you validate one family in isolation, expect\n * them to be found later by whatever holds every family at once.\n */\nexport interface ValidateBusinessModelLiteSnapshotOptions {\n /** Override \"now\" for `STALE_AUTHORED` checks (test affordance). Defaults to `new Date()`. */\n now?: Date;\n /**\n * Resolvable market ICP refs. When supplied, every `targetIcpRefs` entry\n * not in the set is reported as `UNKNOWN_ICP_REF`. When omitted, the check\n * is skipped entirely (fail-soft — the business-model family is decoupled\n * from the market family; the catalog owns resolution).\n */\n availableIcpRefs?: ReadonlySet<string>;\n /**\n * Resolvable functional-requirement refs. Same skip-when-omitted semantics\n * as `availableIcpRefs`, reported as `UNKNOWN_REQUIREMENT_REF`.\n */\n availableRequirementRefs?: ReadonlySet<string>;\n}\n\n/**\n * Days-per-cadence mapping, mirrored from the market / vision / requirements\n * / roadmap / assertions validators (module-local there too — a shared\n * promotion is part of the deferred authored-metadata generalization).\n */\nconst REVIEW_CADENCE_TO_DAYS: Record<ReviewCadence, number> = {\n [ReviewCadence.WEEKLY]: 7,\n [ReviewCadence.MONTHLY]: 31,\n [ReviewCadence.QUARTERLY]: 92,\n [ReviewCadence.YEARLY]: 366,\n [ReviewCadence.AS_NEEDED]: Number.POSITIVE_INFINITY,\n};\n\nexport function validateBusinessModelLiteSnapshot(\n snapshot: BusinessModelLiteSnapshot,\n options?: ValidateBusinessModelLiteSnapshotOptions,\n): BusinessModelLiteSnapshotValidationResult {\n const issues: BusinessModelLiteSnapshotIssue[] = [];\n\n detectInvalidRefFormats(snapshot, issues);\n detectDuplicateRefs(snapshot, issues);\n detectDuplicateCrossRefs(snapshot, issues);\n detectIncompleteness(snapshot, issues);\n detectPricingTiersDisagreement(snapshot, issues);\n detectStaleAuthored(snapshot, options?.now ?? new Date(), issues);\n detectUnknownCrossRefs(snapshot, options, issues);\n\n const ok = issues.every(\n issue => issue.severity !== BusinessModelLiteSnapshotIssueSeverity.ERROR,\n );\n return { ok, issues };\n}\n\n// ────────────────────────────────────────────────────────────────────\n// Detectors — one per rule, kept small and independently testable.\n// ────────────────────────────────────────────────────────────────────\n\nfunction detectInvalidRefFormats(\n snapshot: BusinessModelLiteSnapshot,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n snapshot.plans.forEach((entry, index) => {\n if (PRICING_PLAN_REF_PATTERN.test(entry.ref)) return;\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.INVALID_REF_FORMAT,\n path: `plans[${index}].ref`,\n message: `Pricing-plan ref \"${entry.ref}\" is not kebab-case with the \"pricing-plan-\" prefix.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n });\n}\n\nfunction detectDuplicateRefs(\n snapshot: BusinessModelLiteSnapshot,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n const seen = new Set<string>();\n snapshot.plans.forEach((entry, index) => {\n if (!seen.has(entry.ref)) {\n seen.add(entry.ref);\n return;\n }\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.DUPLICATE_REF,\n path: `plans[${index}].ref`,\n message: `Duplicate ref \"${entry.ref}\" in plans — refs must be unique; the collection is addressed by ref downstream.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n });\n}\n\nfunction detectDuplicateCrossRefs(\n snapshot: BusinessModelLiteSnapshot,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n const checkList = (\n refs: readonly string[] | undefined,\n entry: PricingPlanConfig,\n path: string,\n ): void => {\n if (refs === undefined) return;\n const seen = new Set<string>();\n refs.forEach((ref, refIndex) => {\n if (!seen.has(ref)) {\n seen.add(ref);\n return;\n }\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.DUPLICATE_CROSS_REF,\n path: `${path}[${refIndex}]`,\n message: `Cross-ref \"${ref}\" is listed more than once on plan \"${entry.ref}\" (${path}). Remove the duplicate.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.WARN,\n });\n });\n };\n\n snapshot.plans.forEach((entry, index) => {\n checkList(entry.targetIcpRefs, entry, `plans[${index}].targetIcpRefs`);\n checkList(\n entry.includesRequirementRefs,\n entry,\n `plans[${index}].includesRequirementRefs`,\n );\n });\n}\n\nfunction detectIncompleteness(\n snapshot: BusinessModelLiteSnapshot,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n if (snapshot.plans.length === 0 && resolvePricingTiersStatus(snapshot) !== PricingTiersStatus.UNDECIDED) {\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.NO_PLANS,\n path: 'plans',\n message: 'Business model sketches no pricing plans — it describes no way the product is sold.',\n severity: BusinessModelLiteSnapshotIssueSeverity.WARN,\n });\n }\n // Gated on plans being present: an empty snapshot is already covered by\n // NO_PLANS, so this fires only for the sharper \"pricing is sketched but the\n // product's headline revenue model is undeclared\" state.\n if (snapshot.plans.length > 0 && snapshot.revenueModel === undefined) {\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.NO_REVENUE_MODEL,\n path: 'revenueModel',\n message: 'Pricing plans are authored but revenueModel is unset — classify how the product makes money (RevenueModelKind).',\n severity: BusinessModelLiteSnapshotIssueSeverity.WARN,\n });\n }\n}\n\nfunction detectPricingTiersDisagreement(\n snapshot: BusinessModelLiteSnapshot,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n const declared = snapshot.pricingTiers;\n if (declared === PricingTiersStatus.UNDECIDED && snapshot.plans.length > 0) {\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.PRICING_TIERS_CONTRADICT_PLANS,\n path: 'pricingTiers',\n message: `pricingTiers is \"undecided\" but ${snapshot.plans.length} plan(s) are present — remove the plans, or declare where they came from.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n }\n if ((declared === PricingTiersStatus.CREATOR_STATED || declared === PricingTiersStatus.PROPOSED) && snapshot.plans.length === 0) {\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.PRICING_TIERS_CONTRADICT_PLANS,\n path: 'pricingTiers',\n message: `pricingTiers is \"${declared}\" but no plan is present — record the plans, or declare \"undecided\".`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n }\n\n const resolved = resolvePricingTiersStatus(snapshot);\n snapshot.plans.forEach((entry, index) => {\n if (resolved === PricingTiersStatus.PROPOSED && entry.proposalBasis === undefined) {\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.PROPOSAL_BASIS_MISMATCH,\n path: `plans[${index}].proposalBasis`,\n message: `Plan \"${entry.ref}\" is a proposal but states no proposalBasis — name the ICP and requirements it was derived from.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n }\n if (resolved === PricingTiersStatus.CREATOR_STATED && entry.proposalBasis !== undefined) {\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.PROPOSAL_BASIS_MISMATCH,\n path: `plans[${index}].proposalBasis`,\n message: `Plan \"${entry.ref}\" was stated by the creator but carries a proposalBasis — remove it, or declare pricingTiers \"proposed\".`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n }\n });\n}\n\nfunction detectStaleAuthored(\n snapshot: BusinessModelLiteSnapshot,\n now: Date,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n const checkOne = (\n authored: BusinessModelAuthoredMetadata | undefined,\n path: string,\n ): void => {\n if (authored?.reviewCadence === undefined) return;\n const days = REVIEW_CADENCE_TO_DAYS[authored.reviewCadence];\n if (!Number.isFinite(days)) return;\n const lastAuthored = new Date(authored.lastAuthoredAt).getTime();\n if (Number.isNaN(lastAuthored)) return;\n const ageDays = (now.getTime() - lastAuthored) / (24 * 60 * 60 * 1000);\n if (ageDays <= days) return;\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.STALE_AUTHORED,\n path,\n message: `Pricing plan at \"${path}\" is ${Math.floor(ageDays)} days old (cadence ${authored.reviewCadence} ⇒ ${days}d). Re-author or remove the cadence.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.WARN,\n });\n };\n\n snapshot.plans.forEach((entry, index) =>\n checkOne(entry.authored, `plans[${index}].authored`),\n );\n}\n\nfunction detectUnknownCrossRefs(\n snapshot: BusinessModelLiteSnapshot,\n options: ValidateBusinessModelLiteSnapshotOptions | undefined,\n issues: BusinessModelLiteSnapshotIssue[],\n): void {\n snapshot.plans.forEach((entry, index) => {\n if (options?.availableIcpRefs !== undefined) {\n entry.targetIcpRefs?.forEach((icpRef, refIndex) => {\n if (options.availableIcpRefs!.has(icpRef)) return;\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.UNKNOWN_ICP_REF,\n path: `plans[${index}].targetIcpRefs[${refIndex}]`,\n message: `ICP ref \"${icpRef}\" on plan \"${entry.ref}\" does not resolve in the supplied ICP-ref set.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n });\n }\n if (options?.availableRequirementRefs !== undefined) {\n entry.includesRequirementRefs?.forEach((reqRef, refIndex) => {\n if (options.availableRequirementRefs!.has(reqRef)) return;\n issues.push({\n kind: BusinessModelLiteSnapshotIssueKind.UNKNOWN_REQUIREMENT_REF,\n path: `plans[${index}].includesRequirementRefs[${refIndex}]`,\n message: `Requirement ref \"${reqRef}\" on plan \"${entry.ref}\" does not resolve in the supplied requirement-ref set.`,\n severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,\n });\n });\n }\n });\n}\n/** @wildo_source:part:end business-model.snapshot.validation */\n"]}
|
|
@@ -44,6 +44,43 @@ export declare enum RevenueModelKind {
|
|
|
44
44
|
/** Anything the fixed models above do not capture. */
|
|
45
45
|
OTHER = "other"
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Where the snapshot's pricing TIERS came from — the creator's answer to "what
|
|
49
|
+
* tiers do you plan to sell?", recorded as a fact rather than inferred from the
|
|
50
|
+
* shape of `plans`.
|
|
51
|
+
*
|
|
52
|
+
* ## Why this is a field and not "plans is empty"
|
|
53
|
+
*
|
|
54
|
+
* An empty `plans` used to carry two meanings that send a reader to opposite
|
|
55
|
+
* places: "nobody has sketched pricing yet" (work owed) and "the creator has
|
|
56
|
+
* considered it and not decided" (a real answer, nothing owed). And a non-empty
|
|
57
|
+
* `plans` could not say whether its tiers were the creator's or a proposal the
|
|
58
|
+
* creator asked for. The generated contract (`BusinessModelLiteSnapshotGenerationSchema`)
|
|
59
|
+
* therefore requires this status, so an empty sketch is always a STATEMENT and
|
|
60
|
+
* never a vacuous `{}`.
|
|
61
|
+
*/
|
|
62
|
+
export declare enum PricingTiersStatus {
|
|
63
|
+
/** `plans` are the tiers the creator named. At least one plan. */
|
|
64
|
+
CREATOR_STATED = "creator_stated",
|
|
65
|
+
/**
|
|
66
|
+
* The creator asked for tiers to be PROPOSED (typically "derive them from the
|
|
67
|
+
* market research"), so `plans` were derived rather than named. Each carries a
|
|
68
|
+
* `proposalBasis`, and none carries a price or scaling axis the creator did
|
|
69
|
+
* not state. At least one plan.
|
|
70
|
+
*
|
|
71
|
+
* This records ORIGIN, not a pending state: it stays `proposed` after the
|
|
72
|
+
* creator accepts the plans, because acceptance is the commit that lands the
|
|
73
|
+
* artifact, not a value of this field.
|
|
74
|
+
*/
|
|
75
|
+
PROPOSED = "proposed",
|
|
76
|
+
/**
|
|
77
|
+
* The creator has not decided the tiers and did not ask for a proposal.
|
|
78
|
+
* `plans` is empty, and that emptiness is an answer, not a gap: nothing
|
|
79
|
+
* downstream may read it as "free" or as "no billing", because
|
|
80
|
+
* `revenueModel` still says how the product makes money.
|
|
81
|
+
*/
|
|
82
|
+
UNDECIDED = "undecided"
|
|
83
|
+
}
|
|
47
84
|
/**
|
|
48
85
|
* THE business-model-lite-snapshot payload — a **single aggregate per
|
|
49
86
|
* product** (market / vision / requirements / roadmap style), NOT a keyed
|
|
@@ -90,6 +127,12 @@ export declare enum RevenueModelKind {
|
|
|
90
127
|
* surfaced as a WARN by `validateBusinessModelLiteSnapshot`, never a parse
|
|
91
128
|
* failure. Plans are NOT inherently ordered (unlike roadmap phases), so no
|
|
92
129
|
* `sequence` ordering key is modelled.
|
|
130
|
+
* - **`pricingTiers`** — where the plans came from (`PricingTiersStatus`):
|
|
131
|
+
* stated by the creator, proposed at the creator's request, or undecided
|
|
132
|
+
* (then `plans` is empty BY ANSWER). Optional on a hand-authored file; read
|
|
133
|
+
* it through `resolvePricingTiersStatus`, never directly, so the meaning of
|
|
134
|
+
* an absent value lives in one place. Its agreement with `plans` is checked
|
|
135
|
+
* by `validateBusinessModelLiteSnapshot`.
|
|
93
136
|
*
|
|
94
137
|
* Authored entirely in English (like the vision / market / requirements /
|
|
95
138
|
* roadmap families). Authoring-consistency (duplicate refs, ref format,
|
|
@@ -111,6 +154,7 @@ export declare const BusinessModelLiteSnapshotSchema: z.ZodObject<{
|
|
|
111
154
|
targetSummary: z.ZodOptional<z.ZodString>;
|
|
112
155
|
targetIcpRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
113
156
|
includesRequirementRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
157
|
+
proposalBasis: z.ZodOptional<z.ZodString>;
|
|
114
158
|
authored: z.ZodOptional<z.ZodObject<{
|
|
115
159
|
lastAuthoredAt: z.ZodISODateTime;
|
|
116
160
|
confidence: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodEnum<typeof import("..").AuthoredConfidence>>;
|
|
@@ -119,7 +163,22 @@ export declare const BusinessModelLiteSnapshotSchema: z.ZodObject<{
|
|
|
119
163
|
notes: z.ZodOptional<z.ZodString>;
|
|
120
164
|
}, z.core.$strip>>;
|
|
121
165
|
}, z.core.$strip>>>;
|
|
166
|
+
pricingTiers: z.ZodOptional<z.ZodEnum<typeof PricingTiersStatus>>;
|
|
122
167
|
}, z.core.$strip>;
|
|
123
168
|
export type BusinessModelLiteSnapshot = z.infer<typeof BusinessModelLiteSnapshotSchema>;
|
|
169
|
+
/**
|
|
170
|
+
* The ONE place an absent `pricingTiers` is interpreted. Every reader that asks
|
|
171
|
+
* "are these tiers decided?" goes through here rather than re-deriving it.
|
|
172
|
+
*
|
|
173
|
+
* - declared → that value;
|
|
174
|
+
* - absent with plans → `CREATOR_STATED`. Exact rather than a fallback: the
|
|
175
|
+
* generated contract always declares the status, so an absent one can only
|
|
176
|
+
* come from a hand-authored file, and a person who wrote plans into the
|
|
177
|
+
* family file stated them;
|
|
178
|
+
* - absent and empty → `undefined`: NOT `UNDECIDED`. Nobody has answered, which
|
|
179
|
+
* is the "not sketched yet" state the validator reports as `NO_PLANS`.
|
|
180
|
+
* Conflating it with a considered "not decided" would silence that warning.
|
|
181
|
+
*/
|
|
182
|
+
export declare function resolvePricingTiersStatus(snapshot: Pick<BusinessModelLiteSnapshot, 'plans' | 'pricingTiers'>): PricingTiersStatus | undefined;
|
|
124
183
|
/** @wildo_source:part:end business-model.snapshot.config */
|
|
125
184
|
//# sourceMappingURL=business-model-lite-snapshot.schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business-model-lite-snapshot.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/_core/business-model-lite/business-model-lite-snapshot.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;GASG;AACH,oBAAY,gCAAgC;IAC1C,EAAE,OAAO;CACV;AAED;;;;;;;;;;;;;;;GAeG;AACH,oBAAY,gBAAgB;IAC1B,sDAAsD;IACtD,YAAY,iBAAiB;IAC7B,4CAA4C;IAC5C,WAAW,gBAAgB;IAC3B,0CAA0C;IAC1C,iBAAiB,sBAAsB;IACvC,iEAAiE;IACjE,QAAQ,aAAa;IACrB,0DAA0D;IAC1D,sBAAsB,2BAA2B;IACjD,yCAAyC;IACzC,WAAW,gBAAgB;IAC3B,sDAAsD;IACtD,KAAK,UAAU;CAChB;AAED
|
|
1
|
+
{"version":3,"file":"business-model-lite-snapshot.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/_core/business-model-lite/business-model-lite-snapshot.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;GASG;AACH,oBAAY,gCAAgC;IAC1C,EAAE,OAAO;CACV;AAED;;;;;;;;;;;;;;;GAeG;AACH,oBAAY,gBAAgB;IAC1B,sDAAsD;IACtD,YAAY,iBAAiB;IAC7B,4CAA4C;IAC5C,WAAW,gBAAgB;IAC3B,0CAA0C;IAC1C,iBAAiB,sBAAsB;IACvC,iEAAiE;IACjE,QAAQ,aAAa;IACrB,0DAA0D;IAC1D,sBAAsB,2BAA2B;IACjD,yCAAyC;IACzC,WAAW,gBAAgB;IAC3B,sDAAsD;IACtD,KAAK,UAAU;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,oBAAY,kBAAkB;IAC5B,kEAAkE;IAClE,cAAc,mBAAmB;IACjC;;;;;;;;;OASG;IACH,QAAQ,aAAa;IACrB;;;;;OAKG;IACH,SAAS,cAAc;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;iBAU1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,yBAAyB,EAAE,OAAO,GAAG,cAAc,CAAC,GAAG,kBAAkB,GAAG,SAAS,CAG7I;AACD,4DAA4D"}
|
|
@@ -47,6 +47,44 @@ export var RevenueModelKind;
|
|
|
47
47
|
/** Anything the fixed models above do not capture. */
|
|
48
48
|
RevenueModelKind["OTHER"] = "other";
|
|
49
49
|
})(RevenueModelKind || (RevenueModelKind = {}));
|
|
50
|
+
/**
|
|
51
|
+
* Where the snapshot's pricing TIERS came from — the creator's answer to "what
|
|
52
|
+
* tiers do you plan to sell?", recorded as a fact rather than inferred from the
|
|
53
|
+
* shape of `plans`.
|
|
54
|
+
*
|
|
55
|
+
* ## Why this is a field and not "plans is empty"
|
|
56
|
+
*
|
|
57
|
+
* An empty `plans` used to carry two meanings that send a reader to opposite
|
|
58
|
+
* places: "nobody has sketched pricing yet" (work owed) and "the creator has
|
|
59
|
+
* considered it and not decided" (a real answer, nothing owed). And a non-empty
|
|
60
|
+
* `plans` could not say whether its tiers were the creator's or a proposal the
|
|
61
|
+
* creator asked for. The generated contract (`BusinessModelLiteSnapshotGenerationSchema`)
|
|
62
|
+
* therefore requires this status, so an empty sketch is always a STATEMENT and
|
|
63
|
+
* never a vacuous `{}`.
|
|
64
|
+
*/
|
|
65
|
+
export var PricingTiersStatus;
|
|
66
|
+
(function (PricingTiersStatus) {
|
|
67
|
+
/** `plans` are the tiers the creator named. At least one plan. */
|
|
68
|
+
PricingTiersStatus["CREATOR_STATED"] = "creator_stated";
|
|
69
|
+
/**
|
|
70
|
+
* The creator asked for tiers to be PROPOSED (typically "derive them from the
|
|
71
|
+
* market research"), so `plans` were derived rather than named. Each carries a
|
|
72
|
+
* `proposalBasis`, and none carries a price or scaling axis the creator did
|
|
73
|
+
* not state. At least one plan.
|
|
74
|
+
*
|
|
75
|
+
* This records ORIGIN, not a pending state: it stays `proposed` after the
|
|
76
|
+
* creator accepts the plans, because acceptance is the commit that lands the
|
|
77
|
+
* artifact, not a value of this field.
|
|
78
|
+
*/
|
|
79
|
+
PricingTiersStatus["PROPOSED"] = "proposed";
|
|
80
|
+
/**
|
|
81
|
+
* The creator has not decided the tiers and did not ask for a proposal.
|
|
82
|
+
* `plans` is empty, and that emptiness is an answer, not a gap: nothing
|
|
83
|
+
* downstream may read it as "free" or as "no billing", because
|
|
84
|
+
* `revenueModel` still says how the product makes money.
|
|
85
|
+
*/
|
|
86
|
+
PricingTiersStatus["UNDECIDED"] = "undecided";
|
|
87
|
+
})(PricingTiersStatus || (PricingTiersStatus = {}));
|
|
50
88
|
/**
|
|
51
89
|
* THE business-model-lite-snapshot payload — a **single aggregate per
|
|
52
90
|
* product** (market / vision / requirements / roadmap style), NOT a keyed
|
|
@@ -93,6 +131,12 @@ export var RevenueModelKind;
|
|
|
93
131
|
* surfaced as a WARN by `validateBusinessModelLiteSnapshot`, never a parse
|
|
94
132
|
* failure. Plans are NOT inherently ordered (unlike roadmap phases), so no
|
|
95
133
|
* `sequence` ordering key is modelled.
|
|
134
|
+
* - **`pricingTiers`** — where the plans came from (`PricingTiersStatus`):
|
|
135
|
+
* stated by the creator, proposed at the creator's request, or undecided
|
|
136
|
+
* (then `plans` is empty BY ANSWER). Optional on a hand-authored file; read
|
|
137
|
+
* it through `resolvePricingTiersStatus`, never directly, so the meaning of
|
|
138
|
+
* an absent value lives in one place. Its agreement with `plans` is checked
|
|
139
|
+
* by `validateBusinessModelLiteSnapshot`.
|
|
96
140
|
*
|
|
97
141
|
* Authored entirely in English (like the vision / market / requirements /
|
|
98
142
|
* roadmap families). Authoring-consistency (duplicate refs, ref format,
|
|
@@ -109,6 +153,26 @@ export const BusinessModelLiteSnapshotSchema = z.object({
|
|
|
109
153
|
revenueModel: z.enum(RevenueModelKind).optional(),
|
|
110
154
|
/** The pricing tiers / packages of the pricing sketch. Ref-addressable. */
|
|
111
155
|
plans: z.array(PricingPlanConfigSchema).default([]),
|
|
156
|
+
/** Where the plans came from. Optional — read through `resolvePricingTiersStatus`. */
|
|
157
|
+
pricingTiers: z.enum(PricingTiersStatus).optional(),
|
|
112
158
|
});
|
|
159
|
+
/**
|
|
160
|
+
* The ONE place an absent `pricingTiers` is interpreted. Every reader that asks
|
|
161
|
+
* "are these tiers decided?" goes through here rather than re-deriving it.
|
|
162
|
+
*
|
|
163
|
+
* - declared → that value;
|
|
164
|
+
* - absent with plans → `CREATOR_STATED`. Exact rather than a fallback: the
|
|
165
|
+
* generated contract always declares the status, so an absent one can only
|
|
166
|
+
* come from a hand-authored file, and a person who wrote plans into the
|
|
167
|
+
* family file stated them;
|
|
168
|
+
* - absent and empty → `undefined`: NOT `UNDECIDED`. Nobody has answered, which
|
|
169
|
+
* is the "not sketched yet" state the validator reports as `NO_PLANS`.
|
|
170
|
+
* Conflating it with a considered "not decided" would silence that warning.
|
|
171
|
+
*/
|
|
172
|
+
export function resolvePricingTiersStatus(snapshot) {
|
|
173
|
+
if (snapshot.pricingTiers !== undefined)
|
|
174
|
+
return snapshot.pricingTiers;
|
|
175
|
+
return snapshot.plans.length > 0 ? PricingTiersStatus.CREATOR_STATED : undefined;
|
|
176
|
+
}
|
|
113
177
|
/** @wildo_source:part:end business-model.snapshot.config */
|
|
114
178
|
//# sourceMappingURL=business-model-lite-snapshot.schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business-model-lite-snapshot.schemas.js","sourceRoot":"","sources":["../../../../../src/_core/business-model-lite/business-model-lite-snapshot.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;;;;;;GASG;AACH,MAAM,CAAN,IAAY,gCAEX;AAFD,WAAY,gCAAgC;IAC1C,6CAAS,CAAA;AACX,CAAC,EAFW,gCAAgC,KAAhC,gCAAgC,QAE3C;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAN,IAAY,gBAeX;AAfD,WAAY,gBAAgB;IAC1B,sDAAsD;IACtD,iDAA6B,CAAA;IAC7B,4CAA4C;IAC5C,+CAA2B,CAAA;IAC3B,0CAA0C;IAC1C,2DAAuC,CAAA;IACvC,iEAAiE;IACjE,yCAAqB,CAAA;IACrB,0DAA0D;IAC1D,qEAAiD,CAAA;IACjD,yCAAyC;IACzC,+CAA2B,CAAA;IAC3B,sDAAsD;IACtD,mCAAe,CAAA;AACjB,CAAC,EAfW,gBAAgB,KAAhB,gBAAgB,QAe3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,OAAO,EAAE,CAAC;SACP,IAAI,CAAC,gCAAgC,CAAC;SACtC,OAAO,CAAC,gCAAgC,CAAC,EAAE,CAAC;IAC/C,mEAAmE;IACnE,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE;IACjD,2EAA2E;IAC3E,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACpD,CAAC,CAAC;AAEH,4DAA4D","sourcesContent":["import { z } from 'zod';\n\nimport { PricingPlanConfigSchema } from './pricing-plan.schemas';\n\n/**\n * @wildo_source:part:start business-model.snapshot.config facet:layer:specification facet:family:business-model\n *\n * Versioning for the business-model-lite-snapshot payload format itself.\n * `V1` — initial shape (a product-level `revenueModel` + a single `plans`\n * collection). The shape grows additively across versions — older callers\n * keep parsing newer payloads via `default([])` / optional semantics on the\n * additive members; the `version` field is the explicit marker for\n * consumers that need to branch on era.\n */\nexport enum BusinessModelLiteSnapshotVersion {\n V1 = 'v1',\n}\n\n/**\n * Coarse product-level revenue-model classification — HOW the product makes\n * money, at the whole-product grain. Fixed vocabulary (enum, per project\n * rule — enums over literal unions). `OTHER` catches models the fixed\n * buckets miss. Optional on the snapshot.\n *\n * Placed at the SNAPSHOT ROOT rather than per-plan (design decision): a\n * product has ONE primary revenue model (it \"is a subscription business\" /\n * \"is a marketplace\"), while its individual plans vary along the\n * finer-grained `PricingModelAxis` (how each plan's price scales). Modelling\n * the revenue model per-plan would conflate the product's business shape\n * with a plan's billing mechanics — two distinct concepts (framework\n * mindset: no folding of distinct meanings for convenience). A product whose\n * plans genuinely span revenue models is a J2 concern (a typed\n * multi-revenue-stream model), not a scaffold-depth per-plan enum.\n */\nexport enum RevenueModelKind {\n /** Recurring subscription fees (per-seat or flat). */\n SUBSCRIPTION = 'subscription',\n /** Metered / consumption-based charging. */\n USAGE_BASED = 'usage_based',\n /** One-off purchase, no recurring fee. */\n ONE_TIME_PURCHASE = 'one_time_purchase',\n /** Free core with paid upgrades (freemium conversion funnel). */\n FREEMIUM = 'freemium',\n /** Commission / take-rate on marketplace transactions. */\n MARKETPLACE_COMMISSION = 'marketplace_commission',\n /** Advertising / sponsorship revenue. */\n ADVERTISING = 'advertising',\n /** Anything the fixed models above do not capture. */\n OTHER = 'other',\n}\n\n/**\n * THE business-model-lite-snapshot payload — a **single aggregate per\n * product** (market / vision / requirements / roadmap style), NOT a keyed\n * entries map (assertions style): there is exactly one business model per\n * application. It is the business-model-layer artifact the app-creation\n * top-down catalog reads/writes (C-4 definition families).\n *\n * **Artifact-family id: `business-model`.** This schema is the shape of the\n * journey artifact selected by\n * `MetaWorkflow_ArtifactSelector.family === 'business-model'` (alongside the\n * `market-snapshot` / `vision-brief` / `requirements` / `roadmap` ids). The\n * `-lite` in this family's directory / type names is the SCAFFOLD-DEPTH\n * qualifier of the Phase-J1 increment, NOT the artifact-family name — a J2\n * increment deepens the model without renaming the family. The `family`\n * vocabulary is an OPEN string by design (owned by the assertion surface,\n * not a frozen enum — see `MetaWorkflow_ArtifactSelectorSchema`), so it is\n * intentionally NOT re-declared as a constant here; this note is the single\n * place that ties the `BusinessModelLiteSnapshot` SHAPE to the\n * `business-model` family NAME so the catalog and the WT dogfood (D1) select\n * it consistently.\n *\n * **Boundary (framework mindset — the member carries its own semantic\n * weight, no folding into the billing/Stripe product-catalog runtime, or\n * into `ProductSpecification` / the vision / requirements / roadmap / market\n * families):** this is a PLANNING artifact — a design-time sketch of how the\n * product intends to make money — NOT the live billing catalog. It models\n * intent (a revenue model + pricing-plan sketches), never chargeable state.\n * The billing runtime remains the operational source of truth for what is\n * actually billable.\n *\n * Shape decision:\n *\n * - **`revenueModel`** — the coarse product-level revenue classification\n * (`RevenueModelKind`), at the snapshot root (one revenue model per\n * product). Optional — a not-yet-classified business model is a first-class\n * \"not yet decided\" state, never a parse failure. When `plans` are authored\n * but this is left unset, `validateBusinessModelLiteSnapshot` surfaces a\n * `NO_REVENUE_MODEL` WARN (the pricing is sketched but the product's\n * headline revenue model is undeclared).\n * - **`plans`** — the ONE ref-addressable collection: the pricing tiers /\n * packages of the pricing sketch (`default([])`), each optionally\n * cross-referencing the market ICPs it targets and the requirements it\n * includes. An empty collection is a first-class \"not yet sketched\" state\n * surfaced as a WARN by `validateBusinessModelLiteSnapshot`, never a parse\n * failure. Plans are NOT inherently ordered (unlike roadmap phases), so no\n * `sequence` ordering key is modelled.\n *\n * Authored entirely in English (like the vision / market / requirements /\n * roadmap families). Authoring-consistency (duplicate refs, ref format,\n * incompleteness, staleness, duplicate / dangling cross-refs) is checked by\n * `validateBusinessModelLiteSnapshot` (see\n * `business-model-lite-snapshot-validation.ts`); Zod enforces only\n * structural validity here.\n */\nexport const BusinessModelLiteSnapshotSchema = z.object({\n version: z\n .enum(BusinessModelLiteSnapshotVersion)\n .default(BusinessModelLiteSnapshotVersion.V1),\n /** Coarse product-level revenue-model classification. Optional. */\n revenueModel: z.enum(RevenueModelKind).optional(),\n /** The pricing tiers / packages of the pricing sketch. Ref-addressable. */\n plans: z.array(PricingPlanConfigSchema).default([]),\n});\nexport type BusinessModelLiteSnapshot = z.infer<typeof BusinessModelLiteSnapshotSchema>;\n/** @wildo_source:part:end business-model.snapshot.config */\n"]}
|
|
1
|
+
{"version":3,"file":"business-model-lite-snapshot.schemas.js","sourceRoot":"","sources":["../../../../../src/_core/business-model-lite/business-model-lite-snapshot.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;;;;;;GASG;AACH,MAAM,CAAN,IAAY,gCAEX;AAFD,WAAY,gCAAgC;IAC1C,6CAAS,CAAA;AACX,CAAC,EAFW,gCAAgC,KAAhC,gCAAgC,QAE3C;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAN,IAAY,gBAeX;AAfD,WAAY,gBAAgB;IAC1B,sDAAsD;IACtD,iDAA6B,CAAA;IAC7B,4CAA4C;IAC5C,+CAA2B,CAAA;IAC3B,0CAA0C;IAC1C,2DAAuC,CAAA;IACvC,iEAAiE;IACjE,yCAAqB,CAAA;IACrB,0DAA0D;IAC1D,qEAAiD,CAAA;IACjD,yCAAyC;IACzC,+CAA2B,CAAA;IAC3B,sDAAsD;IACtD,mCAAe,CAAA;AACjB,CAAC,EAfW,gBAAgB,KAAhB,gBAAgB,QAe3B;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAN,IAAY,kBAqBX;AArBD,WAAY,kBAAkB;IAC5B,kEAAkE;IAClE,uDAAiC,CAAA;IACjC;;;;;;;;;OASG;IACH,2CAAqB,CAAA;IACrB;;;;;OAKG;IACH,6CAAuB,CAAA;AACzB,CAAC,EArBW,kBAAkB,KAAlB,kBAAkB,QAqB7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,OAAO,EAAE,CAAC;SACP,IAAI,CAAC,gCAAgC,CAAC;SACtC,OAAO,CAAC,gCAAgC,CAAC,EAAE,CAAC;IAC/C,mEAAmE;IACnE,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE;IACjD,2EAA2E;IAC3E,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACnD,sFAAsF;IACtF,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAAmE;IAC3G,IAAI,QAAQ,CAAC,YAAY,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC,YAAY,CAAC;IACtE,OAAO,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC;AACnF,CAAC;AACD,4DAA4D","sourcesContent":["import { z } from 'zod';\n\nimport { PricingPlanConfigSchema } from './pricing-plan.schemas';\n\n/**\n * @wildo_source:part:start business-model.snapshot.config facet:layer:specification facet:family:business-model\n *\n * Versioning for the business-model-lite-snapshot payload format itself.\n * `V1` — initial shape (a product-level `revenueModel` + a single `plans`\n * collection). The shape grows additively across versions — older callers\n * keep parsing newer payloads via `default([])` / optional semantics on the\n * additive members; the `version` field is the explicit marker for\n * consumers that need to branch on era.\n */\nexport enum BusinessModelLiteSnapshotVersion {\n V1 = 'v1',\n}\n\n/**\n * Coarse product-level revenue-model classification — HOW the product makes\n * money, at the whole-product grain. Fixed vocabulary (enum, per project\n * rule — enums over literal unions). `OTHER` catches models the fixed\n * buckets miss. Optional on the snapshot.\n *\n * Placed at the SNAPSHOT ROOT rather than per-plan (design decision): a\n * product has ONE primary revenue model (it \"is a subscription business\" /\n * \"is a marketplace\"), while its individual plans vary along the\n * finer-grained `PricingModelAxis` (how each plan's price scales). Modelling\n * the revenue model per-plan would conflate the product's business shape\n * with a plan's billing mechanics — two distinct concepts (framework\n * mindset: no folding of distinct meanings for convenience). A product whose\n * plans genuinely span revenue models is a J2 concern (a typed\n * multi-revenue-stream model), not a scaffold-depth per-plan enum.\n */\nexport enum RevenueModelKind {\n /** Recurring subscription fees (per-seat or flat). */\n SUBSCRIPTION = 'subscription',\n /** Metered / consumption-based charging. */\n USAGE_BASED = 'usage_based',\n /** One-off purchase, no recurring fee. */\n ONE_TIME_PURCHASE = 'one_time_purchase',\n /** Free core with paid upgrades (freemium conversion funnel). */\n FREEMIUM = 'freemium',\n /** Commission / take-rate on marketplace transactions. */\n MARKETPLACE_COMMISSION = 'marketplace_commission',\n /** Advertising / sponsorship revenue. */\n ADVERTISING = 'advertising',\n /** Anything the fixed models above do not capture. */\n OTHER = 'other',\n}\n\n/**\n * Where the snapshot's pricing TIERS came from — the creator's answer to \"what\n * tiers do you plan to sell?\", recorded as a fact rather than inferred from the\n * shape of `plans`.\n *\n * ## Why this is a field and not \"plans is empty\"\n *\n * An empty `plans` used to carry two meanings that send a reader to opposite\n * places: \"nobody has sketched pricing yet\" (work owed) and \"the creator has\n * considered it and not decided\" (a real answer, nothing owed). And a non-empty\n * `plans` could not say whether its tiers were the creator's or a proposal the\n * creator asked for. The generated contract (`BusinessModelLiteSnapshotGenerationSchema`)\n * therefore requires this status, so an empty sketch is always a STATEMENT and\n * never a vacuous `{}`.\n */\nexport enum PricingTiersStatus {\n /** `plans` are the tiers the creator named. At least one plan. */\n CREATOR_STATED = 'creator_stated',\n /**\n * The creator asked for tiers to be PROPOSED (typically \"derive them from the\n * market research\"), so `plans` were derived rather than named. Each carries a\n * `proposalBasis`, and none carries a price or scaling axis the creator did\n * not state. At least one plan.\n *\n * This records ORIGIN, not a pending state: it stays `proposed` after the\n * creator accepts the plans, because acceptance is the commit that lands the\n * artifact, not a value of this field.\n */\n PROPOSED = 'proposed',\n /**\n * The creator has not decided the tiers and did not ask for a proposal.\n * `plans` is empty, and that emptiness is an answer, not a gap: nothing\n * downstream may read it as \"free\" or as \"no billing\", because\n * `revenueModel` still says how the product makes money.\n */\n UNDECIDED = 'undecided',\n}\n\n/**\n * THE business-model-lite-snapshot payload — a **single aggregate per\n * product** (market / vision / requirements / roadmap style), NOT a keyed\n * entries map (assertions style): there is exactly one business model per\n * application. It is the business-model-layer artifact the app-creation\n * top-down catalog reads/writes (C-4 definition families).\n *\n * **Artifact-family id: `business-model`.** This schema is the shape of the\n * journey artifact selected by\n * `MetaWorkflow_ArtifactSelector.family === 'business-model'` (alongside the\n * `market-snapshot` / `vision-brief` / `requirements` / `roadmap` ids). The\n * `-lite` in this family's directory / type names is the SCAFFOLD-DEPTH\n * qualifier of the Phase-J1 increment, NOT the artifact-family name — a J2\n * increment deepens the model without renaming the family. The `family`\n * vocabulary is an OPEN string by design (owned by the assertion surface,\n * not a frozen enum — see `MetaWorkflow_ArtifactSelectorSchema`), so it is\n * intentionally NOT re-declared as a constant here; this note is the single\n * place that ties the `BusinessModelLiteSnapshot` SHAPE to the\n * `business-model` family NAME so the catalog and the WT dogfood (D1) select\n * it consistently.\n *\n * **Boundary (framework mindset — the member carries its own semantic\n * weight, no folding into the billing/Stripe product-catalog runtime, or\n * into `ProductSpecification` / the vision / requirements / roadmap / market\n * families):** this is a PLANNING artifact — a design-time sketch of how the\n * product intends to make money — NOT the live billing catalog. It models\n * intent (a revenue model + pricing-plan sketches), never chargeable state.\n * The billing runtime remains the operational source of truth for what is\n * actually billable.\n *\n * Shape decision:\n *\n * - **`revenueModel`** — the coarse product-level revenue classification\n * (`RevenueModelKind`), at the snapshot root (one revenue model per\n * product). Optional — a not-yet-classified business model is a first-class\n * \"not yet decided\" state, never a parse failure. When `plans` are authored\n * but this is left unset, `validateBusinessModelLiteSnapshot` surfaces a\n * `NO_REVENUE_MODEL` WARN (the pricing is sketched but the product's\n * headline revenue model is undeclared).\n * - **`plans`** — the ONE ref-addressable collection: the pricing tiers /\n * packages of the pricing sketch (`default([])`), each optionally\n * cross-referencing the market ICPs it targets and the requirements it\n * includes. An empty collection is a first-class \"not yet sketched\" state\n * surfaced as a WARN by `validateBusinessModelLiteSnapshot`, never a parse\n * failure. Plans are NOT inherently ordered (unlike roadmap phases), so no\n * `sequence` ordering key is modelled.\n * - **`pricingTiers`** — where the plans came from (`PricingTiersStatus`):\n * stated by the creator, proposed at the creator's request, or undecided\n * (then `plans` is empty BY ANSWER). Optional on a hand-authored file; read\n * it through `resolvePricingTiersStatus`, never directly, so the meaning of\n * an absent value lives in one place. Its agreement with `plans` is checked\n * by `validateBusinessModelLiteSnapshot`.\n *\n * Authored entirely in English (like the vision / market / requirements /\n * roadmap families). Authoring-consistency (duplicate refs, ref format,\n * incompleteness, staleness, duplicate / dangling cross-refs) is checked by\n * `validateBusinessModelLiteSnapshot` (see\n * `business-model-lite-snapshot-validation.ts`); Zod enforces only\n * structural validity here.\n */\nexport const BusinessModelLiteSnapshotSchema = z.object({\n version: z\n .enum(BusinessModelLiteSnapshotVersion)\n .default(BusinessModelLiteSnapshotVersion.V1),\n /** Coarse product-level revenue-model classification. Optional. */\n revenueModel: z.enum(RevenueModelKind).optional(),\n /** The pricing tiers / packages of the pricing sketch. Ref-addressable. */\n plans: z.array(PricingPlanConfigSchema).default([]),\n /** Where the plans came from. Optional — read through `resolvePricingTiersStatus`. */\n pricingTiers: z.enum(PricingTiersStatus).optional(),\n});\nexport type BusinessModelLiteSnapshot = z.infer<typeof BusinessModelLiteSnapshotSchema>;\n\n/**\n * The ONE place an absent `pricingTiers` is interpreted. Every reader that asks\n * \"are these tiers decided?\" goes through here rather than re-deriving it.\n *\n * - declared → that value;\n * - absent with plans → `CREATOR_STATED`. Exact rather than a fallback: the\n * generated contract always declares the status, so an absent one can only\n * come from a hand-authored file, and a person who wrote plans into the\n * family file stated them;\n * - absent and empty → `undefined`: NOT `UNDECIDED`. Nobody has answered, which\n * is the \"not sketched yet\" state the validator reports as `NO_PLANS`.\n * Conflating it with a considered \"not decided\" would silence that warning.\n */\nexport function resolvePricingTiersStatus(snapshot: Pick<BusinessModelLiteSnapshot, 'plans' | 'pricingTiers'>): PricingTiersStatus | undefined {\n if (snapshot.pricingTiers !== undefined) return snapshot.pricingTiers;\n return snapshot.plans.length > 0 ? PricingTiersStatus.CREATOR_STATED : undefined;\n}\n/** @wildo_source:part:end business-model.snapshot.config */\n"]}
|
|
@@ -33,6 +33,8 @@ import '@wildo-ai/zod-decorators';
|
|
|
33
33
|
* - **`targetSummary`** — who the plan is for, in prose ("mid-market teams
|
|
34
34
|
* of 10-50"). Optional. A human summary, distinct from the typed
|
|
35
35
|
* `targetIcpRefs` cross-reference.
|
|
36
|
+
* - **`proposalBasis`** — on a PROPOSED plan only: what the proposal was
|
|
37
|
+
* derived from (see `PricingTiersStatus` on the snapshot). Optional prose.
|
|
36
38
|
* - **`targetIcpRefs`** / **`includesRequirementRefs`** — OPTIONAL flat
|
|
37
39
|
* cross-references into the market family (ICP segments this plan targets)
|
|
38
40
|
* and the requirements family (functional requirements this plan
|
|
@@ -78,6 +80,7 @@ export declare const PricingPlanConfigSchema: z.ZodObject<{
|
|
|
78
80
|
targetSummary: z.ZodOptional<z.ZodString>;
|
|
79
81
|
targetIcpRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
80
82
|
includesRequirementRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
+
proposalBasis: z.ZodOptional<z.ZodString>;
|
|
81
84
|
authored: z.ZodOptional<z.ZodObject<{
|
|
82
85
|
lastAuthoredAt: z.ZodISODateTime;
|
|
83
86
|
confidence: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodEnum<typeof import("..").AuthoredConfidence>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricing-plan.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/_core/business-model-lite/pricing-plan.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,0BAA0B,CAAC;AAMlC
|
|
1
|
+
{"version":3,"file":"pricing-plan.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/_core/business-model-lite/pricing-plan.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,0BAA0B,CAAC;AAMlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH;;;;;;;GAOG;AACH,oBAAY,gBAAgB;IAC1B,oDAAoD;IACpD,SAAS,cAAc;IACvB,qDAAqD;IACrD,QAAQ,aAAa;IACrB,oEAAoE;IACpE,SAAS,cAAc;IACvB,4EAA4E;IAC5E,MAAM,WAAW;IACjB,mDAAmD;IACnD,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;iBAsDlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,gEAAgE"}
|