bunderstack 0.23.3 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/README.md +6 -4
- package/dist/api/builder.d.ts +13 -11
- package/dist/api/builder.d.ts.map +1 -1
- package/dist/api/builder.js.map +1 -1
- package/dist/api/context.d.ts +6 -6
- package/dist/api/context.d.ts.map +1 -1
- package/dist/api/context.js +1 -1
- package/dist/api/context.js.map +1 -1
- package/dist/api/crud-router.d.ts +6 -6
- package/dist/api/realtime-router.d.ts +1 -1
- package/dist/api/storage-router.d.ts +5 -5
- package/dist/backend-internals.d.ts +5 -13
- package/dist/backend-internals.d.ts.map +1 -1
- package/dist/backend-internals.js.map +1 -1
- package/dist/backend.d.ts +39 -5
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +37 -46
- package/dist/backend.js.map +1 -1
- package/dist/blueprint-generator.d.ts +1 -0
- package/dist/blueprint-generator.d.ts.map +1 -1
- package/dist/blueprint-generator.js +29 -1
- package/dist/blueprint-generator.js.map +1 -1
- package/dist/blueprint.d.ts +2 -1
- package/dist/blueprint.d.ts.map +1 -1
- package/dist/blueprint.js +9 -2
- package/dist/blueprint.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -2
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +13 -19
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/email/smtp.d.ts +7 -1
- package/dist/email/smtp.d.ts.map +1 -1
- package/dist/email/smtp.js +5 -1
- package/dist/email/smtp.js.map +1 -1
- package/dist/email.d.ts +3 -29
- package/dist/email.d.ts.map +1 -1
- package/dist/email.js +1 -194
- package/dist/email.js.map +1 -1
- package/dist/env-probe.d.ts +9 -0
- package/dist/env-probe.d.ts.map +1 -0
- package/dist/env-probe.js +73 -0
- package/dist/env-probe.js.map +1 -0
- package/dist/env.d.ts +2 -5
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +2 -9
- package/dist/env.js.map +1 -1
- package/dist/hosted-contract.d.ts +11 -0
- package/dist/hosted-contract.d.ts.map +1 -0
- package/dist/hosted-contract.js +46 -0
- package/dist/hosted-contract.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +15 -0
- package/dist/inspect.d.ts.map +1 -0
- package/dist/inspect.js +43 -0
- package/dist/inspect.js.map +1 -0
- package/dist/internal-tables-pg.d.ts +43 -94
- package/dist/internal-tables-pg.d.ts.map +1 -1
- package/dist/internal-tables-pg.js +15 -17
- package/dist/internal-tables-pg.js.map +1 -1
- package/dist/internal-tables.d.ts +213 -488
- package/dist/internal-tables.d.ts.map +1 -1
- package/dist/internal-tables.js +34 -33
- package/dist/internal-tables.js.map +1 -1
- package/dist/jobs/define.d.ts +20 -20
- package/dist/jobs/define.d.ts.map +1 -1
- package/dist/jobs/define.js.map +1 -1
- package/dist/jobs/worker.d.ts.map +1 -1
- package/dist/jobs/worker.js +34 -22
- package/dist/jobs/worker.js.map +1 -1
- package/dist/manifest-diff.d.ts +6 -0
- package/dist/manifest-diff.d.ts.map +1 -0
- package/dist/manifest-diff.js +42 -0
- package/dist/manifest-diff.js.map +1 -0
- package/dist/manifest.d.ts +10 -2
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +27 -29
- package/dist/manifest.js.map +1 -1
- package/dist/messaging/email.d.ts +16 -0
- package/dist/messaging/email.d.ts.map +1 -0
- package/dist/messaging/email.js +8 -0
- package/dist/messaging/email.js.map +1 -0
- package/dist/messaging/index.d.ts +8 -0
- package/dist/messaging/index.d.ts.map +1 -0
- package/dist/messaging/index.js +4 -0
- package/dist/messaging/index.js.map +1 -0
- package/dist/messaging/journal.d.ts +4 -0
- package/dist/messaging/journal.d.ts.map +1 -0
- package/dist/messaging/journal.js +19 -0
- package/dist/messaging/journal.js.map +1 -0
- package/dist/messaging/runtime.d.ts +16 -0
- package/dist/messaging/runtime.d.ts.map +1 -0
- package/dist/messaging/runtime.js +213 -0
- package/dist/messaging/runtime.js.map +1 -0
- package/dist/messaging/standalone.d.ts +27 -0
- package/dist/messaging/standalone.d.ts.map +1 -0
- package/dist/messaging/standalone.js +18 -0
- package/dist/messaging/standalone.js.map +1 -0
- package/dist/messaging/telegram.d.ts +16 -0
- package/dist/messaging/telegram.d.ts.map +1 -0
- package/dist/messaging/telegram.js +5 -0
- package/dist/messaging/telegram.js.map +1 -0
- package/dist/messaging/types.d.ts +22 -0
- package/dist/messaging/types.d.ts.map +1 -0
- package/dist/messaging/types.js +17 -0
- package/dist/messaging/types.js.map +1 -0
- package/dist/runtime.d.ts +11 -10
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +19 -31
- package/dist/runtime.js.map +1 -1
- package/dist/schema-export-pg.d.ts +1 -1
- package/dist/schema-export-pg.d.ts.map +1 -1
- package/dist/schema-export-pg.js +1 -1
- package/dist/schema-export-pg.js.map +1 -1
- package/dist/schema-export.d.ts +1 -1
- package/dist/schema-export.d.ts.map +1 -1
- package/dist/schema-export.js +1 -1
- package/dist/schema-export.js.map +1 -1
- package/dist/testing/fixture.d.ts +2 -2
- package/dist/testing/fixture.d.ts.map +1 -1
- package/dist/testing/fixture.js +11 -9
- package/dist/testing/fixture.js.map +1 -1
- package/dist/testing/messaging.d.ts +21 -0
- package/dist/testing/messaging.d.ts.map +1 -0
- package/dist/testing/messaging.js +34 -0
- package/dist/testing/messaging.js.map +1 -0
- package/dist/testing.d.ts +1 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js.map +1 -1
- package/package.json +6 -2
- package/skills/creating-bunderstack-apps/references/application-structure.md +16 -7
- package/skills/migrating-to-bunderstack/SKILL.md +72 -50
- package/skills/migrating-to-bunderstack/references/audit-checklist.md +2 -2
- package/skills/migrating-to-bunderstack/references/runtime-replacements.md +16 -12
package/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ACvD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,SAAe;IAEf,MAAM,MAAM,GACV,SAAS,CAAC,UAAU;QACpB,CAAC,OAAO,OAAO,KAAK,WAAW;YAC7B,CAAC,CAAE,OAAO,CAAC,GAA+B;YAC1C,CAAC,CAAC,EAAE,CAAC,CAAA;IACT,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,MAAM,MAAM,GAA4B,EAAE,CAAA;IAC1C,eAAe,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACnE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAE5D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAA;IAC/D,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE;QACvB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrD,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,iDAAiD,CACzD,CAAA;YACH,CAAC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAA8B,CAAA;AACjC,CAAC","sourcesContent":["// src/env.ts — env validation. Browser-safe: type-only Standard Schema import.\nimport type { StandardSchemaV1 } from '@standard-schema/spec'\n\nimport {\n StandardSchemaValidationError,\n validateStandardSchema,\n} from './standard-schema'\n\nexport const CLIENT_PREFIX = 'PUBLIC_' as const\n\n/**\n * Static, value-free metadata about an environment key. It reaches the manifest\n * and the committed blueprint, so it must never contain a value or a secret.\n */\nexport type EnvVarMeta = {\n /**\n * Whether the value is a secret. Defaults to `true` for server keys and\n * `false` for client keys. A client key can never be sensitive: `PUBLIC_*`\n * values are compiled into the browser bundle.\n */\n sensitive?: boolean\n /** Prose shown to whoever fills this key in. Max 200 characters. */\n description?: string\n}\n\nexport type EnvConfigInput = {\n server?: Record<string, StandardSchemaV1>\n client?: Record<string, StandardSchemaV1>\n /** Explicit value source for client vars (e.g. Vite's import.meta.env). */\n runtimeEnv?: Record<string, unknown>\n /** Value-free metadata per key, keyed by the key's own name. */\n meta?: Record<string, EnvVarMeta>\n}\n\nexport type BunderstackRole = 'all' | 'web' | 'worker'\n\nconst ROLES: readonly BunderstackRole[] = ['all', 'web', 'worker']\n\n/** Vars bunderstack itself consumes, always validated. */\nexport type BaseEnv = {\n NODE_ENV?: string\n DATABASE_URL: string\n DATABASE_AUTH_TOKEN?: string\n AUTH_SECRET: string\n REDIS_URL?: string\n RESEND_API_KEY?: string\n SMTP_URL?: string\n BUNDERSTACK_EMAIL_PROVIDER?: string\n BUNDERSTACK_EMAIL_FROM?: string\n BUNDERHOST_ENVIRONMENT_ID?: string\n /** Deployed commit SHA, injected by the platform. Reported by readiness. */\n BUNDERSTACK_REVISION?: string\n BUNDERSTACK_ROLE: BunderstackRole\n}\n\ntype InferVars<T> =\n T extends Record<string, StandardSchemaV1>\n ? { [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> }\n : unknown\n\n// Non-distributive so `ValidatedEnv<undefined>` is BaseEnv, not `never`.\nexport type ValidatedEnv<TEnv extends EnvConfigInput | undefined> = [\n TEnv,\n] extends [EnvConfigInput]\n ? BaseEnv &\n InferVars<NonNullable<TEnv>['server']> &\n InferVars<NonNullable<TEnv>['client']>\n : BaseEnv\n\nexport class BunderstackEnvError extends Error {\n readonly issues: string[]\n\n constructor(issues: string[]) {\n super(`Invalid environment:\\n - ${issues.join('\\n - ')}`)\n this.name = 'BunderstackEnvError'\n this.issues = issues\n }\n}\n\nexport type ValidateEnvOptions = {\n /** String tag of the configured email provider ('resend' | 'smtp'), if any. */\n emailProvider?: string\n /** Value source; defaults to process.env. Tests pass this explicitly. */\n source?: Record<string, string | undefined>\n /** Dialect-aware DATABASE_URL fallback; bunderstack passes it. */\n defaultDatabaseUrl?: string\n}\n\nconst DEV_AUTH_SECRET = 'dev-secret-change-in-prod'\n\nfunction validateSection(\n section: Record<string, StandardSchemaV1> | undefined,\n kind: 'server' | 'client',\n source: Record<string, unknown>,\n issues: string[],\n out: Record<string, unknown>,\n) {\n for (const [key, schema] of Object.entries(section ?? {})) {\n const isPublic = key.startsWith(CLIENT_PREFIX)\n if (kind === 'server' && isPublic) {\n issues.push(\n `${key}: server vars must not start with ${CLIENT_PREFIX} (move it to env.client)`,\n )\n continue\n }\n if (kind === 'client' && !isPublic) {\n issues.push(\n `${key}: client vars must start with ${CLIENT_PREFIX} (rename it or move it to env.server)`,\n )\n continue\n }\n try {\n out[key] = validateStandardSchema(schema, source[key], 'env')\n } catch (error) {\n if (!(error instanceof StandardSchemaValidationError)) throw error\n for (const issue of error.issues) {\n const path = issue.path.map(String).join('.')\n issues.push(`${key}${path ? `.${path}` : ''}: ${issue.message}`)\n }\n }\n }\n}\n\nexport function validateEnv<TEnv extends EnvConfigInput | undefined>(\n envConfig: TEnv,\n options: ValidateEnvOptions = {},\n): ValidatedEnv<TEnv> {\n const source =\n options.source ?? (process.env as Record<string, string | undefined>)\n const issues: string[] = []\n const isProduction = source.NODE_ENV === 'production'\n\n const base: BaseEnv = {\n NODE_ENV: source.NODE_ENV,\n DATABASE_URL:\n source.DATABASE_URL ?? options.defaultDatabaseUrl ?? 'file:./data.db',\n DATABASE_AUTH_TOKEN: source.DATABASE_AUTH_TOKEN,\n AUTH_SECRET: source.AUTH_SECRET ?? DEV_AUTH_SECRET,\n REDIS_URL: source.REDIS_URL,\n RESEND_API_KEY: source.RESEND_API_KEY,\n SMTP_URL: source.SMTP_URL,\n BUNDERSTACK_EMAIL_PROVIDER: source.BUNDERSTACK_EMAIL_PROVIDER,\n BUNDERSTACK_EMAIL_FROM: source.BUNDERSTACK_EMAIL_FROM,\n BUNDERHOST_ENVIRONMENT_ID: source.BUNDERHOST_ENVIRONMENT_ID,\n BUNDERSTACK_REVISION: source.BUNDERSTACK_REVISION,\n BUNDERSTACK_ROLE: (source.BUNDERSTACK_ROLE ?? 'all') as BunderstackRole,\n }\n if (isProduction && !source.AUTH_SECRET) {\n issues.push('AUTH_SECRET: required in production')\n }\n if (\n source.BUNDERSTACK_ROLE !== undefined &&\n !ROLES.includes(source.BUNDERSTACK_ROLE as BunderstackRole)\n ) {\n issues.push(\n `BUNDERSTACK_ROLE: must be one of ${ROLES.join(', ')} (got \"${String(source.BUNDERSTACK_ROLE)}\")`,\n )\n }\n if (options.emailProvider === 'resend' && !source.RESEND_API_KEY) {\n issues.push(\"RESEND_API_KEY: required when email provider is 'resend'\")\n }\n if (options.emailProvider === 'smtp' && !source.SMTP_URL) {\n issues.push(\"SMTP_URL: required when email provider is 'smtp'\")\n }\n\n const userVars: Record<string, unknown> = {}\n validateSection(envConfig?.server, 'server', source, issues, userVars)\n validateSection(envConfig?.client, 'client', source, issues, userVars)\n\n if (issues.length > 0) throw new BunderstackEnvError(issues)\n return { ...base, ...userVars } as ValidatedEnv<TEnv>\n}\n\n/**\n * Browser-side companion (t3-env style): validates ONLY the client section.\n * Server keys exist on the returned object as traps that throw on access, so\n * a leaked import fails loudly instead of silently reading undefined.\n */\nexport function createClientEnv<TEnv extends EnvConfigInput>(\n envConfig: TEnv,\n): InferVars<TEnv['client']> {\n const source =\n envConfig.runtimeEnv ??\n (typeof process !== 'undefined'\n ? (process.env as Record<string, unknown>)\n : {})\n const issues: string[] = []\n const values: Record<string, unknown> = {}\n validateSection(envConfig.client, 'client', source, issues, values)\n if (issues.length > 0) throw new BunderstackEnvError(issues)\n\n const serverKeys = new Set(Object.keys(envConfig.server ?? {}))\n return new Proxy(values, {\n get(target, prop) {\n if (typeof prop === 'string' && serverKeys.has(prop)) {\n throw new Error(\n `${prop} is server-only and not available in client env`,\n )\n }\n return Reflect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EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACnE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAE5D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAA;IAC/D,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE;QACvB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrD,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,iDAAiD,CACzD,CAAA;YACH,CAAC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAA8B,CAAA;AACjC,CAAC","sourcesContent":["// src/env.ts — env validation. Browser-safe: type-only Standard Schema import.\nimport type { StandardSchemaV1 } from '@standard-schema/spec'\n\nimport {\n StandardSchemaValidationError,\n validateStandardSchema,\n} from './standard-schema'\n\nexport const CLIENT_PREFIX = 'PUBLIC_' as const\n\n/**\n * Static, value-free metadata about an environment key. It reaches the manifest\n * and the committed blueprint, so it must never contain a value or a secret.\n */\nexport type EnvVarMeta = {\n /**\n * Whether the value is a secret. Defaults to `true` for server keys and\n * `false` for client keys. A client key can never be sensitive: `PUBLIC_*`\n * values are compiled into the browser bundle.\n */\n sensitive?: boolean\n /** Prose shown to whoever fills this key in. Max 200 characters. */\n description?: string\n}\n\nexport type EnvConfigInput = {\n server?: Record<string, StandardSchemaV1>\n client?: Record<string, StandardSchemaV1>\n /** Explicit value source for client vars (e.g. Vite's import.meta.env). */\n runtimeEnv?: Record<string, unknown>\n /** Value-free metadata per key, keyed by the key's own name. */\n meta?: Record<string, EnvVarMeta>\n}\n\nexport type BunderstackRole = 'all' | 'web' | 'worker'\n\nconst ROLES: readonly BunderstackRole[] = ['all', 'web', 'worker']\n\n/** Vars bunderstack itself consumes, always validated. */\nexport type BaseEnv = {\n NODE_ENV?: string\n DATABASE_URL: string\n DATABASE_AUTH_TOKEN?: string\n AUTH_SECRET: string\n REDIS_URL?: string\n RESEND_API_KEY?: string\n BUNDERSTACK_MESSAGING_CONFIG?: string\n BUNDERSTACK_BLUEPRINT_PATH?: string\n BUNDERHOST_ENVIRONMENT_ID?: string\n /** Deployed commit SHA, injected by the platform. Reported by readiness. */\n BUNDERSTACK_REVISION?: string\n BUNDERSTACK_ROLE: BunderstackRole\n}\n\ntype InferVars<T> =\n T extends Record<string, StandardSchemaV1>\n ? { [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> }\n : unknown\n\n// Non-distributive so `ValidatedEnv<undefined>` is BaseEnv, not `never`.\nexport type ValidatedEnv<TEnv extends EnvConfigInput | undefined> = [\n TEnv,\n] extends [EnvConfigInput]\n ? BaseEnv &\n InferVars<NonNullable<TEnv>['server']> &\n InferVars<NonNullable<TEnv>['client']>\n : BaseEnv\n\nexport class BunderstackEnvError extends Error {\n readonly issues: string[]\n\n constructor(issues: string[]) {\n super(`Invalid environment:\\n - ${issues.join('\\n - ')}`)\n this.name = 'BunderstackEnvError'\n this.issues = issues\n }\n}\n\nexport type ValidateEnvOptions = {\n /** Value source; defaults to process.env. Tests pass this explicitly. */\n source?: Record<string, string | undefined>\n /** Dialect-aware DATABASE_URL fallback; bunderstack passes it. */\n defaultDatabaseUrl?: string\n}\n\nconst DEV_AUTH_SECRET = 'dev-secret-change-in-prod'\n\nfunction validateSection(\n section: Record<string, StandardSchemaV1> | undefined,\n kind: 'server' | 'client',\n source: Record<string, unknown>,\n issues: string[],\n out: Record<string, unknown>,\n) {\n for (const [key, schema] of Object.entries(section ?? {})) {\n const isPublic = key.startsWith(CLIENT_PREFIX)\n if (kind === 'server' && isPublic) {\n issues.push(\n `${key}: server vars must not start with ${CLIENT_PREFIX} (move it to env.client)`,\n )\n continue\n }\n if (kind === 'client' && !isPublic) {\n issues.push(\n `${key}: client vars must start with ${CLIENT_PREFIX} (rename it or move it to env.server)`,\n )\n continue\n }\n try {\n out[key] = validateStandardSchema(schema, source[key], 'env')\n } catch (error) {\n if (!(error instanceof StandardSchemaValidationError)) throw error\n for (const issue of error.issues) {\n const path = issue.path.map(String).join('.')\n issues.push(`${key}${path ? `.${path}` : ''}: ${issue.message}`)\n }\n }\n }\n}\n\nexport function validateEnv<TEnv extends EnvConfigInput | undefined>(\n envConfig: TEnv,\n options: ValidateEnvOptions = {},\n): ValidatedEnv<TEnv> {\n const source =\n options.source ?? (process.env as Record<string, string | undefined>)\n const issues: string[] = []\n const isProduction = source.NODE_ENV === 'production'\n\n const base: BaseEnv = {\n NODE_ENV: source.NODE_ENV,\n DATABASE_URL:\n source.DATABASE_URL ?? options.defaultDatabaseUrl ?? 'file:./data.db',\n DATABASE_AUTH_TOKEN: source.DATABASE_AUTH_TOKEN,\n AUTH_SECRET: source.AUTH_SECRET ?? DEV_AUTH_SECRET,\n REDIS_URL: source.REDIS_URL,\n RESEND_API_KEY: source.RESEND_API_KEY,\n BUNDERSTACK_MESSAGING_CONFIG: source.BUNDERSTACK_MESSAGING_CONFIG,\n BUNDERSTACK_BLUEPRINT_PATH: source.BUNDERSTACK_BLUEPRINT_PATH,\n BUNDERHOST_ENVIRONMENT_ID: source.BUNDERHOST_ENVIRONMENT_ID,\n BUNDERSTACK_REVISION: source.BUNDERSTACK_REVISION,\n BUNDERSTACK_ROLE: (source.BUNDERSTACK_ROLE ?? 'all') as BunderstackRole,\n }\n if (isProduction && !source.AUTH_SECRET) {\n issues.push('AUTH_SECRET: required in production')\n }\n if (\n source.BUNDERSTACK_ROLE !== undefined &&\n !ROLES.includes(source.BUNDERSTACK_ROLE as BunderstackRole)\n ) {\n issues.push(\n `BUNDERSTACK_ROLE: must be one of ${ROLES.join(', ')} (got \"${String(source.BUNDERSTACK_ROLE)}\")`,\n )\n }\n const userVars: Record<string, unknown> = {}\n validateSection(envConfig?.server, 'server', source, issues, userVars)\n validateSection(envConfig?.client, 'client', source, issues, userVars)\n\n if (issues.length > 0) throw new BunderstackEnvError(issues)\n return { ...base, ...userVars } as ValidatedEnv<TEnv>\n}\n\n/**\n * Browser-side companion (t3-env style): validates ONLY the client section.\n * Server keys exist on the returned object as traps that throw on access, so\n * a leaked import fails loudly instead of silently reading undefined.\n */\nexport function createClientEnv<TEnv extends EnvConfigInput>(\n envConfig: TEnv,\n): InferVars<TEnv['client']> {\n const source =\n envConfig.runtimeEnv ??\n (typeof process !== 'undefined'\n ? (process.env as Record<string, unknown>)\n : {})\n const issues: string[] = []\n const values: Record<string, unknown> = {}\n validateSection(envConfig.client, 'client', source, issues, values)\n if (issues.length > 0) throw new BunderstackEnvError(issues)\n\n const serverKeys = new Set(Object.keys(envConfig.server ?? {}))\n return new Proxy(values, {\n get(target, prop) {\n if (typeof prop === 'string' && serverKeys.has(prop)) {\n throw new Error(\n `${prop} is server-only and not available in client env`,\n )\n }\n return Reflect.get(target, prop)\n },\n }) as InferVars<TEnv['client']>\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BunderstackManifest } from './manifest.js';
|
|
2
|
+
export declare class HostedBlueprintMismatchError extends Error {
|
|
3
|
+
constructor(paths: readonly {
|
|
4
|
+
kind: string;
|
|
5
|
+
path: string;
|
|
6
|
+
}[]);
|
|
7
|
+
}
|
|
8
|
+
export declare function manifestFromBlueprint(source: string): BunderstackManifest;
|
|
9
|
+
export declare function assertManifestMatchesBlueprint(manifest: BunderstackManifest, source: string): void;
|
|
10
|
+
export declare function assertHostedBlueprintFile(manifest: BunderstackManifest, path: string): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=hosted-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-contract.d.ts","sourceRoot":"","sources":["../src/hosted-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAKrD,qBAAa,4BAA6B,SAAQ,KAAK;gBACzC,KAAK,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE;CAO7D;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAuBzE;AAED,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,EAAE,MAAM,GACb,IAAI,CAIN;AAED,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,mBAAmB,EAC7B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { parseBlueprintYaml } from './blueprint.js';
|
|
2
|
+
import { diffManifests } from './manifest-diff.js';
|
|
3
|
+
export class HostedBlueprintMismatchError extends Error {
|
|
4
|
+
constructor(paths) {
|
|
5
|
+
super('[bunderstack] runtime declaration does not match the committed blueprint:\n' +
|
|
6
|
+
paths.map(({ kind, path }) => ` - ${kind}: ${path}`).join('\n'));
|
|
7
|
+
this.name = 'HostedBlueprintMismatchError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function manifestFromBlueprint(source) {
|
|
11
|
+
const blueprint = parseBlueprintYaml(source);
|
|
12
|
+
return {
|
|
13
|
+
version: blueprint.bunderstack.manifestVersion,
|
|
14
|
+
database: {
|
|
15
|
+
dialect: blueprint.resources.database.dialect,
|
|
16
|
+
migrationsDirectory: blueprint.resources.database.migrationsDirectory,
|
|
17
|
+
tables: blueprint.resources.database.tables,
|
|
18
|
+
},
|
|
19
|
+
storage: blueprint.resources.storage,
|
|
20
|
+
realtime: blueprint.resources.realtime ?? { required: false },
|
|
21
|
+
messaging: blueprint.resources.messaging,
|
|
22
|
+
environment: blueprint.environment.map((entry) => ({
|
|
23
|
+
...entry,
|
|
24
|
+
sensitive: entry.sensitive ?? entry.scope === 'server',
|
|
25
|
+
})),
|
|
26
|
+
api: blueprint.api ?? { operations: [] },
|
|
27
|
+
background: {
|
|
28
|
+
jobs: blueprint.background.jobs,
|
|
29
|
+
cron: blueprint.background.cron,
|
|
30
|
+
maintenance: blueprint.background.maintenance,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function assertManifestMatchesBlueprint(manifest, source) {
|
|
35
|
+
const differences = diffManifests(manifestFromBlueprint(source), manifest);
|
|
36
|
+
if (differences.length > 0)
|
|
37
|
+
throw new HostedBlueprintMismatchError(differences);
|
|
38
|
+
}
|
|
39
|
+
export async function assertHostedBlueprintFile(manifest, path) {
|
|
40
|
+
const file = Bun.file(path);
|
|
41
|
+
if (!(await file.exists())) {
|
|
42
|
+
throw new Error(`[bunderstack] hosted blueprint does not exist: ${path}`);
|
|
43
|
+
}
|
|
44
|
+
assertManifestMatchesBlueprint(manifest, await file.text());
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=hosted-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-contract.js","sourceRoot":"","sources":["../src/hosted-contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IACrD,YAAY,KAAgD;QAC1D,KAAK,CACH,6EAA6E;YAC3E,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACnE,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAA;IAC5C,CAAC;CACF;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,MAAM,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AAK,UAAU,yBAAyB,CAC7C,QAA6B,EAC7B,IAAY;IAEZ,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,kDAAkD,IAAI,EAAE,CAAC,CAAA;IAC3E,CAAC;IACD,8BAA8B,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;AAC7D,CAAC","sourcesContent":["import type { BunderstackManifest } from './manifest'\n\nimport { parseBlueprintYaml } from './blueprint'\nimport { diffManifests } from './manifest-diff'\n\nexport class HostedBlueprintMismatchError extends Error {\n constructor(paths: readonly { kind: string; path: string }[]) {\n super(\n '[bunderstack] runtime declaration does not match the committed blueprint:\\n' +\n paths.map(({ kind, path }) => ` - ${kind}: ${path}`).join('\\n'),\n )\n this.name = 'HostedBlueprintMismatchError'\n }\n}\n\nexport function manifestFromBlueprint(source: string): BunderstackManifest {\n const blueprint = parseBlueprintYaml(source)\n return {\n version: blueprint.bunderstack.manifestVersion,\n database: {\n dialect: blueprint.resources.database.dialect,\n migrationsDirectory: blueprint.resources.database.migrationsDirectory,\n tables: blueprint.resources.database.tables,\n },\n storage: blueprint.resources.storage,\n realtime: blueprint.resources.realtime ?? { required: false },\n messaging: blueprint.resources.messaging,\n environment: blueprint.environment.map((entry) => ({\n ...entry,\n sensitive: entry.sensitive ?? entry.scope === 'server',\n })),\n api: blueprint.api ?? { operations: [] },\n background: {\n jobs: blueprint.background.jobs,\n cron: blueprint.background.cron,\n maintenance: blueprint.background.maintenance,\n },\n }\n}\n\nexport function assertManifestMatchesBlueprint(\n manifest: BunderstackManifest,\n source: string,\n): void {\n const differences = diffManifests(manifestFromBlueprint(source), manifest)\n if (differences.length > 0)\n throw new HostedBlueprintMismatchError(differences)\n}\n\nexport async function assertHostedBlueprintFile(\n manifest: BunderstackManifest,\n path: string,\n): Promise<void> {\n const file = Bun.file(path)\n if (!(await file.exists())) {\n throw new Error(`[bunderstack] hosted blueprint does not exist: ${path}`)\n }\n assertManifestMatchesBlueprint(manifest, await file.text())\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './backend.js';
|
|
2
|
+
export { createMessaging, resend, customEmail, telegram } from './messaging/index.js';
|
|
3
|
+
export type { MessagingConfig, MessagingDescriptor, MessagingFacade, MessagingFacades, TelegramMessage, } from './messaging/index.js';
|
|
2
4
|
export type { AppRunWorkerOptions, AppStartWorkerOptions, AuthInstance, BucketNamesOf, BunderstackApp, StorageFacade, } from './runtime.js';
|
|
3
5
|
export { listSpec } from './api/list-spec.js';
|
|
4
6
|
export type { ListSpecOptions } from './api/list-spec.js';
|
|
@@ -14,8 +16,7 @@ export { buildManifest, parseManifest } from './manifest.js';
|
|
|
14
16
|
export type { ApiOperation, ApiOperationEffect, BunderstackManifest, ManifestEnvVar, } from './manifest.js';
|
|
15
17
|
export { buildReadinessReport, readinessReportSchema } from './readiness.js';
|
|
16
18
|
export type { ReadinessCheck, ReadinessCheckName, ReadinessCode, ReadinessReport, ReadinessStatus, } from './readiness.js';
|
|
17
|
-
export {
|
|
18
|
-
export type { EmailMessage, EmailAdapter, EmailConfigInput, EmailFacade, } from './email.js';
|
|
19
|
+
export type { EmailMessage, EmailAdapter } from './email.js';
|
|
19
20
|
export { createJobsBuilder } from './jobs/index.js';
|
|
20
21
|
export type { BunderstackJobContext, BunderstackJobsBuilder, BackgroundDefinition, BackgroundDefs, CronDefinition, CronInvocation, EnqueueOptions, JobContext, JobDefinition, JobsDefs, JobsFacade, JobsRuntimeFacade, QueueJobDefinition, QueueJobKeys, RunWorkerOptions, StartWorkerOptions, WorkerHandle, } from './jobs/index.js';
|
|
21
22
|
export { defineAccess, validateAndResolveAccess, checkAccess, AUTH_TABLE_NAMES, } from './access.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,aAAa,GACd,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACvE,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AACzE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AACzD,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,GACf,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACzE,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","s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,MAAM,eAAe,CAAA;AAC3D,YAAY,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACtE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './backend.js';
|
|
2
|
+
export { createMessaging, resend, customEmail, telegram } from './messaging/index.js';
|
|
2
3
|
export { listSpec } from './api/list-spec.js';
|
|
3
4
|
export { MAX_LIST_LIMIT } from './list-query.js';
|
|
4
5
|
export { BunderstackError } from './errors.js';
|
|
@@ -6,7 +7,6 @@ export { resolveConfig, resolveAuthConfig, defineAuth } from './config.js';
|
|
|
6
7
|
export { validateEnv, createClientEnv, BunderstackEnvError } from './env.js';
|
|
7
8
|
export { buildManifest, parseManifest } from './manifest.js';
|
|
8
9
|
export { buildReadinessReport, readinessReportSchema } from './readiness.js';
|
|
9
|
-
export { createEmail } from './email.js';
|
|
10
10
|
export { createJobsBuilder } from './jobs/index.js';
|
|
11
11
|
export { defineAccess, validateAndResolveAccess, checkAccess, AUTH_TABLE_NAMES, } from './access.js';
|
|
12
12
|
export { typeid, generate as generateTypeId, parse as parseTypeId, asTypeId, } from './typeid.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAgB5E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAG1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AASvE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAEzE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAOzD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AASzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAoBhD,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,WAAW,EACX,gBAAgB,GACjB,MAAM,UAAU,CAAA;AAOjB,OAAO,EACL,MAAM,EACN,QAAQ,IAAI,cAAc,EAC1B,KAAK,IAAI,WAAW,EACpB,QAAQ,GACT,MAAM,UAAU,CAAA;AAejB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAMxD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAU3D,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA","sourcesContent":["export * from './backend'\nexport { createMessaging, resend, customEmail, telegram } from './messaging'\nexport type {\n MessagingConfig,\n MessagingDescriptor,\n MessagingFacade,\n MessagingFacades,\n TelegramMessage,\n} from './messaging'\nexport type {\n AppRunWorkerOptions,\n AppStartWorkerOptions,\n AuthInstance,\n BucketNamesOf,\n BunderstackApp,\n StorageFacade,\n} from './runtime'\nexport { listSpec } from './api/list-spec'\nexport type { ListSpecOptions } from './api/list-spec'\nexport type { BunderstackDb, BunderstackTx } from './db'\nexport { MAX_LIST_LIMIT } from './list-query'\nexport { BunderstackError } from './errors'\nexport type { BunderstackErrorCode } from './errors'\nexport { resolveConfig, resolveAuthConfig, defineAuth } from './config'\nexport type {\n AuthConfigContext,\n AuthConfigFactory,\n AuthConfigInput,\n BetterAuthConfig,\n BunderstackConfig,\n ResolvedConfig,\n} from './config'\nexport { validateEnv, createClientEnv, BunderstackEnvError } from './env'\nexport type { EnvConfigInput, BaseEnv, ValidatedEnv } from './env'\nexport { buildManifest, parseManifest } from './manifest'\nexport type {\n ApiOperation,\n ApiOperationEffect,\n BunderstackManifest,\n ManifestEnvVar,\n} from './manifest'\nexport { buildReadinessReport, readinessReportSchema } from './readiness'\nexport type {\n ReadinessCheck,\n ReadinessCheckName,\n ReadinessCode,\n ReadinessReport,\n ReadinessStatus,\n} from './readiness'\nexport type { EmailMessage, EmailAdapter } from './email'\nexport { createJobsBuilder } from './jobs/index'\nexport type {\n BunderstackJobContext,\n BunderstackJobsBuilder,\n BackgroundDefinition,\n BackgroundDefs,\n CronDefinition,\n CronInvocation,\n EnqueueOptions,\n JobContext,\n JobDefinition,\n JobsDefs,\n JobsFacade,\n JobsRuntimeFacade,\n QueueJobDefinition,\n QueueJobKeys,\n RunWorkerOptions,\n StartWorkerOptions,\n WorkerHandle,\n} from './jobs/index'\nexport {\n defineAccess,\n validateAndResolveAccess,\n checkAccess,\n AUTH_TABLE_NAMES,\n} from './access'\nexport type {\n TableAccessInput,\n OperationRule,\n AccessContext,\n AccessUser,\n} from './access'\nexport {\n typeid,\n generate as generateTypeId,\n parse as parseTypeId,\n asTypeId,\n} from './typeid'\nexport type { TypeId } from './typeid'\nexport type {\n DatabaseAdapter,\n DatabaseConnection,\n DatabaseConnectionResult,\n} from './database/adapter'\nexport type { StorageAdapter } from './storage/index'\nexport type {\n StorageConfigInput,\n BucketConfigInput,\n ResolvedBucket,\n} from './storage/buckets'\nexport type { TransformSpec } from './storage/thumbnails'\nexport type { RealtimeAction } from './realtime/publisher'\nexport { createRealtimeFacade } from './realtime/facade'\nexport type {\n RealtimeFacade,\n RealtimeTransport,\n SchemaTable,\n} from './realtime/facade'\nexport { createApiBuilder, defineApi } from './api/builder'\nexport type { BunderstackApiBuilder, ApiFactory } from './api/builder'\nexport type { ApiContext } from './api/context'\nexport type {\n CrudApiRouterFor,\n ExposedApiTables,\n MergeApiRouterTypes,\n UnifiedApiRouter,\n} from './api/types'\nexport type { TableCrudProcedures } from './api/crud-router'\nexport {\n buildApiRegistry,\n mergeApiRoutersStrict,\n normalizeApiPath,\n normalizeForeignOpenAPISpec,\n} from './api/registry'\nexport { mergeOpenAPISpecs } from './api/openapi'\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AnyRouter } from '@orpc/server';
|
|
2
|
+
import type { BunderstackDefinitionConfig } from './backend.js';
|
|
3
|
+
import type { BaseEnv, EnvConfigInput } from './env.js';
|
|
4
|
+
import type { JobsDefs } from './jobs/index.js';
|
|
5
|
+
import type { BunderstackManifest } from './manifest.js';
|
|
6
|
+
export type AnyDefinitionConfig = BunderstackDefinitionConfig<Record<string, unknown>, any, any, any, any, any, any, any>;
|
|
7
|
+
export type InspectedDefinition = {
|
|
8
|
+
readonly config: AnyDefinitionConfig;
|
|
9
|
+
readonly jobsDefs: JobsDefs | undefined;
|
|
10
|
+
readonly customApiRouter: AnyRouter | undefined;
|
|
11
|
+
readonly manifest: BunderstackManifest;
|
|
12
|
+
readonly env: BaseEnv;
|
|
13
|
+
};
|
|
14
|
+
export declare function inspectConfig(input: AnyDefinitionConfig, envConfig: EnvConfigInput | undefined, env: BaseEnv): InspectedDefinition;
|
|
15
|
+
//# sourceMappingURL=inspect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../src/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAarD,MAAM,MAAM,mBAAmB,GAAG,2BAA2B,CAC3D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,CACJ,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAA;IACpC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAA;IACvC,QAAQ,CAAC,eAAe,EAAE,SAAS,GAAG,SAAS,CAAA;IAC/C,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAA;IACtC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,mBAAmB,EAC1B,SAAS,EAAE,cAAc,GAAG,SAAS,EACrC,GAAG,EAAE,OAAO,GACX,mBAAmB,CAqCrB"}
|
package/dist/inspect.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createApiBuilder } from './api/builder.js';
|
|
2
|
+
import { describeApiOperations } from './api/catalog.js';
|
|
3
|
+
import { detectDialect } from './dialect.js';
|
|
4
|
+
import { createJobsBuilder, validateJobsDefs } from './jobs/index.js';
|
|
5
|
+
import { buildManifest } from './manifest.js';
|
|
6
|
+
import { STORAGE_SWEEP_JOB_NAME, STORAGE_SWEEP_SCHEDULE, } from './storage/background.js';
|
|
7
|
+
import { resolveBuckets } from './storage/buckets.js';
|
|
8
|
+
export function inspectConfig(input, envConfig, env) {
|
|
9
|
+
const config = { ...input };
|
|
10
|
+
const dialect = detectDialect(config.schema);
|
|
11
|
+
const jobsDefs = config.jobs
|
|
12
|
+
? typeof config.jobs === 'function'
|
|
13
|
+
? config.jobs(createJobsBuilder())
|
|
14
|
+
: config.jobs
|
|
15
|
+
: undefined;
|
|
16
|
+
if (jobsDefs)
|
|
17
|
+
validateJobsDefs(jobsDefs);
|
|
18
|
+
const customApiRouter = typeof config.api === 'function'
|
|
19
|
+
? config.api(createApiBuilder())
|
|
20
|
+
: config.api;
|
|
21
|
+
const manifest = buildManifest({
|
|
22
|
+
schema: config.schema,
|
|
23
|
+
dialect,
|
|
24
|
+
migrationsDirectory: config.database.migrations ?? './migrations',
|
|
25
|
+
storage: resolveBuckets(config.storage, {}),
|
|
26
|
+
envConfig,
|
|
27
|
+
messaging: config.messaging,
|
|
28
|
+
realtime: Boolean(config.realtime),
|
|
29
|
+
api: describeApiOperations(customApiRouter),
|
|
30
|
+
jobs: config.storage
|
|
31
|
+
? {
|
|
32
|
+
...jobsDefs,
|
|
33
|
+
[STORAGE_SWEEP_JOB_NAME]: {
|
|
34
|
+
kind: 'cron',
|
|
35
|
+
schedule: STORAGE_SWEEP_SCHEDULE,
|
|
36
|
+
handler: () => { },
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
: jobsDefs,
|
|
40
|
+
});
|
|
41
|
+
return { config, jobsDefs, customApiRouter, manifest, env };
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=inspect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../src/inspect.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,qBAAqB,EAA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AO,CAAC,MAAM,CAAC,QAAQ,CAAC;QAClC,GAAG,EAAE,qBAAqB,CAAC,eAAe,CAAC;QAC3C,IAAI,EAAE,MAAM,CAAC,OAAO;YAClB,CAAC,CAAC;gBACE,GAAG,QAAQ;gBACX,CAAC,sBAAsB,CAAC,EAAE;oBACxB,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,sBAAsB;oBAChC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;iBAClB;aACF;YACH,CAAC,CAAC,QAAQ;KACb,CAAC,CAAA;IAEF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAA;AAC7D,CAAC","sourcesContent":["import type { AnyRouter } from '@orpc/server'\n\nimport type { BunderstackDefinitionConfig } from './backend'\nimport type { BaseEnv, EnvConfigInput } from './env'\nimport type { JobsDefs } from './jobs'\nimport type { BunderstackManifest } from './manifest'\n\nimport { createApiBuilder } from './api/builder'\nimport { describeApiOperations } from './api/catalog'\nimport { detectDialect } from './dialect'\nimport { createJobsBuilder, validateJobsDefs } from './jobs'\nimport { buildManifest } from './manifest'\nimport {\n STORAGE_SWEEP_JOB_NAME,\n STORAGE_SWEEP_SCHEDULE,\n} from './storage/background'\nimport { resolveBuckets } from './storage/buckets'\n\nexport type AnyDefinitionConfig = BunderstackDefinitionConfig<\n Record<string, unknown>,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n>\n\nexport type InspectedDefinition = {\n readonly config: AnyDefinitionConfig\n readonly jobsDefs: JobsDefs | undefined\n readonly customApiRouter: AnyRouter | undefined\n readonly manifest: BunderstackManifest\n readonly env: BaseEnv\n}\n\nexport function inspectConfig(\n input: AnyDefinitionConfig,\n envConfig: EnvConfigInput | undefined,\n env: BaseEnv,\n): InspectedDefinition {\n const config = { ...input } as AnyDefinitionConfig\n const dialect = detectDialect(config.schema)\n const jobsDefs = config.jobs\n ? typeof config.jobs === 'function'\n ? config.jobs(createJobsBuilder())\n : config.jobs\n : undefined\n if (jobsDefs) validateJobsDefs(jobsDefs)\n\n const customApiRouter =\n typeof config.api === 'function'\n ? config.api(createApiBuilder())\n : config.api\n\n const manifest = buildManifest({\n schema: config.schema,\n dialect,\n migrationsDirectory: config.database.migrations ?? './migrations',\n storage: resolveBuckets(config.storage, {}),\n envConfig,\n messaging: config.messaging,\n realtime: Boolean(config.realtime),\n api: describeApiOperations(customApiRouter),\n jobs: config.storage\n ? {\n ...jobsDefs,\n [STORAGE_SWEEP_JOB_NAME]: {\n kind: 'cron',\n schedule: STORAGE_SWEEP_SCHEDULE,\n handler: () => {},\n },\n }\n : jobsDefs,\n })\n\n return { config, jobsDefs, customApiRouter, manifest, env }\n}\n"]}
|
|
@@ -478,13 +478,13 @@ export declare const bunderstackJobsPg: import("drizzle-orm/pg-core").PgTableWit
|
|
|
478
478
|
};
|
|
479
479
|
dialect: "pg";
|
|
480
480
|
}>;
|
|
481
|
-
export declare const
|
|
482
|
-
name: "
|
|
481
|
+
export declare const bunderstackMessagesPg: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
482
|
+
name: "_bunderstack_messages";
|
|
483
483
|
schema: undefined;
|
|
484
484
|
columns: {
|
|
485
485
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
486
486
|
name: "id";
|
|
487
|
-
tableName: "
|
|
487
|
+
tableName: "_bunderstack_messages";
|
|
488
488
|
dataType: "string";
|
|
489
489
|
columnType: "PgText";
|
|
490
490
|
data: string;
|
|
@@ -499,43 +499,9 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
499
499
|
identity: undefined;
|
|
500
500
|
generated: undefined;
|
|
501
501
|
}, {}, {}>;
|
|
502
|
-
|
|
503
|
-
name: "
|
|
504
|
-
tableName: "
|
|
505
|
-
dataType: "string";
|
|
506
|
-
columnType: "PgText";
|
|
507
|
-
data: string;
|
|
508
|
-
driverParam: string;
|
|
509
|
-
notNull: true;
|
|
510
|
-
hasDefault: false;
|
|
511
|
-
isPrimaryKey: false;
|
|
512
|
-
isAutoincrement: false;
|
|
513
|
-
hasRuntimeDefault: false;
|
|
514
|
-
enumValues: [string, ...string[]];
|
|
515
|
-
baseColumn: never;
|
|
516
|
-
identity: undefined;
|
|
517
|
-
generated: undefined;
|
|
518
|
-
}, {}, {}>;
|
|
519
|
-
providerId: import("drizzle-orm/pg-core").PgColumn<{
|
|
520
|
-
name: "provider_id";
|
|
521
|
-
tableName: "_bunderstack_emails";
|
|
522
|
-
dataType: "string";
|
|
523
|
-
columnType: "PgText";
|
|
524
|
-
data: string;
|
|
525
|
-
driverParam: string;
|
|
526
|
-
notNull: false;
|
|
527
|
-
hasDefault: false;
|
|
528
|
-
isPrimaryKey: false;
|
|
529
|
-
isAutoincrement: false;
|
|
530
|
-
hasRuntimeDefault: false;
|
|
531
|
-
enumValues: [string, ...string[]];
|
|
532
|
-
baseColumn: never;
|
|
533
|
-
identity: undefined;
|
|
534
|
-
generated: undefined;
|
|
535
|
-
}, {}, {}>;
|
|
536
|
-
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
537
|
-
name: "status";
|
|
538
|
-
tableName: "_bunderstack_emails";
|
|
502
|
+
channel: import("drizzle-orm/pg-core").PgColumn<{
|
|
503
|
+
name: "channel";
|
|
504
|
+
tableName: "_bunderstack_messages";
|
|
539
505
|
dataType: "string";
|
|
540
506
|
columnType: "PgText";
|
|
541
507
|
data: string;
|
|
@@ -550,9 +516,9 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
550
516
|
identity: undefined;
|
|
551
517
|
generated: undefined;
|
|
552
518
|
}, {}, {}>;
|
|
553
|
-
|
|
554
|
-
name: "
|
|
555
|
-
tableName: "
|
|
519
|
+
kind: import("drizzle-orm/pg-core").PgColumn<{
|
|
520
|
+
name: "kind";
|
|
521
|
+
tableName: "_bunderstack_messages";
|
|
556
522
|
dataType: "string";
|
|
557
523
|
columnType: "PgText";
|
|
558
524
|
data: string;
|
|
@@ -567,26 +533,9 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
567
533
|
identity: undefined;
|
|
568
534
|
generated: undefined;
|
|
569
535
|
}, {}, {}>;
|
|
570
|
-
|
|
571
|
-
name: "
|
|
572
|
-
tableName: "
|
|
573
|
-
dataType: "string";
|
|
574
|
-
columnType: "PgText";
|
|
575
|
-
data: string;
|
|
576
|
-
driverParam: string;
|
|
577
|
-
notNull: true;
|
|
578
|
-
hasDefault: false;
|
|
579
|
-
isPrimaryKey: false;
|
|
580
|
-
isAutoincrement: false;
|
|
581
|
-
hasRuntimeDefault: false;
|
|
582
|
-
enumValues: [string, ...string[]];
|
|
583
|
-
baseColumn: never;
|
|
584
|
-
identity: undefined;
|
|
585
|
-
generated: undefined;
|
|
586
|
-
}, {}, {}>;
|
|
587
|
-
ccJson: import("drizzle-orm/pg-core").PgColumn<{
|
|
588
|
-
name: "cc_json";
|
|
589
|
-
tableName: "_bunderstack_emails";
|
|
536
|
+
provider: import("drizzle-orm/pg-core").PgColumn<{
|
|
537
|
+
name: "provider";
|
|
538
|
+
tableName: "_bunderstack_messages";
|
|
590
539
|
dataType: "string";
|
|
591
540
|
columnType: "PgText";
|
|
592
541
|
data: string;
|
|
@@ -601,9 +550,9 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
601
550
|
identity: undefined;
|
|
602
551
|
generated: undefined;
|
|
603
552
|
}, {}, {}>;
|
|
604
|
-
|
|
605
|
-
name: "
|
|
606
|
-
tableName: "
|
|
553
|
+
credentialSource: import("drizzle-orm/pg-core").PgColumn<{
|
|
554
|
+
name: "credential_source";
|
|
555
|
+
tableName: "_bunderstack_messages";
|
|
607
556
|
dataType: "string";
|
|
608
557
|
columnType: "PgText";
|
|
609
558
|
data: string;
|
|
@@ -618,9 +567,9 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
618
567
|
identity: undefined;
|
|
619
568
|
generated: undefined;
|
|
620
569
|
}, {}, {}>;
|
|
621
|
-
|
|
622
|
-
name: "
|
|
623
|
-
tableName: "
|
|
570
|
+
providerId: import("drizzle-orm/pg-core").PgColumn<{
|
|
571
|
+
name: "provider_id";
|
|
572
|
+
tableName: "_bunderstack_messages";
|
|
624
573
|
dataType: "string";
|
|
625
574
|
columnType: "PgText";
|
|
626
575
|
data: string;
|
|
@@ -635,9 +584,9 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
635
584
|
identity: undefined;
|
|
636
585
|
generated: undefined;
|
|
637
586
|
}, {}, {}>;
|
|
638
|
-
|
|
639
|
-
name: "
|
|
640
|
-
tableName: "
|
|
587
|
+
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
588
|
+
name: "status";
|
|
589
|
+
tableName: "_bunderstack_messages";
|
|
641
590
|
dataType: "string";
|
|
642
591
|
columnType: "PgText";
|
|
643
592
|
data: string;
|
|
@@ -652,14 +601,14 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
652
601
|
identity: undefined;
|
|
653
602
|
generated: undefined;
|
|
654
603
|
}, {}, {}>;
|
|
655
|
-
|
|
656
|
-
name: "
|
|
657
|
-
tableName: "
|
|
604
|
+
recipientsJson: import("drizzle-orm/pg-core").PgColumn<{
|
|
605
|
+
name: "recipients_json";
|
|
606
|
+
tableName: "_bunderstack_messages";
|
|
658
607
|
dataType: "string";
|
|
659
608
|
columnType: "PgText";
|
|
660
609
|
data: string;
|
|
661
610
|
driverParam: string;
|
|
662
|
-
notNull:
|
|
611
|
+
notNull: true;
|
|
663
612
|
hasDefault: false;
|
|
664
613
|
isPrimaryKey: false;
|
|
665
614
|
isAutoincrement: false;
|
|
@@ -669,14 +618,14 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
669
618
|
identity: undefined;
|
|
670
619
|
generated: undefined;
|
|
671
620
|
}, {}, {}>;
|
|
672
|
-
|
|
673
|
-
name: "
|
|
674
|
-
tableName: "
|
|
621
|
+
contentJson: import("drizzle-orm/pg-core").PgColumn<{
|
|
622
|
+
name: "content_json";
|
|
623
|
+
tableName: "_bunderstack_messages";
|
|
675
624
|
dataType: "string";
|
|
676
625
|
columnType: "PgText";
|
|
677
626
|
data: string;
|
|
678
627
|
driverParam: string;
|
|
679
|
-
notNull:
|
|
628
|
+
notNull: true;
|
|
680
629
|
hasDefault: false;
|
|
681
630
|
isPrimaryKey: false;
|
|
682
631
|
isAutoincrement: false;
|
|
@@ -688,7 +637,7 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
688
637
|
}, {}, {}>;
|
|
689
638
|
error: import("drizzle-orm/pg-core").PgColumn<{
|
|
690
639
|
name: "error";
|
|
691
|
-
tableName: "
|
|
640
|
+
tableName: "_bunderstack_messages";
|
|
692
641
|
dataType: "string";
|
|
693
642
|
columnType: "PgText";
|
|
694
643
|
data: string;
|
|
@@ -705,7 +654,7 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
705
654
|
}, {}, {}>;
|
|
706
655
|
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
707
656
|
name: "created_at";
|
|
708
|
-
tableName: "
|
|
657
|
+
tableName: "_bunderstack_messages";
|
|
709
658
|
dataType: "number";
|
|
710
659
|
columnType: "PgBigInt53";
|
|
711
660
|
data: number;
|
|
@@ -722,7 +671,7 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
722
671
|
}, {}, {}>;
|
|
723
672
|
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
724
673
|
name: "updated_at";
|
|
725
|
-
tableName: "
|
|
674
|
+
tableName: "_bunderstack_messages";
|
|
726
675
|
dataType: "number";
|
|
727
676
|
columnType: "PgBigInt53";
|
|
728
677
|
data: number;
|
|
@@ -740,13 +689,13 @@ export declare const bunderstackEmailsPg: import("drizzle-orm/pg-core").PgTableW
|
|
|
740
689
|
};
|
|
741
690
|
dialect: "pg";
|
|
742
691
|
}>;
|
|
743
|
-
export declare const
|
|
744
|
-
name: "
|
|
692
|
+
export declare const bunderstackMessageEventsPg: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
693
|
+
name: "_bunderstack_message_events";
|
|
745
694
|
schema: undefined;
|
|
746
695
|
columns: {
|
|
747
696
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
748
697
|
name: "id";
|
|
749
|
-
tableName: "
|
|
698
|
+
tableName: "_bunderstack_message_events";
|
|
750
699
|
dataType: "string";
|
|
751
700
|
columnType: "PgText";
|
|
752
701
|
data: string;
|
|
@@ -761,9 +710,9 @@ export declare const bunderstackEmailEventsPg: import("drizzle-orm/pg-core").PgT
|
|
|
761
710
|
identity: undefined;
|
|
762
711
|
generated: undefined;
|
|
763
712
|
}, {}, {}>;
|
|
764
|
-
|
|
765
|
-
name: "
|
|
766
|
-
tableName: "
|
|
713
|
+
messageId: import("drizzle-orm/pg-core").PgColumn<{
|
|
714
|
+
name: "message_id";
|
|
715
|
+
tableName: "_bunderstack_message_events";
|
|
767
716
|
dataType: "string";
|
|
768
717
|
columnType: "PgText";
|
|
769
718
|
data: string;
|
|
@@ -780,7 +729,7 @@ export declare const bunderstackEmailEventsPg: import("drizzle-orm/pg-core").PgT
|
|
|
780
729
|
}, {}, {}>;
|
|
781
730
|
externalId: import("drizzle-orm/pg-core").PgColumn<{
|
|
782
731
|
name: "external_id";
|
|
783
|
-
tableName: "
|
|
732
|
+
tableName: "_bunderstack_message_events";
|
|
784
733
|
dataType: "string";
|
|
785
734
|
columnType: "PgText";
|
|
786
735
|
data: string;
|
|
@@ -797,7 +746,7 @@ export declare const bunderstackEmailEventsPg: import("drizzle-orm/pg-core").PgT
|
|
|
797
746
|
}, {}, {}>;
|
|
798
747
|
type: import("drizzle-orm/pg-core").PgColumn<{
|
|
799
748
|
name: "type";
|
|
800
|
-
tableName: "
|
|
749
|
+
tableName: "_bunderstack_message_events";
|
|
801
750
|
dataType: "string";
|
|
802
751
|
columnType: "PgText";
|
|
803
752
|
data: string;
|
|
@@ -814,7 +763,7 @@ export declare const bunderstackEmailEventsPg: import("drizzle-orm/pg-core").PgT
|
|
|
814
763
|
}, {}, {}>;
|
|
815
764
|
detailJson: import("drizzle-orm/pg-core").PgColumn<{
|
|
816
765
|
name: "detail_json";
|
|
817
|
-
tableName: "
|
|
766
|
+
tableName: "_bunderstack_message_events";
|
|
818
767
|
dataType: "string";
|
|
819
768
|
columnType: "PgText";
|
|
820
769
|
data: string;
|
|
@@ -831,7 +780,7 @@ export declare const bunderstackEmailEventsPg: import("drizzle-orm/pg-core").PgT
|
|
|
831
780
|
}, {}, {}>;
|
|
832
781
|
occurredAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
833
782
|
name: "occurred_at";
|
|
834
|
-
tableName: "
|
|
783
|
+
tableName: "_bunderstack_message_events";
|
|
835
784
|
dataType: "number";
|
|
836
785
|
columnType: "PgBigInt53";
|
|
837
786
|
data: number;
|
|
@@ -848,7 +797,7 @@ export declare const bunderstackEmailEventsPg: import("drizzle-orm/pg-core").PgT
|
|
|
848
797
|
}, {}, {}>;
|
|
849
798
|
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
850
799
|
name: "created_at";
|
|
851
|
-
tableName: "
|
|
800
|
+
tableName: "_bunderstack_message_events";
|
|
852
801
|
dataType: "number";
|
|
853
802
|
columnType: "PgBigInt53";
|
|
854
803
|
data: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-tables-pg.d.ts","sourceRoot":"","sources":["../src/internal-tables-pg.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBjC,CAAA;AAED,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBtC,CAAA"}
|
|
@@ -41,41 +41,39 @@ export const bunderstackJobsPg = pgTable('_bunderstack_jobs', {
|
|
|
41
41
|
}, (t) => [
|
|
42
42
|
index('bjq_claim').on(t.status, t.runAt),
|
|
43
43
|
index('bjq_type_status').on(t.type, t.status),
|
|
44
|
+
index('bjq_type_run_at').on(t.type, t.runAt),
|
|
44
45
|
uniqueIndex('bjq_dedupe').on(t.type, t.dedupeKey),
|
|
45
46
|
]);
|
|
46
|
-
export const
|
|
47
|
+
export const bunderstackMessagesPg = pgTable('_bunderstack_messages', {
|
|
47
48
|
id: text('id').primaryKey(),
|
|
49
|
+
channel: text('channel').notNull(),
|
|
50
|
+
kind: text('kind').notNull(),
|
|
48
51
|
provider: text('provider').notNull(),
|
|
52
|
+
credentialSource: text('credential_source').notNull(),
|
|
49
53
|
providerId: text('provider_id'),
|
|
50
54
|
status: text('status').notNull(),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
ccJson: text('cc_json').notNull(),
|
|
54
|
-
bccJson: text('bcc_json').notNull(),
|
|
55
|
-
replyTo: text('reply_to'),
|
|
56
|
-
subject: text('subject').notNull(),
|
|
57
|
-
html: text('html'),
|
|
58
|
-
text: text('text'),
|
|
55
|
+
recipientsJson: text('recipients_json').notNull(),
|
|
56
|
+
contentJson: text('content_json').notNull(),
|
|
59
57
|
error: text('error'),
|
|
60
58
|
createdAt: bigint('created_at', { mode: 'number' }).notNull(),
|
|
61
59
|
updatedAt: bigint('updated_at', { mode: 'number' }).notNull(),
|
|
62
60
|
}, (t) => [
|
|
63
|
-
index('
|
|
64
|
-
index('
|
|
65
|
-
uniqueIndex('
|
|
61
|
+
index('bmsg_created').on(t.createdAt),
|
|
62
|
+
index('bmsg_channel_status').on(t.channel, t.status, t.createdAt),
|
|
63
|
+
uniqueIndex('bmsg_provider_id').on(t.provider, t.providerId),
|
|
66
64
|
]);
|
|
67
|
-
export const
|
|
65
|
+
export const bunderstackMessageEventsPg = pgTable('_bunderstack_message_events', {
|
|
68
66
|
id: text('id').primaryKey(),
|
|
69
|
-
|
|
67
|
+
messageId: text('message_id')
|
|
70
68
|
.notNull()
|
|
71
|
-
.references(() =>
|
|
69
|
+
.references(() => bunderstackMessagesPg.id, { onDelete: 'cascade' }),
|
|
72
70
|
externalId: text('external_id').notNull(),
|
|
73
71
|
type: text('type').notNull(),
|
|
74
72
|
detailJson: text('detail_json'),
|
|
75
73
|
occurredAt: bigint('occurred_at', { mode: 'number' }).notNull(),
|
|
76
74
|
createdAt: bigint('created_at', { mode: 'number' }).notNull(),
|
|
77
75
|
}, (t) => [
|
|
78
|
-
uniqueIndex('
|
|
79
|
-
index('
|
|
76
|
+
uniqueIndex('bmev_external').on(t.externalId),
|
|
77
|
+
index('bmev_message_time').on(t.messageId, t.occurredAt),
|
|
80
78
|
]);
|
|
81
79
|
//# sourceMappingURL=internal-tables-pg.js.map
|