@crvouga/mockingbird-service-rxvortex 3.13.0 → 3.14.1
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/CHANGELOG.md +18 -1
- package/dist/chunk-4PYIJTMH.js +120 -0
- package/dist/chunk-4PYIJTMH.js.map +7 -0
- package/dist/chunk-GTPGV2ML.js +836 -0
- package/dist/chunk-GTPGV2ML.js.map +7 -0
- package/dist/cli.js +3 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +114 -106
- package/dist/index.js +1 -2
- package/dist/server.d.ts +45 -37
- package/dist/server.js +2 -3
- package/package.json +3 -2
- package/dist/admin-ui.js +0 -27
- package/dist/admin-ui.js.map +0 -7
- package/dist/chunk-5T5YCIQJ.js +0 -6631
- package/dist/chunk-5T5YCIQJ.js.map +0 -7
- package/dist/chunk-7MPHLPSO.js +0 -7
- package/dist/chunk-7MPHLPSO.js.map +0 -7
- package/dist/chunk-PJSVRZL5.js +0 -5169
- package/dist/chunk-PJSVRZL5.js.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["<define:__MOCKINGBIRD_ADMIN_BRAND__>", "mockingbird-service-runtime:@crvouga/mockingbird-runtime/service", "../src/generated/openapi.ts", "../src/catalog.ts", "../src/state.ts", "../src/statuses.ts", "../src/runtime.ts", "../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["{\"vendor\":\"RxVortex\",\"website\":\"https://www.rxvortex.com\",\"docs\":null,\"guide\":\"https://mockingbird.chrisvouga.dev/services/rxvortex\",\"logo\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAAACXBIWXMAAC4jAAAuIwF4pT92AAAGPGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOW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AAAAEFhAAAABIUBAAAQFAYAAEBQ/w+UVw47gow2AQAAAABJRU5ErkJggg==\",\"color\":null,\"description\":\"RxVortex is a pharmacy order platform whose API lets telehealth partners submit, track and cancel prescription orders with pharmacies such as Strive.\"}", "export * from \"@crvouga/mockingbird-runtime/service\"\nimport { PACKAGE_VERSION as SHARED_VERSION, createRuntime as sharedRuntime } from \"@crvouga/mockingbird-runtime/service\"\nexport const PACKAGE_VERSION =\n typeof __MOCKINGBIRD_PACKAGE_VERSION__ === \"string\" ? __MOCKINGBIRD_PACKAGE_VERSION__ : SHARED_VERSION\nconst ADMIN_BRAND =\n typeof __MOCKINGBIRD_ADMIN_BRAND__ === \"object\" ? __MOCKINGBIRD_ADMIN_BRAND__ : undefined\nexport const createRuntime = (options) =>\n sharedRuntime({\n ...options,\n version: options.version ?? PACKAGE_VERSION,\n adminBrand: options.adminBrand ?? ADMIN_BRAND,\n })\n", "// Generated by @crvouga/mockingbird-openapi-codegen from openapi.yaml. Do not edit.\n\nimport type { OpenAPIDocument } from \"@crvouga/mockingbird-openapi\"\n\nexport const document: OpenAPIDocument = JSON.parse(`{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"RxVortex (Strive) pharmacy API (Mockingbird subset)\",\"description\":\"Stateful emulator subset of the RxVortex / Strive compounding-pharmacy API: client-credentials\\\\ntoken, order submit, status, cancel, lookup by sender order id (recovery), and the preset\\\\ncatalog. Hand-authored from the consumer's adapters (the vendor publishes no spec).\\\\n\",\"version\":\"1\",\"x-mockingbird-upstream\":{\"note\":\"Hand-authored from the wire shapes our consumer reads and writes (rxvortex-auth.service.ts, rxvortex-fulfillment.adapter.ts, rxvortex-live.client.ts).\"}},\"servers\":[{\"url\":\"https://sandbox.rxvortex.com\"}],\"security\":[{\"bearerAuth\":[]}],\"paths\":{\"/api/v1/generate-access-token\":{\"post\":{\"operationId\":\"GenerateAccessToken\",\"security\":[],\"x-mockingbird\":{\"supported\":true,\"parity\":{\"enabled\":true,\"safe\":true}},\"requestBody\":{\"required\":true,\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"required\":[\"client_id\",\"client_secret\"],\"properties\":{\"client_id\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":64},\"client_secret\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":64}}}}}},\"responses\":{\"200\":{\"description\":\"Access token\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/TokenResponse\"}}}},\"401\":{\"description\":\"Bad credentials\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorBody\"}}}},\"422\":{\"description\":\"Validation failed\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ValidationError\"}}}}}}},\"/api/v1/orders\":{\"post\":{\"operationId\":\"CreateOrder\",\"x-mockingbird\":{\"supported\":true,\"parity\":{\"enabled\":true,\"safe\":false}},\"requestBody\":{\"required\":true,\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/CreateOrderBody\"}}}},\"responses\":{\"200\":{\"description\":\"Order accepted\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/CreateOrderResponse\"}}}},\"401\":{\"description\":\"Unauthenticated\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorBody\"}}}},\"409\":{\"description\":\"Duplicate sender_order_id\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorBody\"}}}},\"422\":{\"description\":\"Validation failed\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ValidationError\"}}}}}}},\"/api/v1/orders/{orderId}\":{\"parameters\":[{\"name\":\"orderId\",\"in\":\"path\",\"required\":true,\"description\":\"The vendor order tracking id, or the sender order id (our payment id).\",\"schema\":{\"type\":\"string\",\"x-mockingbird-resource-ref\":{\"type\":\"order\",\"missing\":\"RXV-00000000-MISSING\"}}}],\"get\":{\"operationId\":\"GetOrder\",\"x-mockingbird\":{\"supported\":true,\"parity\":{\"enabled\":true,\"safe\":true}},\"responses\":{\"200\":{\"description\":\"Order status\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/OrderStatus\"}}}},\"401\":{\"description\":\"Unauthenticated\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorBody\"}}}},\"404\":{\"description\":\"Unknown order\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorBody\"}}}}}},\"delete\":{\"operationId\":\"CancelOrder\",\"x-mockingbird\":{\"supported\":true,\"parity\":{\"enabled\":true,\"safe\":false}},\"responses\":{\"200\":{\"description\":\"Cancelled\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/CancelResponse\"}}}},\"401\":{\"description\":\"Unauthenticated\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorBody\"}}}},\"404\":{\"description\":\"Unknown order\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorBody\"}}}},\"409\":{\"description\":\"Not cancellable in its current status\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorBody\"}}}}}}},\"/api/v1/preset-catalog-items\":{\"get\":{\"operationId\":\"ListPresetCatalogItems\",\"x-mockingbird\":{\"supported\":true,\"parity\":{\"enabled\":true,\"safe\":true}},\"responses\":{\"200\":{\"description\":\"Preset catalog\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"required\":[\"data\"],\"properties\":{\"data\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/CatalogItem\"}}}}}}},\"401\":{\"description\":\"Unauthenticated\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ErrorBody\"}}}}}}}},\"components\":{\"securitySchemes\":{\"bearerAuth\":{\"type\":\"http\",\"scheme\":\"bearer\"}},\"schemas\":{\"TokenResponse\":{\"type\":\"object\",\"required\":[\"access_token\",\"token_type\",\"expires_in\"],\"properties\":{\"access_token\":{\"type\":\"string\",\"x-mockingbird-volatile\":{\"kind\":\"token\"}},\"token_type\":{\"type\":\"string\",\"enum\":[\"Bearer\"]},\"expires_in\":{\"type\":\"integer\"}}},\"Address\":{\"type\":\"object\",\"required\":[\"line1\",\"city\",\"state\",\"postal_code\",\"country\"],\"properties\":{\"line1\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":80},\"line2\":{\"type\":\"string\",\"maxLength\":80},\"city\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":40},\"state\":{\"type\":\"string\",\"pattern\":\"^[A-Z]{2}$\"},\"postal_code\":{\"type\":\"string\",\"pattern\":\"^[0-9]{5}(-[0-9]{4})?$\"},\"country\":{\"type\":\"string\",\"enum\":[\"US\"]}}},\"Patient\":{\"type\":\"object\",\"required\":[\"sender_patient_id\",\"first_name\",\"last_name\",\"dob\",\"gender\",\"email\",\"phone\",\"address\"],\"properties\":{\"sender_patient_id\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":64},\"first_name\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":40},\"last_name\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":40},\"dob\":{\"type\":\"string\",\"pattern\":\"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$\"},\"gender\":{\"type\":\"string\",\"enum\":[\"male\",\"female\"]},\"email\":{\"type\":\"string\",\"format\":\"email\",\"maxLength\":120},\"phone\":{\"type\":\"string\",\"pattern\":\"^[0-9]{3}-[0-9]{3}-[0-9]{4}$\"},\"address\":{\"$ref\":\"#/components/schemas/Address\"}}},\"Prescriber\":{\"type\":\"object\",\"required\":[\"first_name\",\"last_name\",\"npi\"],\"properties\":{\"first_name\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":40},\"last_name\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":40},\"npi\":{\"type\":\"string\",\"pattern\":\"^[0-9]{10}$\"},\"dea_number\":{\"type\":\"string\",\"maxLength\":20},\"license_number\":{\"type\":\"string\",\"maxLength\":20},\"license_state\":{\"type\":\"string\",\"maxLength\":2},\"phone\":{\"type\":\"string\",\"maxLength\":20},\"address\":{\"$ref\":\"#/components/schemas/Address\"}}},\"MedicationRequest\":{\"type\":\"object\",\"required\":[\"type\",\"preset_catalog_id\",\"sender_med_request_id\",\"medication_name\",\"quantity\",\"quantity_units\",\"days_supply_duration\",\"refills\",\"instructions\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"new\"]},\"preset_catalog_id\":{\"type\":\"string\",\"x-mockingbird-resource-ref\":{\"type\":\"catalog_item\",\"missing\":\"00000000-0000-4000-8000-000000000000\"}},\"sender_med_request_id\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":64},\"medication_name\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":120},\"medication_strength\":{\"type\":\"string\",\"maxLength\":60},\"medication_form\":{\"type\":\"string\",\"maxLength\":40},\"quantity\":{\"type\":\"number\",\"exclusiveMinimum\":0,\"maximum\":1000},\"quantity_units\":{\"type\":\"string\",\"enum\":[\"mL\",\"grams\",\"each\"]},\"days_supply_duration\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":365},\"refills\":{\"type\":\"integer\",\"minimum\":0,\"maximum\":12},\"instructions\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":500},\"note\":{\"type\":\"string\",\"maxLength\":1000},\"authored_on_datetime\":{\"type\":\"string\",\"maxLength\":40},\"clinical_difference\":{\"type\":\"string\",\"maxLength\":1000},\"schedule_code\":{\"type\":\"string\",\"enum\":[\"2\",\"3\",\"4\",\"5\"]}}},\"ClinicalList\":{\"type\":\"object\",\"properties\":{\"has_known_allergies\":{\"type\":\"boolean\"},\"has_known_diseases\":{\"type\":\"boolean\"},\"has_known_medications\":{\"type\":\"boolean\"},\"entries\":{\"type\":\"array\",\"maxItems\":5,\"items\":{\"type\":\"object\",\"required\":[\"description\"],\"properties\":{\"description\":{\"type\":\"string\",\"maxLength\":200}}}}}},\"CreateOrderBody\":{\"type\":\"object\",\"required\":[\"patient\",\"prescriber\",\"order\",\"medication_requests\"],\"properties\":{\"patient\":{\"$ref\":\"#/components/schemas/Patient\"},\"prescriber\":{\"$ref\":\"#/components/schemas/Prescriber\"},\"order\":{\"type\":\"object\",\"required\":[\"bill_to\",\"ship_to\",\"sender_order_id\"],\"properties\":{\"bill_to\":{\"type\":\"string\",\"enum\":[\"practice\",\"patient\"]},\"ship_to\":{\"type\":\"string\",\"enum\":[\"patient\",\"practice\"]},\"sender_order_id\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":64}}},\"medication_requests\":{\"type\":\"array\",\"minItems\":1,\"maxItems\":3,\"items\":{\"$ref\":\"#/components/schemas/MedicationRequest\"}},\"clinical\":{\"type\":\"object\",\"properties\":{\"allergies\":{\"$ref\":\"#/components/schemas/ClinicalList\"},\"diseases\":{\"$ref\":\"#/components/schemas/ClinicalList\"},\"medications\":{\"$ref\":\"#/components/schemas/ClinicalList\"}}},\"shipment\":{\"type\":\"object\",\"properties\":{\"recipient_first_name\":{\"type\":\"string\",\"maxLength\":40},\"recipient_last_name\":{\"type\":\"string\",\"maxLength\":40},\"recipient_email\":{\"type\":\"string\",\"maxLength\":80},\"recipient_phone\":{\"type\":\"string\",\"maxLength\":20},\"address\":{\"$ref\":\"#/components/schemas/Address\"}}}}},\"CreateOrderResponse\":{\"type\":\"object\",\"required\":[\"success\",\"message\",\"order_tracking_id\",\"sender_order_id\",\"status\"],\"properties\":{\"success\":{\"type\":\"boolean\"},\"message\":{\"type\":\"string\"},\"order_tracking_id\":{\"type\":\"string\",\"x-mockingbird-resource\":{\"type\":\"order\",\"identity\":true},\"x-mockingbird-volatile\":{\"kind\":\"id\"}},\"sender_order_id\":{\"type\":\"string\"},\"status\":{\"type\":\"string\"}}},\"OrderStatus\":{\"type\":\"object\",\"required\":[\"order_tracking_id\",\"tracking_id\",\"orderReferenceID\",\"sender_order_id\",\"rxstatus\",\"orderstatus\",\"shipping_status\",\"cancellable\",\"created_at\",\"updated_at\"],\"properties\":{\"order_tracking_id\":{\"type\":\"string\",\"x-mockingbird-volatile\":{\"kind\":\"id\"}},\"tracking_id\":{\"type\":\"string\",\"x-mockingbird-volatile\":{\"kind\":\"id\"}},\"orderReferenceID\":{\"type\":\"string\",\"x-mockingbird-volatile\":{\"kind\":\"id\"}},\"sender_order_id\":{\"type\":\"string\"},\"rxstatus\":{\"type\":\"string\"},\"orderstatus\":{\"type\":\"string\"},\"shipping_status\":{\"type\":\"string\"},\"delivered_date\":{\"type\":[\"string\",\"null\"]},\"trackingnumber\":{\"type\":[\"string\",\"null\"]},\"shippingservice\":{\"type\":[\"string\",\"null\"]},\"shippingcarrier\":{\"type\":[\"string\",\"null\"]},\"shipmenttrackingurl\":{\"type\":[\"string\",\"null\"]},\"cancellable\":{\"type\":\"boolean\"},\"created_at\":{\"type\":\"string\",\"x-mockingbird-volatile\":{\"kind\":\"timestamp\"}},\"updated_at\":{\"type\":\"string\",\"x-mockingbird-volatile\":{\"kind\":\"timestamp\"}}}},\"CancelResponse\":{\"type\":\"object\",\"required\":[\"success\",\"message\",\"order_tracking_id\",\"rxstatus\"],\"properties\":{\"success\":{\"type\":\"boolean\"},\"message\":{\"type\":\"string\"},\"order_tracking_id\":{\"type\":\"string\",\"x-mockingbird-volatile\":{\"kind\":\"id\"}},\"rxstatus\":{\"type\":\"string\"}}},\"CatalogItem\":{\"type\":\"object\",\"required\":[\"catalog_id\",\"medication_name\",\"status\"],\"properties\":{\"catalog_id\":{\"type\":\"string\",\"x-mockingbird-resource\":{\"type\":\"catalog_item\",\"identity\":true}},\"medication_name\":{\"type\":\"string\"},\"medication_strength\":{\"type\":[\"string\",\"null\"]},\"package_size\":{\"type\":[\"string\",\"null\"]},\"quantity\":{\"type\":[\"number\",\"null\"]},\"quantity_units\":{\"type\":[\"string\",\"null\"]},\"medication_form\":{\"type\":[\"string\",\"null\"]},\"route\":{\"type\":[\"string\",\"null\"]},\"states\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"status\":{\"type\":\"string\",\"enum\":[\"active\",\"inactive\"]}}},\"ErrorBody\":{\"type\":\"object\",\"required\":[\"message\"],\"properties\":{\"message\":{\"type\":\"string\"},\"success\":{\"type\":\"boolean\"}}},\"ValidationError\":{\"type\":\"object\",\"required\":[\"message\",\"errors\"],\"properties\":{\"message\":{\"type\":\"string\"},\"errors\":{\"oneOf\":[{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},{\"type\":\"array\",\"items\":{\"type\":\"object\"}}]}}}}}}`) as OpenAPIDocument\n\nexport type OperationId = \"GenerateAccessToken\" | \"CreateOrder\" | \"GetOrder\" | \"CancelOrder\" | \"ListPresetCatalogItems\"\nexport type SupportedOperationId = \"GenerateAccessToken\" | \"CreateOrder\" | \"GetOrder\" | \"CancelOrder\" | \"ListPresetCatalogItems\"\nexport const operationIds = [\"GenerateAccessToken\",\"CreateOrder\",\"GetOrder\",\"CancelOrder\",\"ListPresetCatalogItems\"] as const\nexport const supportedOperationIds = [\"GenerateAccessToken\",\"CreateOrder\",\"GetOrder\",\"CancelOrder\",\"ListPresetCatalogItems\"] as const\n", "/** One preset catalog row, in the field names `GET /api/v1/preset-catalog-items` uses. */\nexport type CatalogItem = {\n catalog_id: string\n medication_name: string\n medication_strength: string | null\n package_size: string | null\n quantity: number | null\n quantity_units: string | null\n medication_form: string | null\n route: string | null\n states: string[]\n status: \"active\" | \"inactive\"\n}\n\n/** The custom-cream anchor preset id our sandbox env points at (`ERX_CUSTOM_CREAM_ANCHOR_PRESET_ID`). */\nexport const CUSTOM_CREAM_ANCHOR_PRESET_ID = \"e404ad76-0f82-4b04-8f25-841650e2e819\"\n\nconst ALL_STATES = [\n \"AZ\",\n \"CA\",\n \"CO\",\n \"FL\",\n \"GA\",\n \"IL\",\n \"MA\",\n \"NC\",\n \"NJ\",\n \"NV\",\n \"NY\",\n \"OH\",\n \"PA\",\n \"TX\",\n \"UT\",\n \"VA\",\n \"WA\",\n]\n\n/**\n * The catalog every namespace starts with when no recorded corpus is loaded. Synthesised in\n * the shapes the live client parses (no sandbox recording exists yet: `corpus pull` replaces\n * it with the real rows); the custom-cream anchor preset must always resolve.\n */\nexport const DEFAULT_CATALOG: readonly CatalogItem[] = [\n {\n catalog_id: CUSTOM_CREAM_ANCHOR_PRESET_ID,\n medication_name: \"CUSTOM\",\n medication_strength: null,\n package_size: \"30 grams\",\n quantity: 30,\n quantity_units: \"grams\",\n medication_form: \"Cream\",\n route: \"Topical\",\n states: ALL_STATES,\n status: \"active\",\n },\n {\n catalog_id: \"1c0b7f7e-3c5f-4d57-9d0a-0d8f1d3a2b10\",\n medication_name: \"Testosterone Cypionate\",\n medication_strength: \"200 mg/mL\",\n package_size: \"10 mL vial\",\n quantity: 10,\n quantity_units: \"mL\",\n medication_form: \"Injectable\",\n route: \"Intramuscular\",\n states: ALL_STATES,\n status: \"active\",\n },\n {\n catalog_id: \"5d2e9a41-8b7c-4f0e-a1d3-6c5b4a392817\",\n medication_name: \"Sermorelin Acetate\",\n medication_strength: \"9 mg\",\n package_size: \"1 vial\",\n quantity: 1,\n quantity_units: \"each\",\n medication_form: \"Lyophilized powder\",\n route: \"Subcutaneous\",\n states: ALL_STATES,\n status: \"active\",\n },\n {\n catalog_id: \"9f3a6b2c-1d4e-4a5b-8c7d-0e1f2a3b4c5d\",\n medication_name: \"Enclomiphene Citrate\",\n medication_strength: \"25 mg\",\n package_size: \"30 capsules\",\n quantity: 30,\n quantity_units: \"each\",\n medication_form: \"Capsule\",\n route: \"Oral\",\n states: ALL_STATES,\n status: \"active\",\n },\n {\n catalog_id: \"0a1b2c3d-4e5f-4a6b-9c8d-7e6f5a4b3c2d\",\n medication_name: \"Anastrozole\",\n medication_strength: \"0.5 mg\",\n package_size: \"30 capsules\",\n quantity: 30,\n quantity_units: \"each\",\n medication_form: \"Capsule\",\n route: \"Oral\",\n states: ALL_STATES,\n status: \"inactive\",\n },\n]\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value)\n\nconst optionalString = (row: Record<string, unknown>, key: string): string | null => {\n const value = row[key]\n if (value === undefined || value === null) return null\n if (typeof value !== \"string\") throw new Error(`${key} must be a string or null`)\n return value\n}\n\n/**\n * One catalog row from loose input: `catalog_id` and `medication_name` are required; the\n * other fields default to `null`, `states` to `[]` and `status` to `\"active\"`.\n */\nexport const parseCatalogItem = (value: unknown): CatalogItem => {\n if (!isRecord(value)) throw new Error(\"a catalog row must be an object\")\n const { catalog_id, medication_name, quantity, states, status } = value\n if (typeof catalog_id !== \"string\" || catalog_id.length === 0) {\n throw new Error(\"catalog_id must be a non-empty string\")\n }\n if (typeof medication_name !== \"string\") {\n throw new Error(`${catalog_id}: medication_name must be a string`)\n }\n if (quantity !== undefined && quantity !== null && typeof quantity !== \"number\") {\n throw new Error(`${catalog_id}: quantity must be a number or null`)\n }\n if (\n states !== undefined &&\n (!Array.isArray(states) || states.some((s) => typeof s !== \"string\"))\n ) {\n throw new Error(`${catalog_id}: states must be a list of state codes`)\n }\n if (status !== undefined && status !== \"active\" && status !== \"inactive\") {\n throw new Error(`${catalog_id}: status must be \"active\" or \"inactive\"`)\n }\n try {\n return {\n catalog_id,\n medication_name,\n medication_strength: optionalString(value, \"medication_strength\"),\n package_size: optionalString(value, \"package_size\"),\n quantity: typeof quantity === \"number\" ? quantity : null,\n quantity_units: optionalString(value, \"quantity_units\"),\n medication_form: optionalString(value, \"medication_form\"),\n route: optionalString(value, \"route\"),\n states: (states as string[] | undefined) ?? [],\n status: status ?? \"active\",\n }\n } catch (error) {\n throw new Error(`${catalog_id}: ${(error as Error).message}`)\n }\n}\n\n/**\n * Catalog rows from a JSON value: a bare array, or the `{data: [...]}` envelope\n * `GET /api/v1/preset-catalog-items` answers with (so a recorded response loads as-is).\n * Throws on the first malformed row.\n */\nexport const parseCatalog = (value: unknown): CatalogItem[] => {\n const rows = Array.isArray(value) ? value : isRecord(value) ? value.data : undefined\n if (!Array.isArray(rows)) throw new Error(\"a catalog must be an array or {data: [...]}\")\n return rows.map(parseCatalogItem)\n}\n", "import { Collection, IdSequence } from \"@crvouga/mockingbird-service\"\nimport type { SqliteClient } from \"@crvouga/mockingbird-sqlite\"\nimport { type CatalogItem, DEFAULT_CATALOG } from \"./catalog.js\"\n\n/**\n * One order as the vendor tracks it. Patient and prescriber details are validated but never\n * stored: the mock keeps only what the status API returns.\n */\nexport type OrderRecord = {\n order_tracking_id: string\n sender_order_id: string\n rxstatus: string\n orderstatus: string\n shipping_status: string\n delivered_date: string | null\n trackingnumber: string | null\n shippingservice: string | null\n shippingcarrier: string | null\n shipmenttrackingurl: string | null\n cancellable: boolean\n created_at: string\n updated_at: string\n /** Mock-clock epoch ms of creation, for auto-advance. */\n createdAtMs: number\n preset_catalog_ids: string[]\n /** Steps of `autoAdvance.path` already applied. */\n advanced: number\n}\n\nexport type AutoAdvance = {\n /** Mock-clock delay between steps. */\n afterMs: number\n /** Vendor statuses to walk through, e.g. `[\"Fill\", \"Shipping\", \"Delivered\"]`. */\n path: string[]\n}\n\n/** Per-namespace knobs, set through `PUT /__admin/settings`; cleared on reset. */\nexport type Settings = {\n /** Token lifetime. Default 24 h, which our client assumes and never refreshes early. */\n tokenTtlSeconds: number\n /** Static bearer tokens accepted as-is (`RXVORTEX_API_TOKEN` for the catalog client). */\n staticTokens: string[]\n /** Only these client credentials get a token; empty means any pair does. */\n clients: { client_id: string; client_secret: string }[]\n autoAdvance: AutoAdvance | null\n /**\n * What a submit does with a well-formed `preset_catalog_id` the catalog does not hold:\n * `\"reject\"` answers 422 as the sandbox does; `\"accept\"` adds it as an active row named\n * after the request's `medication_name`. Inactive rows are refused either way.\n */\n unknownPresets: \"reject\" | \"accept\"\n}\n\nexport const DEFAULT_SETTINGS: Settings = {\n tokenTtlSeconds: 86_400,\n staticTokens: [],\n clients: [],\n autoAdvance: null,\n unknownPresets: \"reject\",\n}\n\nexport class RxVortexState {\n readonly orders: Collection<OrderRecord>\n readonly catalog: Collection<CatalogItem>\n readonly settings: Collection<Settings>\n readonly ids: IdSequence\n\n constructor(\n sqlite: SqliteClient,\n namespace: string,\n private readonly seed: {\n catalog: readonly CatalogItem[] | undefined\n settings: Partial<Settings>\n },\n ) {\n this.orders = new Collection(sqlite, namespace, \"orders\")\n this.catalog = new Collection(sqlite, namespace, \"catalog\")\n this.settings = new Collection(sqlite, namespace, \"settings\")\n this.ids = new IdSequence(sqlite, namespace, \"rxvortex\")\n this.ensureSeeded()\n }\n\n /** Re-apply the catalog and settings after a reset. */\n ensureSeeded(): void {\n if (this.catalog.count() === 0) this.putCatalog(this.seed.catalog ?? DEFAULT_CATALOG, \"merge\")\n\n if (!this.settings.has(\"settings\")) {\n this.settings.insert(\"settings\", { ...DEFAULT_SETTINGS, ...this.seed.settings })\n }\n }\n\n /** Load rows: `replace` drops every other row first, `merge` upserts by `catalog_id`. */\n putCatalog(items: readonly CatalogItem[], mode: \"replace\" | \"merge\"): number {\n if (mode === \"replace\") {\n for (const row of this.catalog.list()) this.catalog.delete(row.id)\n }\n for (const item of items) {\n if (this.catalog.has(item.catalog_id)) this.catalog.update(item.catalog_id, item)\n else this.catalog.insert(item.catalog_id, item)\n }\n return this.catalog.count()\n }\n\n catalogRows(): CatalogItem[] {\n return this.catalog.list({ order: \"oldest\" }).map((row) => row.value)\n }\n\n current(): Settings {\n return this.settings.get(\"settings\") ?? DEFAULT_SETTINGS\n }\n\n update(patch: Partial<Settings>): Settings {\n const next = { ...this.current(), ...patch }\n this.settings.insert(\"settings\", next)\n return next\n }\n\n /** By vendor tracking id first, then by our sender order id (the recovery lookup). */\n findOrder(id: string): OrderRecord | undefined {\n return (\n this.orders.get(id) ??\n this.orders.list({ where: (order) => order.sender_order_id === id }).at(0)?.value\n )\n }\n\n nextTrackingId(): string {\n return this.ids.next(\"RXV-\", 12).toUpperCase()\n }\n}\n", "/**\n * Vendor status strings. RxVortex reports three free-text fields per order (`rxstatus`,\n * `orderstatus`, `shipping_status`); a transition sets all three coherently, the way the\n * real pharmacy moves an order along, so our status mapper sees realistic combinations.\n */\nexport type StatusTriple = { rxstatus: string; orderstatus: string; shipping_status: string }\n\nconst TRIPLES: Record<string, StatusTriple> = {\n created: { rxstatus: \"Created\", orderstatus: \"Created\", shipping_status: \"Pending\" },\n fill: { rxstatus: \"Fill\", orderstatus: \"Processing\", shipping_status: \"Pending\" },\n \"pv1 complete\": {\n rxstatus: \"PV1 Complete\",\n orderstatus: \"Processing\",\n shipping_status: \"Pending\",\n },\n compound: { rxstatus: \"Compound\", orderstatus: \"Processing\", shipping_status: \"Pending\" },\n \"out of stock\": { rxstatus: \"Out of Stock\", orderstatus: \"On Hold\", shipping_status: \"Pending\" },\n \"on hold\": { rxstatus: \"On Hold\", orderstatus: \"On Hold\", shipping_status: \"Pending\" },\n shipping: {\n rxstatus: \"Fulfillment Complete\",\n orderstatus: \"Shipping\",\n shipping_status: \"In Transit\",\n },\n shipped: {\n rxstatus: \"Fulfillment Complete\",\n orderstatus: \"Shipping\",\n shipping_status: \"In Transit\",\n },\n delivered: {\n rxstatus: \"Fulfillment Complete\",\n orderstatus: \"Completed Orders\",\n shipping_status: \"Delivered\",\n },\n cancelled: { rxstatus: \"Cancelled\", orderstatus: \"Cancelled\", shipping_status: \"Cancelled\" },\n canceled: { rxstatus: \"Cancelled\", orderstatus: \"Cancelled\", shipping_status: \"Cancelled\" },\n error: { rxstatus: \"Error\", orderstatus: \"Error\", shipping_status: \"Pending\" },\n rejected: { rxstatus: \"Rejected\", orderstatus: \"Rejected\", shipping_status: \"Pending\" },\n}\n\n/** The status triple for a transition target; an unknown target is used verbatim. */\nexport const triple = (to: string): StatusTriple =>\n TRIPLES[to.trim().toLowerCase()] ?? { rxstatus: to, orderstatus: to, shipping_status: \"Pending\" }\n\n/** Shipped or later: carries tracking and can no longer be cancelled. */\nexport const isShippedOrLater = (to: string): boolean =>\n [\"shipping\", \"shipped\", \"delivered\"].includes(to.trim().toLowerCase())\n\nexport const isTerminal = (status: StatusTriple): boolean =>\n /cancel|deliver|reject|error/i.test(`${status.rxstatus} ${status.shipping_status}`)\n", "import {\n type AdminRoutes,\n type Clock,\n createRuntime as createServiceRuntime,\n createWebhookHub,\n type FaultPreset,\n type MockControls,\n type RequestLog,\n type ServiceRuntime,\n signers,\n type WebhookEndpoint,\n type WebhookHub,\n} from \"@crvouga/mockingbird-service\"\nimport type { SqliteClient } from \"@crvouga/mockingbird-sqlite\"\nimport { type CatalogItem, parseCatalogItem } from \"./catalog.js\"\nimport { document } from \"./generated/openapi.js\"\nimport { RXVORTEX_NAMESPACE, RxVortexAPI, tokenCredential } from \"./index.js\"\nimport type { AutoAdvance, Settings } from \"./state.js\"\n\n/** Header our receiver compares to `RXVORTEX_WEBHOOK_SECRET` (plain equality). */\nexport const WEBHOOK_SECRET_HEADER = \"x-rxvortex-webhook-secret\"\n\n/**\n * Every named RxVortex misbehaviour our consumer branches on, switched on with\n * `POST /__admin/faults {\"preset\": \"<name>\"}` (add `count` to limit it).\n */\nexport const RXVORTEX_PRESETS: Record<string, FaultPreset> = {\n duplicate_sender_order_id: {\n description: \"Submit answers 409: an order with this sender_order_id already exists (it does)\",\n rules: [{ operationId: \"CreateOrder\", effect: \"duplicate_sender_order_id\" }],\n },\n created_but_500: {\n description: \"Submit creates the order, then answers 500; recovery by paymentId finds it\",\n rules: [{ operationId: \"CreateOrder\", effect: \"created_but_500\" }],\n },\n numeric_tracking_id: {\n description: \"Submit answers order_tracking_id as a number (our client treats it as an error)\",\n rules: [{ operationId: \"CreateOrder\", effect: \"numeric_tracking_id\" }],\n },\n token_expired: {\n description: \"Every authenticated call answers 401 Token has expired, before 24 h\",\n rules: [\n { pathPrefix: \"/api/v1/orders\", effect: \"token_expired\" },\n { pathPrefix: \"/api/v1/preset-catalog-items\", effect: \"token_expired\" },\n ],\n },\n stale_error_with_delivered_date: {\n description: \"Status answers an Error status next to a non-empty delivered_date\",\n rules: [{ operationId: \"GetOrder\", effect: \"stale_error_with_delivered_date\" }],\n },\n validation_errors_array: {\n description: \"Submit answers 422 with errors as a non-empty array\",\n rules: [{ operationId: \"CreateOrder\", effect: \"validation_errors_array\" }],\n },\n validation_errors_object: {\n description: \"Submit answers 422 with errors as an object keyed by field\",\n rules: [{ operationId: \"CreateOrder\", effect: \"validation_errors_object\" }],\n },\n validation_errors_empty: {\n description: \"Submit answers 422 with an empty errors array\",\n rules: [{ operationId: \"CreateOrder\", effect: \"validation_errors_empty\" }],\n },\n server_error: {\n description: \"Every call answers 500 Server Error\",\n rules: [{ status: 500, body: { message: \"Server Error\" } }],\n },\n webhook_duplicate: {\n description: \"The next status webhook is delivered twice\",\n webhook: { mode: \"duplicate\" },\n },\n webhook_reorder: {\n description: \"The next two status webhooks arrive swapped\",\n webhook: { mode: \"reorder\" },\n },\n webhook_drop: {\n description: \"The next status webhook is never delivered\",\n webhook: { mode: \"drop\" },\n },\n}\n\nexport type RxVortexRuntimeOptions = {\n sqlite?: SqliteClient\n clock?: Clock\n seed?: number | string\n adminPrefix?: string\n adminKey?: string\n /** Admin controls to boot with: clock, latency, faults, seed, a starting snapshot. */\n adminControls?: MockControls\n onLog?: (entry: RequestLog) => void\n /**\n * Rows every namespace starts with, and returns to on `POST /__admin/reset` (`serve\n * --catalog <file>`). Default: `DEFAULT_CATALOG`.\n */\n catalog?: readonly CatalogItem[]\n settings?: Partial<Settings>\n /** Where status webhooks go (`POST /prescriptions/webhooks/rxvortex`), sent with the secret header. */\n webhooks?: Omit<WebhookEndpoint, \"id\"> & Pick<WebhookHubOptionsSubset, \"retryDelaysMs\" | \"fetch\">\n /**\n * Run auto-advance on this real-time interval (ms), so webhooks fire without a request\n * arriving. The served mock uses 100 ms; in-process runtimes default to off (reads and\n * `POST /__admin/tick` still advance).\n */\n tickMs?: number\n}\n\ntype WebhookHubOptionsSubset = {\n retryDelaysMs?: readonly number[]\n fetch?: (request: Request) => Promise<Response>\n}\n\nexport type RxVortexRuntime = ServiceRuntime<RxVortexAPI> & {\n readonly webhooks: WebhookHub\n /** Stop the background ticker, if one runs. */\n stop(): void\n}\n\nconst json = (status: number, body: unknown) =>\n new Response(JSON.stringify(body), { status, headers: { \"content-type\": \"application/json\" } })\nconst adminError = (status: number, message: string) =>\n json(status, { error: { type: \"mockingbird_admin\", message } })\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value)\n\nconst parseAutoAdvance = (value: unknown): AutoAdvance | null | string => {\n if (value === null) return null\n if (!isRecord(value)) return \"autoAdvance must be {afterMs, path} or null\"\n if (typeof value.afterMs !== \"number\" || value.afterMs < 0)\n return \"autoAdvance.afterMs must be ms\"\n if (!Array.isArray(value.path) || value.path.some((s) => typeof s !== \"string\")) {\n return \"autoAdvance.path must be a list of vendor statuses\"\n }\n return { afterMs: value.afterMs, path: value.path as string[] }\n}\n\nconst adminRoutes = (runtime: ServiceRuntime<RxVortexAPI>): AdminRoutes => ({\n \"GET /orders\": ({ namespace }) => json(200, { orders: runtime.instance(namespace).orders() }),\n \"POST /orders/:id/transition\": ({ params, body, namespace }) => {\n if (!isRecord(body) || typeof body.to !== \"string\") {\n return adminError(\n 400,\n 'expected {\"to\": \"<vendor status>\", \"trackingnumber\"?, \"shippingcarrier\"?}',\n )\n }\n const optional = (key: string) => (typeof body[key] === \"string\" ? { [key]: body[key] } : {})\n const order = runtime.instance(namespace).transition(params.id as string, {\n to: body.to,\n ...optional(\"trackingnumber\"),\n ...optional(\"shippingcarrier\"),\n ...optional(\"shippingservice\"),\n ...optional(\"delivered_date\"),\n })\n return order ? json(200, order) : adminError(404, `no order ${params.id}`)\n },\n \"GET /catalog\": ({ namespace }) =>\n json(200, { data: runtime.instance(namespace).state.catalogRows() }),\n \"PUT /catalog\": ({ body, namespace }) => {\n const rows = isRecord(body) ? (body.items ?? body.data) : undefined\n if (!isRecord(body) || !Array.isArray(rows)) {\n return adminError(400, 'expected {\"items\": [{catalog_id, medication_name, \u2026}], \"mode\"?}')\n }\n const mode = body.mode ?? \"replace\"\n if (mode !== \"replace\" && mode !== \"merge\") {\n return adminError(400, 'mode must be \"replace\" or \"merge\"')\n }\n let items: CatalogItem[]\n try {\n items = rows.map(parseCatalogItem)\n } catch (error) {\n return adminError(400, `items: ${(error as Error).message}`)\n }\n return json(200, { count: runtime.instance(namespace).state.putCatalog(items, mode) })\n },\n \"GET /settings\": ({ namespace }) => json(200, runtime.instance(namespace).state.current()),\n \"PUT /settings\": ({ body, namespace }) => {\n if (!isRecord(body)) return adminError(400, \"expected a JSON object\")\n const patch: Partial<Settings> = {}\n if (body.tokenTtlSeconds !== undefined) {\n if (typeof body.tokenTtlSeconds !== \"number\")\n return adminError(400, \"tokenTtlSeconds: number\")\n patch.tokenTtlSeconds = body.tokenTtlSeconds\n }\n if (body.staticTokens !== undefined) {\n if (!Array.isArray(body.staticTokens)) return adminError(400, \"staticTokens: string[]\")\n patch.staticTokens = body.staticTokens.map(String)\n }\n if (body.clients !== undefined) {\n if (!Array.isArray(body.clients))\n return adminError(400, \"clients: [{client_id, client_secret}]\")\n patch.clients = body.clients.filter(isRecord).map((c) => ({\n client_id: String(c.client_id),\n client_secret: String(c.client_secret),\n }))\n }\n if (body.autoAdvance !== undefined) {\n const parsed = parseAutoAdvance(body.autoAdvance)\n if (typeof parsed === \"string\") return adminError(400, parsed)\n patch.autoAdvance = parsed\n }\n if (body.unknownPresets !== undefined) {\n if (body.unknownPresets !== \"reject\" && body.unknownPresets !== \"accept\") {\n return adminError(400, 'unknownPresets: \"reject\" | \"accept\"')\n }\n patch.unknownPresets = body.unknownPresets\n }\n return json(200, runtime.instance(namespace).state.update(patch))\n },\n \"POST /tick\": ({ namespace }) => json(200, { applied: runtime.instance(namespace).tick() }),\n})\n\n/**\n * The RxVortex mock with Mockingbird's full service contract: `/__admin/health`, `/__admin/*`,\n * namespaces by header, by `/__admin/ns/<name>` path prefix, or by client id\n * (`PUT /__admin/credentials {\"credentials\": {\"<RXVORTEX_CLIENT_ID>\": \"<namespace>\"}}`),\n * clock control, fault presets, signed status webhooks and a request journal.\n */\nexport const createRuntime = (options: RxVortexRuntimeOptions = {}): RxVortexRuntime => {\n const { retryDelaysMs, fetch: send, ...endpoint } = options.webhooks ?? { url: \"\" }\n const hub = createWebhookHub({\n signer: signers.header(WEBHOOK_SECRET_HEADER),\n ...(retryDelaysMs ? { retryDelaysMs } : {}),\n ...(send ? { fetch: send } : {}),\n endpoints: options.webhooks ? [endpoint as WebhookEndpoint] : [],\n })\n const runtime = createServiceRuntime<RxVortexAPI>({\n name: RXVORTEX_NAMESPACE,\n document,\n ...(options.sqlite ? { sqlite: options.sqlite } : {}),\n ...(options.clock ? { clock: options.clock } : {}),\n ...(options.seed !== undefined ? { seed: options.seed } : {}),\n ...(options.adminPrefix !== undefined ? { adminPrefix: options.adminPrefix } : {}),\n ...(options.adminKey !== undefined ? { adminKey: options.adminKey } : {}),\n ...(options.adminControls !== undefined ? { adminControls: options.adminControls } : {}),\n ...(options.onLog ? { onLog: options.onLog } : {}),\n credential: tokenCredential,\n presets: RXVORTEX_PRESETS,\n webhooks: hub,\n create: ({ sqlite, namespace, publicNamespace, clock }) =>\n new RxVortexAPI({\n sqlite,\n namespace,\n now: clock.now,\n ...(options.catalog ? { catalog: options.catalog } : {}),\n ...(options.settings ? { settings: options.settings } : {}),\n onWebhook: (event) =>\n hub.publish({\n namespace: publicNamespace,\n type: event.event,\n body: event,\n id: `${event.order_tracking_id}:${event.updated_at}:${event.rxstatus}`,\n }),\n }),\n describe: () => ({ webhooks: hub.endpoints(\"default\").length > 0 ? \"on\" : \"off\" }),\n admin: adminRoutes,\n })\n let timer: ReturnType<typeof setInterval> | undefined\n if (options.tickMs !== undefined && options.tickMs > 0) {\n timer = setInterval(() => {\n for (const name of runtime.namespaces()) runtime.instance(name).tick()\n }, options.tickMs)\n ;(timer as { unref?: () => void }).unref?.()\n }\n return Object.assign(runtime, {\n webhooks: hub,\n stop: () => {\n if (timer !== undefined) clearInterval(timer)\n },\n })\n}\n", "import type { FetchAPI } from \"@crvouga/mockingbird-core\"\nimport {\n type APIOptions,\n annotateResponse,\n bearerToken,\n bodyIssues,\n bootSqlite,\n createService,\n defineOperations,\n faultEffect,\n fromBase64,\n HttpError,\n issuesByField,\n jsonRes,\n type OperationContext,\n opaqueToken,\n type Service,\n toBase64,\n} from \"@crvouga/mockingbird-service\"\nimport type { SqliteClient } from \"@crvouga/mockingbird-sqlite\"\nimport type { Hono } from \"hono\"\nimport type { CatalogItem } from \"./catalog.js\"\nimport { document, type SupportedOperationId } from \"./generated/openapi.js\"\nimport { type OrderRecord, RxVortexState, type Settings } from \"./state.js\"\nimport { isShippedOrLater, isTerminal, triple } from \"./statuses.js\"\n\nexport type { FetchAPI } from \"@crvouga/mockingbird-core\"\nexport type { SqliteClient } from \"@crvouga/mockingbird-sqlite\"\nexport type { CatalogItem } from \"./catalog.js\"\nexport {\n CUSTOM_CREAM_ANCHOR_PRESET_ID,\n DEFAULT_CATALOG,\n parseCatalog,\n parseCatalogItem,\n} from \"./catalog.js\"\nexport type { OperationId, SupportedOperationId } from \"./generated/openapi.js\"\nexport { document, operationIds, supportedOperationIds } from \"./generated/openapi.js\"\nexport type { AutoAdvance, OrderRecord, Settings } from \"./state.js\"\n\nexport const RXVORTEX_NAMESPACE = \"rxvortex\"\n\n/** The status webhook body RxVortex posts (our receiver reads these field names). */\nexport type RxVortexWebhook = {\n event: \"order.status_updated\"\n orderReferenceID: string\n order_tracking_id: string\n tracking_id: string\n sender_order_id: string\n rxstatus: string\n orderstatus: string\n shipping_status: string\n delivered_date: string | null\n trackingnumber: string | null\n shippingcarrier: string | null\n shippingservice: string | null\n shipmenttrackingurl: string | null\n updated_at: string\n}\n\nexport type RxVortexAPIOptions = APIOptions & {\n /** Rows every namespace starts with. Default: {@link DEFAULT_CATALOG}. */\n catalog?: readonly CatalogItem[]\n /** Initial per-namespace settings (token TTL, static tokens, clients, auto-advance). */\n settings?: Partial<Settings>\n /** Called for every status change; the runtime signs and delivers it. */\n onWebhook?: (event: RxVortexWebhook) => void\n}\n\nconst TOKEN_PREFIX = \"rxv_\"\n\nconst UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i\n\n/** The fields of a validated `medication_requests[]` entry the mock reads. */\ntype MedicationRequest = {\n preset_catalog_id: string\n medication_name: string\n medication_strength?: string\n medication_form?: string\n quantity: number\n quantity_units: string\n}\n\nconst base64url = (value: string) =>\n toBase64(new TextEncoder().encode(value))\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=+$/, \"\")\nconst fromBase64url = (value: string) => {\n try {\n return new TextDecoder(\"utf-8\", { fatal: true }).decode(\n fromBase64(value.replace(/-/g, \"+\").replace(/_/g, \"/\")),\n )\n } catch {\n return undefined\n }\n}\n\n/**\n * The client id a bearer token was issued to, or the static token itself. Tokens carry their\n * client id so the runtime can map `RXVORTEX_CLIENT_ID` to a namespace (the app's `fetch`\n * cannot add a namespace header).\n */\nexport const tokenCredential = (request: Request): string | undefined => {\n const token = bearerToken(request)\n if (!token) return undefined\n if (!token.startsWith(TOKEN_PREFIX)) return token\n const [encoded] = token.slice(TOKEN_PREFIX.length).split(\".\")\n return encoded ? fromBase64url(encoded) : undefined\n}\n\nconst issueToken = (clientId: string, issuedAtSeconds: number) => {\n const signature = opaqueToken(`rxvortex:${clientId}:${issuedAtSeconds}`, 32)\n return `${TOKEN_PREFIX}${base64url(clientId)}.${issuedAtSeconds}.${signature}`\n}\n\ntype TokenCheck = { ok: true } | { ok: false; message: string }\n\nconst checkToken = (token: string, settings: Settings, nowMs: number): TokenCheck => {\n if (settings.staticTokens.includes(token)) return { ok: true }\n if (!token.startsWith(TOKEN_PREFIX)) return { ok: false, message: \"Unauthenticated.\" }\n const [encoded, issued, signature] = token.slice(TOKEN_PREFIX.length).split(\".\")\n const clientId = encoded ? fromBase64url(encoded) : undefined\n const issuedAt = Number(issued)\n if (clientId === undefined || !Number.isInteger(issuedAt) || !signature) {\n return { ok: false, message: \"Unauthenticated.\" }\n }\n if (signature !== opaqueToken(`rxvortex:${clientId}:${issuedAt}`, 32)) {\n return { ok: false, message: \"Unauthenticated.\" }\n }\n if (nowMs / 1000 >= issuedAt + settings.tokenTtlSeconds) {\n return { ok: false, message: \"Token has expired.\" }\n }\n return { ok: true }\n}\n\nconst record = (context: OperationContext): Record<string, unknown> => {\n if (\n context.body.kind !== \"json\" ||\n typeof context.body.value !== \"object\" ||\n !context.body.value\n ) {\n throw new HttpError(422, {\n message: \"The given data was invalid.\",\n errors: { body: [\"The request body must be a JSON object.\"] },\n })\n }\n return context.body.value as Record<string, unknown>\n}\n\n/** The status body `GET /api/v1/orders/{id}` answers with. */\nconst statusBody = (order: OrderRecord) => ({\n order_tracking_id: order.order_tracking_id,\n tracking_id: order.order_tracking_id,\n orderReferenceID: order.order_tracking_id,\n sender_order_id: order.sender_order_id,\n rxstatus: order.rxstatus,\n orderstatus: order.orderstatus,\n shipping_status: order.shipping_status,\n delivered_date: order.delivered_date,\n trackingnumber: order.trackingnumber,\n shippingservice: order.shippingservice,\n shippingcarrier: order.shippingcarrier,\n shipmenttrackingurl: order.shipmenttrackingurl,\n cancellable: order.cancellable,\n created_at: order.created_at,\n updated_at: order.updated_at,\n})\n\nexport type TransitionInput = {\n to: string\n trackingnumber?: string\n shippingcarrier?: string\n shippingservice?: string\n delivered_date?: string\n}\n\n/**\n * Stateful mock of the RxVortex (Strive) pharmacy API.\n *\n * Orders start `Created` and move only through admin transitions or auto-advance, each of\n * which updates the three vendor status fields together and emits the status webhook.\n */\nexport class RxVortexAPI implements FetchAPI {\n readonly app: Hono\n readonly sqlite: SqliteClient\n readonly state: RxVortexState\n private readonly service: Service\n private readonly now: () => number\n private readonly onWebhook: ((event: RxVortexWebhook) => void) | undefined\n\n constructor(options: RxVortexAPIOptions = {}) {\n const sqlite = bootSqlite(options.sqlite)\n const namespace = options.namespace ?? RXVORTEX_NAMESPACE\n this.now = options.now ?? (() => Date.now())\n this.onWebhook = options.onWebhook\n this.state = new RxVortexState(sqlite, namespace, {\n catalog: options.catalog,\n settings: options.settings ?? {},\n })\n const handlers = defineOperations<SupportedOperationId>({\n GenerateAccessToken: (context) => this.generateToken(context),\n CreateOrder: (context) => this.createOrder(context),\n GetOrder: (context) => this.getOrder(context),\n CancelOrder: (context) => this.cancelOrder(context),\n ListPresetCatalogItems: () => jsonRes(200, { data: this.state.catalogRows() }),\n })\n this.service = createService({\n document,\n handlers,\n sqlite,\n namespace,\n now: this.now,\n notFound: () => jsonRes(404, { message: \"Not Found\" }),\n onError: (error) => {\n if (error instanceof HttpError) return error.toResponse()\n throw error\n },\n before: (context) => {\n if (context.operation.operationId === \"GenerateAccessToken\") return undefined\n this.tick()\n const token = bearerToken(context.request)\n if (!token) return jsonRes(401, { message: \"Unauthenticated.\" })\n if (faultEffect(context.request, \"token_expired\") !== undefined) {\n return jsonRes(401, { message: \"Token has expired.\" })\n }\n const check = checkToken(token, this.state.current(), this.now())\n return check.ok ? undefined : jsonRes(401, { message: check.message })\n },\n })\n this.app = this.service.app\n this.sqlite = this.service.sqlite\n }\n\n fetch(request: Request): Promise<Response> {\n return this.service.fetch(request)\n }\n\n async reset(): Promise<void> {\n await this.service.reset()\n this.state.ensureSeeded()\n }\n\n private iso(): string {\n return new Date(this.now()).toISOString()\n }\n\n private generateToken(context: OperationContext): Response {\n const body = record(context)\n const issues = bodyIssues(context)\n if (issues.length > 0) {\n return jsonRes(422, { message: \"The given data was invalid.\", errors: issuesByField(issues) })\n }\n const clientId = String(body.client_id)\n const clients = this.state.current().clients\n if (\n clients.length > 0 &&\n !clients.some((c) => c.client_id === clientId && c.client_secret === body.client_secret)\n ) {\n return jsonRes(401, { message: \"Invalid client credentials.\" })\n }\n const ttl = this.state.current().tokenTtlSeconds\n return jsonRes(200, {\n access_token: issueToken(clientId, Math.floor(this.now() / 1000)),\n token_type: \"Bearer\",\n expires_in: ttl,\n })\n }\n\n private createOrder(context: OperationContext): Response {\n const body = record(context)\n if (faultEffect(context.request, \"validation_errors_array\") !== undefined) {\n return jsonRes(422, {\n message: \"The given data was invalid.\",\n errors: [{ field: \"patient.phone\", message: \"The patient.phone format is invalid.\" }],\n })\n }\n if (faultEffect(context.request, \"validation_errors_object\") !== undefined) {\n return jsonRes(422, {\n message: \"The given data was invalid.\",\n errors: { \"patient.phone\": [\"The patient.phone format is invalid.\"] },\n })\n }\n if (faultEffect(context.request, \"validation_errors_empty\") !== undefined) {\n return jsonRes(422, { message: \"The given data was invalid.\", errors: [] })\n }\n const issues = bodyIssues(context)\n if (issues.length > 0) {\n return jsonRes(422, { message: \"The given data was invalid.\", errors: issuesByField(issues) })\n }\n const order = body.order as { sender_order_id: string }\n const meds = body.medication_requests as MedicationRequest[]\n const adoptable = (med: MedicationRequest) =>\n this.state.current().unknownPresets === \"accept\" && UUID.test(med.preset_catalog_id)\n const unknown = meds.find((med) => {\n const item = this.state.catalog.get(med.preset_catalog_id)\n return item ? item.status !== \"active\" : !adoptable(med)\n })\n if (unknown) {\n return jsonRes(422, {\n message: \"The given data was invalid.\",\n errors: {\n \"medication_requests.0.preset_catalog_id\": [\n `The selected preset catalog id ${unknown.preset_catalog_id} is invalid.`,\n ],\n },\n })\n }\n const existing = this.state.findOrder(order.sender_order_id)\n if (existing) {\n return annotateResponse(\n jsonRes(409, {\n success: false,\n message: `An order with sender_order_id ${order.sender_order_id} already exists.`,\n }),\n { ids: { orderId: existing.order_tracking_id } },\n )\n }\n for (const med of meds) {\n if (!this.state.catalog.has(med.preset_catalog_id)) this.adoptPreset(med)\n }\n const now = this.iso()\n const created: OrderRecord = {\n order_tracking_id: this.state.nextTrackingId(),\n sender_order_id: order.sender_order_id,\n ...triple(\"Created\"),\n delivered_date: null,\n trackingnumber: null,\n shippingservice: null,\n shippingcarrier: null,\n shipmenttrackingurl: null,\n cancellable: true,\n created_at: now,\n updated_at: now,\n createdAtMs: this.now(),\n preset_catalog_ids: meds.map((m) => m.preset_catalog_id),\n advanced: 0,\n }\n this.state.orders.insert(created.order_tracking_id, created)\n const ids = { orderId: created.order_tracking_id, senderOrderId: created.sender_order_id }\n if (faultEffect(context.request, \"created_but_500\") !== undefined) {\n return annotateResponse(jsonRes(500, { message: \"Server Error\" }), { ids })\n }\n if (faultEffect(context.request, \"duplicate_sender_order_id\") !== undefined) {\n return annotateResponse(\n jsonRes(409, {\n success: false,\n message: `An order with sender_order_id ${created.sender_order_id} already exists.`,\n }),\n { ids },\n )\n }\n const numeric = faultEffect(context.request, \"numeric_tracking_id\") !== undefined\n return annotateResponse(\n jsonRes(200, {\n success: true,\n message: \"Order created successfully.\",\n order_tracking_id: numeric\n ? Number.parseInt(created.order_tracking_id.replace(/\\D/g, \"\") || \"1\", 10)\n : created.order_tracking_id,\n sender_order_id: created.sender_order_id,\n status: created.rxstatus,\n }),\n { ids },\n )\n }\n\n /**\n * Under `unknownPresets: \"accept\"`, a well-formed preset id the catalog lacks becomes an\n * active row described by the request, so later submits and catalog reads see it.\n */\n private adoptPreset(med: MedicationRequest): void {\n const item: CatalogItem = {\n catalog_id: med.preset_catalog_id,\n medication_name: med.medication_name,\n medication_strength: med.medication_strength ?? null,\n package_size: null,\n quantity: med.quantity,\n quantity_units: med.quantity_units,\n medication_form: med.medication_form ?? null,\n route: null,\n states: [],\n status: \"active\",\n }\n this.state.putCatalog([item], \"merge\")\n }\n\n private getOrder(context: OperationContext): Response {\n const order = this.state.findOrder(context.params.orderId ?? \"\")\n if (!order) return jsonRes(404, { message: \"Order not found.\" })\n const body = statusBody(order)\n if (faultEffect(context.request, \"stale_error_with_delivered_date\") !== undefined) {\n Object.assign(body, {\n rxstatus: \"Error\",\n orderstatus: \"Error\",\n delivered_date: order.delivered_date ?? this.iso().slice(0, 10),\n })\n }\n return annotateResponse(jsonRes(200, body), { ids: { orderId: order.order_tracking_id } })\n }\n\n private cancelOrder(context: OperationContext): Response {\n const order = this.state.findOrder(context.params.orderId ?? \"\")\n if (!order) return jsonRes(404, { message: \"Order not found.\" })\n if (!order.cancellable) {\n return jsonRes(409, {\n success: false,\n message: `Order ${order.order_tracking_id} cannot be cancelled in status ${order.rxstatus}.`,\n })\n }\n const updated = this.transition(order.order_tracking_id, { to: \"Cancelled\" })\n return annotateResponse(\n jsonRes(200, {\n success: true,\n message: \"Order cancelled.\",\n order_tracking_id: order.order_tracking_id,\n rxstatus: updated?.rxstatus ?? \"Cancelled\",\n }),\n { ids: { orderId: order.order_tracking_id } },\n )\n }\n\n /** Move an order to a vendor status, set the three fields coherently, emit the webhook. */\n transition(id: string, input: TransitionInput): OrderRecord | undefined {\n const order = this.state.findOrder(id)\n if (!order) return undefined\n const status = triple(input.to)\n const shipped = isShippedOrLater(input.to)\n const delivered = /deliver/i.test(status.shipping_status)\n const trackingnumber =\n input.trackingnumber ??\n order.trackingnumber ??\n (shipped ? `1Z${opaqueToken(order.order_tracking_id, 16).toUpperCase()}` : null)\n const carrier = input.shippingcarrier ?? order.shippingcarrier ?? (shipped ? \"UPS\" : null)\n const next: OrderRecord = {\n ...order,\n ...status,\n trackingnumber,\n shippingcarrier: carrier,\n shippingservice:\n input.shippingservice ?? order.shippingservice ?? (shipped ? \"Ground\" : null),\n shipmenttrackingurl:\n trackingnumber && carrier === \"UPS\"\n ? `https://www.ups.com/track?tracknum=${trackingnumber}`\n : order.shipmenttrackingurl,\n delivered_date:\n input.delivered_date ?? (delivered ? this.iso().slice(0, 10) : order.delivered_date),\n cancellable: !shipped && !isTerminal(status),\n updated_at: this.iso(),\n }\n this.state.orders.update(order.order_tracking_id, next)\n this.onWebhook?.({\n event: \"order.status_updated\",\n orderReferenceID: next.order_tracking_id,\n order_tracking_id: next.order_tracking_id,\n tracking_id: next.order_tracking_id,\n sender_order_id: next.sender_order_id,\n rxstatus: next.rxstatus,\n orderstatus: next.orderstatus,\n shipping_status: next.shipping_status,\n delivered_date: next.delivered_date,\n trackingnumber: next.trackingnumber,\n shippingcarrier: next.shippingcarrier,\n shippingservice: next.shippingservice,\n shipmenttrackingurl: next.shipmenttrackingurl,\n updated_at: next.updated_at,\n })\n return this.state.orders.get(order.order_tracking_id)\n }\n\n /**\n * Apply every auto-advance step that is due on the mock clock. Runs before each vendor\n * request, on `POST /__admin/tick`, and from the served runtime's background ticker.\n */\n tick(): number {\n const plan = this.state.current().autoAdvance\n if (!plan || plan.path.length === 0) return 0\n let applied = 0\n for (const { value: order } of this.state.orders.list({ order: \"oldest\" })) {\n let current = order\n while (current.advanced < plan.path.length) {\n const due = current.createdAtMs + plan.afterMs * (current.advanced + 1)\n if (this.now() < due) break\n const to = plan.path[current.advanced] as string\n const moved = this.transition(current.order_tracking_id, { to })\n if (!moved) break\n current = { ...moved, advanced: current.advanced + 1 }\n this.state.orders.update(current.order_tracking_id, current)\n applied++\n }\n }\n return applied\n }\n\n orders(): OrderRecord[] {\n return this.state.orders.list({ order: \"oldest\" }).map((row) => row.value)\n }\n}\n\nexport type { RxVortexRuntime, RxVortexRuntimeOptions } from \"./runtime.js\"\nexport { createRuntime, RXVORTEX_PRESETS } from \"./runtime.js\"\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA,+CAAC,QAAS,YAAW,SAAU,4BAA2B,MAAO,MAAK,OAAQ,wDAAuD,MAAO,8ykBAA6ykB,OAAQ,MAAK,aAAc,wJAAuJ;;;ACA3mlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAc;AACd,SAAS,mBAAmB,gBAAgB,iBAAiB,qBAAqB;AAC3E,IAAM,kBACX,OAAsD,sBAAkC;AAC1F,IAAM,cACJ,OAAO,2CAAgC,WAAW,yCAA8B;AAC3E,IAAM,gBAAgB,CAAC,YAC5B,cAAc;AAAA,EACZ,GAAG;AAAA,EACH,SAAS,QAAQ,WAAW;AAAA,EAC5B,YAAY,QAAQ,cAAc;AACpC,CAAC;;;ACPI,IAAM,WAA4B,KAAK,MAAM,8mWAA8mW;AAI3pW,IAAM,eAAe,CAAC,uBAAsB,eAAc,YAAW,eAAc,wBAAwB;AAC3G,IAAM,wBAAwB,C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,CAAC,QAAQ,KAAK,KAAK,WAAW,EAAG,QAAO;AAC5C,QAAI,UAAU;AACd,eAAW,EAAE,OAAO,MAAM,KAAK,KAAK,MAAM,OAAO,KAAK,EAAE,OAAO,SAAS,CAAC,GAAG;AAC1E,UAAI,UAAU;AACd,aAAO,QAAQ,WAAW,KAAK,KAAK,QAAQ;AAC1C,cAAM,MAAM,QAAQ,cAAc,KAAK,WAAW,QAAQ,WAAW;AACrE,YAAI,KAAK,IAAI,IAAI,IAAK;AACtB,cAAM,KAAK,KAAK,KAAK,QAAQ,QAAQ;AACrC,cAAM,QAAQ,KAAK,WAAW,QAAQ,mBAAmB,EAAE,GAAG,CAAC;AAC/D,YAAI,CAAC,MAAO;AACZ,kBAAU,EAAE,GAAG,OAAO,UAAU,QAAQ,WAAW,EAAE;AACrD,aAAK,MAAM,OAAO,OAAO,QAAQ,mBAAmB,OAAO;AAC3D;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEA,SAAwB;AACtB,WAAO,KAAK,MAAM,OAAO,KAAK,EAAE,OAAO,SAAS,CAAC,EAAE,IAAI,CAAC,QAAQ,IAAI,KAAK;AAAA,EAC3E;AACF;",
|
|
6
|
+
"names": ["isRecord", "createRuntime"]
|
|
7
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
runCli,
|
|
4
|
-
serveCommand,
|
|
5
3
|
serveTarget
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-7MPHLPSO.js";
|
|
4
|
+
} from "./chunk-4PYIJTMH.js";
|
|
5
|
+
import "./chunk-GTPGV2ML.js";
|
|
9
6
|
|
|
10
7
|
// src/cli.ts
|
|
8
|
+
import { runCli, serveCommand } from "@crvouga/mockingbird-runtime/adapter-node";
|
|
11
9
|
var code = await runCli(
|
|
12
10
|
{
|
|
13
11
|
bin: "mockingbird-rxvortex",
|
package/dist/cli.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/cli.ts"],
|
|
4
4
|
"sourcesContent": ["#!/usr/bin/env node\n/// <reference types=\"node\" />\nimport { runCli, serveCommand } from \"@crvouga/mockingbird-adapter-node\"\nimport { serveTarget } from \"./server.js\"\n\nconst code = await runCli(\n {\n bin: \"mockingbird-rxvortex\",\n description: \"stateful RxVortex (Strive) pharmacy API mock\",\n commands: { serve: serveCommand(serveTarget) },\n },\n process.argv.slice(2),\n)\nif (code !== 0) process.exitCode = code\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;AAEA,SAAS,QAAQ,oBAAoB;AAGrC,IAAM,OAAO,MAAM;AAAA,EACjB;AAAA,IACE,KAAK;AAAA,IACL,aAAa;AAAA,IACb,UAAU,EAAE,OAAO,aAAa,WAAW,EAAE;AAAA,EAC/C;AAAA,EACA,QAAQ,KAAK,MAAM,CAAC;AACtB;AACA,IAAI,SAAS,EAAG,SAAQ,WAAW;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -113,110 +113,6 @@ interface FetchAPI {
|
|
|
113
113
|
/** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
|
|
114
114
|
type FetchHandler = (request: Request) => Promise<Response>;
|
|
115
115
|
|
|
116
|
-
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
117
|
-
type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
|
|
118
|
-
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
119
|
-
type SqliteRunResult$1 = {
|
|
120
|
-
changes: number;
|
|
121
|
-
lastInsertRowid: number | bigint;
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Prepared statement bound to a {@link SqliteClient}.
|
|
125
|
-
*
|
|
126
|
-
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
127
|
-
*/
|
|
128
|
-
interface SqliteStatement$1 {
|
|
129
|
-
run(...params: SqliteValue$1[]): SqliteRunResult$1;
|
|
130
|
-
all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
|
|
131
|
-
get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Sync SQLite client port owned by Mockingbird.
|
|
135
|
-
*
|
|
136
|
-
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
137
|
-
* `bun:sqlite` instances all work when they expose this surface.
|
|
138
|
-
*/
|
|
139
|
-
interface SqliteClient$1 {
|
|
140
|
-
exec(sql: string): void;
|
|
141
|
-
prepare(sql: string): SqliteStatement$1;
|
|
142
|
-
transaction<T>(fn: () => T): T;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/** Every stored record carries a monotonically increasing sequence for stable ordering. */
|
|
146
|
-
type Stored<T> = {
|
|
147
|
-
seq: number;
|
|
148
|
-
value: T;
|
|
149
|
-
};
|
|
150
|
-
type ListRecordsOptions<T> = {
|
|
151
|
-
/** Keep only records passing the predicate. */
|
|
152
|
-
where?: (value: T, seq: number) => boolean;
|
|
153
|
-
/** Sort order; default newest first. */
|
|
154
|
-
order?: "newest" | "oldest";
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
|
|
158
|
-
* sequence, never by id lexicographic order, so list semantics stay stable.
|
|
159
|
-
*/
|
|
160
|
-
declare class Collection<T> {
|
|
161
|
-
private readonly sqlite;
|
|
162
|
-
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
163
|
-
readonly namespace: string;
|
|
164
|
-
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
165
|
-
readonly collectionName: string;
|
|
166
|
-
private readonly statements;
|
|
167
|
-
private prepare;
|
|
168
|
-
constructor(sqlite: SqliteClient$1,
|
|
169
|
-
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
170
|
-
namespace: string,
|
|
171
|
-
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
172
|
-
collectionName: string);
|
|
173
|
-
private bumpCollectionSeq;
|
|
174
|
-
nextSequence(): number;
|
|
175
|
-
get(id: string): T | undefined;
|
|
176
|
-
has(id: string): boolean;
|
|
177
|
-
/** Insert a new record, assigning it the next sequence number. */
|
|
178
|
-
insert(id: string, value: T): Stored<T>;
|
|
179
|
-
/** Replace an existing record's value, keeping its position. */
|
|
180
|
-
update(id: string, value: T): Stored<T> | undefined;
|
|
181
|
-
delete(id: string): boolean;
|
|
182
|
-
/** How many records the collection holds, without reading them. */
|
|
183
|
-
count(): number;
|
|
184
|
-
list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
|
|
185
|
-
id: string;
|
|
186
|
-
}>;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* What names an id base: a non-negative safe integer (or its decimal string) or `"boot"`,
|
|
191
|
-
* which derives the base from the wall clock when the runtime is created.
|
|
192
|
-
*/
|
|
193
|
-
type IdBase = number | string;
|
|
194
|
-
/**
|
|
195
|
-
* Sequential id source persisted in SQLite. Ids are deterministic for a given
|
|
196
|
-
* sequence history (`cus_` + 14 opaque chars), so reproductions stay stable.
|
|
197
|
-
* A runtime's `idBase` is mixed in, so a different base reissues none of another's ids.
|
|
198
|
-
*/
|
|
199
|
-
declare class IdSequence {
|
|
200
|
-
private readonly sqlite;
|
|
201
|
-
private readonly namespace;
|
|
202
|
-
private readonly salt;
|
|
203
|
-
constructor(sqlite: SqliteClient$1, namespace: string, salt?: string);
|
|
204
|
-
next(prefix: string, length?: number): string;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/** Options every provider constructor accepts. */
|
|
208
|
-
type APIOptions = {
|
|
209
|
-
/** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
|
|
210
|
-
sqlite?: SqliteClient$1;
|
|
211
|
-
/** Clock used for `created`-style fields. Default `Date.now`. */
|
|
212
|
-
now?: () => number;
|
|
213
|
-
/**
|
|
214
|
-
* Storage namespace for this instance's records. Instances sharing one SQLite
|
|
215
|
-
* client stay isolated when their namespaces differ. Defaults to the service name.
|
|
216
|
-
*/
|
|
217
|
-
namespace?: string;
|
|
218
|
-
};
|
|
219
|
-
|
|
220
116
|
/**
|
|
221
117
|
* The single source of time for a service.
|
|
222
118
|
*
|
|
@@ -247,6 +143,11 @@ type Clock = {
|
|
|
247
143
|
state(): ClockState;
|
|
248
144
|
};
|
|
249
145
|
|
|
146
|
+
type UpstreamState = {
|
|
147
|
+
mode: "emulated" | "forward";
|
|
148
|
+
baseUrl: string;
|
|
149
|
+
};
|
|
150
|
+
|
|
250
151
|
/**
|
|
251
152
|
* Seeded pseudo-random numbers, so anything a mock invents — ids, jitter, which
|
|
252
153
|
* request a percentage fault hits — is reproducible from a seed.
|
|
@@ -523,6 +424,7 @@ declare const SNAPSHOT_FORMAT = "mockingbird.snapshot/v1";
|
|
|
523
424
|
* `records` are required, so a hand-written seed file is a valid snapshot.
|
|
524
425
|
*/
|
|
525
426
|
type SnapshotDocument = {
|
|
427
|
+
upstream?: UpstreamState;
|
|
526
428
|
format: typeof SNAPSHOT_FORMAT;
|
|
527
429
|
/** The service that wrote it. A snapshot is rejected by any other service. */
|
|
528
430
|
service?: string;
|
|
@@ -596,6 +498,7 @@ type LatencyState = LatencyRule & {
|
|
|
596
498
|
};
|
|
597
499
|
/** What {@link controlHeaders} turns into request headers. */
|
|
598
500
|
type ControlHeaderInput = {
|
|
501
|
+
upstream?: "emulated" | "forward";
|
|
599
502
|
namespace?: string;
|
|
600
503
|
adminKey?: string;
|
|
601
504
|
branch?: string;
|
|
@@ -613,6 +516,48 @@ type ControlHeaderInput = {
|
|
|
613
516
|
snapshot?: string;
|
|
614
517
|
};
|
|
615
518
|
|
|
519
|
+
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
520
|
+
type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
|
|
521
|
+
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
522
|
+
type SqliteRunResult$1 = {
|
|
523
|
+
changes: number;
|
|
524
|
+
lastInsertRowid: number | bigint;
|
|
525
|
+
};
|
|
526
|
+
/**
|
|
527
|
+
* Prepared statement bound to a {@link SqliteClient}.
|
|
528
|
+
*
|
|
529
|
+
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
530
|
+
*/
|
|
531
|
+
interface SqliteStatement$1 {
|
|
532
|
+
run(...params: SqliteValue$1[]): SqliteRunResult$1;
|
|
533
|
+
all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
|
|
534
|
+
get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Sync SQLite client port owned by Mockingbird.
|
|
538
|
+
*
|
|
539
|
+
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
540
|
+
* `bun:sqlite` instances all work when they expose this surface.
|
|
541
|
+
*/
|
|
542
|
+
interface SqliteClient$1 {
|
|
543
|
+
exec(sql: string): void;
|
|
544
|
+
prepare(sql: string): SqliteStatement$1;
|
|
545
|
+
transaction<T>(fn: () => T): T;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/** Options every provider constructor accepts. */
|
|
549
|
+
type APIOptions = {
|
|
550
|
+
/** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
|
|
551
|
+
sqlite?: SqliteClient$1;
|
|
552
|
+
/** Clock used for `created`-style fields. Default `Date.now`. */
|
|
553
|
+
now?: () => number;
|
|
554
|
+
/**
|
|
555
|
+
* Storage namespace for this instance's records. Instances sharing one SQLite
|
|
556
|
+
* client stay isolated when their namespaces differ. Defaults to the service name.
|
|
557
|
+
*/
|
|
558
|
+
namespace?: string;
|
|
559
|
+
};
|
|
560
|
+
|
|
616
561
|
/**
|
|
617
562
|
* One problem with a request body, at a dotted path (`patient.address.city`, `items.0.sku`).
|
|
618
563
|
* `kind` is `media_type` when the body is present but its media type is not one the operation
|
|
@@ -639,6 +584,7 @@ type RejectedRequest = {
|
|
|
639
584
|
};
|
|
640
585
|
/** One handled request, as the structured log sees it. */
|
|
641
586
|
type RequestLog = {
|
|
587
|
+
upstream?: boolean;
|
|
642
588
|
service: string;
|
|
643
589
|
namespace: string;
|
|
644
590
|
operationId: string | undefined;
|
|
@@ -773,8 +719,6 @@ type CredentialRegistry = {
|
|
|
773
719
|
}[];
|
|
774
720
|
};
|
|
775
721
|
|
|
776
|
-
type OwnedTransport = (request: Request, namespace: string, send: typeof fetch) => Promise<Response>;
|
|
777
|
-
|
|
778
722
|
/**
|
|
779
723
|
* A point-in-time copy of everything a service namespace holds.
|
|
780
724
|
*
|
|
@@ -797,6 +741,50 @@ type NamespaceSnapshot = {
|
|
|
797
741
|
}[];
|
|
798
742
|
};
|
|
799
743
|
|
|
744
|
+
/** Every stored record carries a monotonically increasing sequence for stable ordering. */
|
|
745
|
+
type Stored<T> = {
|
|
746
|
+
seq: number;
|
|
747
|
+
value: T;
|
|
748
|
+
};
|
|
749
|
+
type ListRecordsOptions<T> = {
|
|
750
|
+
/** Keep only records passing the predicate. */
|
|
751
|
+
where?: (value: T, seq: number) => boolean;
|
|
752
|
+
/** Sort order; default newest first. */
|
|
753
|
+
order?: "newest" | "oldest";
|
|
754
|
+
};
|
|
755
|
+
/**
|
|
756
|
+
* A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
|
|
757
|
+
* sequence, never by id lexicographic order, so list semantics stay stable.
|
|
758
|
+
*/
|
|
759
|
+
declare class Collection<T> {
|
|
760
|
+
private readonly sqlite;
|
|
761
|
+
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
762
|
+
readonly namespace: string;
|
|
763
|
+
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
764
|
+
readonly collectionName: string;
|
|
765
|
+
private readonly statements;
|
|
766
|
+
private prepare;
|
|
767
|
+
constructor(sqlite: SqliteClient$1,
|
|
768
|
+
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
769
|
+
namespace: string,
|
|
770
|
+
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
771
|
+
collectionName: string);
|
|
772
|
+
private bumpCollectionSeq;
|
|
773
|
+
nextSequence(): number;
|
|
774
|
+
get(id: string): T | undefined;
|
|
775
|
+
has(id: string): boolean;
|
|
776
|
+
/** Insert a new record, assigning it the next sequence number. */
|
|
777
|
+
insert(id: string, value: T): Stored<T>;
|
|
778
|
+
/** Replace an existing record's value, keeping its position. */
|
|
779
|
+
update(id: string, value: T): Stored<T> | undefined;
|
|
780
|
+
delete(id: string): boolean;
|
|
781
|
+
/** How many records the collection holds, without reading them. */
|
|
782
|
+
count(): number;
|
|
783
|
+
list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
|
|
784
|
+
id: string;
|
|
785
|
+
}>;
|
|
786
|
+
}
|
|
787
|
+
|
|
800
788
|
declare const STATE_FIELD_KINDS: readonly ["string", "number", "boolean", "null", "object", "array", "unknown"];
|
|
801
789
|
type StateFieldKind = (typeof STATE_FIELD_KINDS)[number];
|
|
802
790
|
/** JSON-safe annotations a bespoke admin UI may read. The default UI shows them as text. */
|
|
@@ -827,6 +815,26 @@ type StateView = {
|
|
|
827
815
|
collections: StateCollectionView[];
|
|
828
816
|
};
|
|
829
817
|
|
|
818
|
+
/**
|
|
819
|
+
* What names an id base: a non-negative safe integer (or its decimal string) or `"boot"`,
|
|
820
|
+
* which derives the base from the wall clock when the runtime is created.
|
|
821
|
+
*/
|
|
822
|
+
type IdBase = number | string;
|
|
823
|
+
/**
|
|
824
|
+
* Sequential id source persisted in SQLite. Ids are deterministic for a given
|
|
825
|
+
* sequence history (`cus_` + 14 opaque chars), so reproductions stay stable.
|
|
826
|
+
* A runtime's `idBase` is mixed in, so a different base reissues none of another's ids.
|
|
827
|
+
*/
|
|
828
|
+
declare class IdSequence {
|
|
829
|
+
private readonly sqlite;
|
|
830
|
+
private readonly namespace;
|
|
831
|
+
private readonly salt;
|
|
832
|
+
constructor(sqlite: SqliteClient$1, namespace: string, salt?: string);
|
|
833
|
+
next(prefix: string, length?: number): string;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
type OwnedTransport = (request: Request, namespace: string, send: typeof fetch) => Promise<Response>;
|
|
837
|
+
|
|
830
838
|
type WebhookEndpoint = {
|
|
831
839
|
/** Stable id; generated when omitted. */
|
|
832
840
|
id?: string;
|
package/dist/index.js
CHANGED