@fabrika/auth-core 0.4.7 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/auth-core",
3
- "version": "0.4.7",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
package/src/contract.ts CHANGED
@@ -434,8 +434,17 @@ export interface DeclaredReach {
434
434
  readonly unscoped: Readonly<Record<string, 'read' | 'write'>>
435
435
  readonly connect: readonly string[]
436
436
  readonly issues: string | null
437
+ /** The cron job this mutation kicks after its commit; absent unless declared, so the digest stays. */
438
+ readonly then?: string
439
+ /** The mail transport this job reaches: the installation's or its own; absent unless declared. */
440
+ readonly mailer?: JobMailer
437
441
  }
438
442
 
443
+ /** The mail transports a job may declare: the installation's default, or the application's own. */
444
+ export const JOB_MAILERS = ['installation', 'own'] as const
445
+
446
+ export type JobMailer = (typeof JOB_MAILERS)[number]
447
+
439
448
  export interface CspExtensions {
440
449
  readonly connectSrc: readonly CspSource[]
441
450
  readonly imgSrc: readonly CspSource[]
@@ -25,6 +25,7 @@ export const FRAMEWORK_VARIABLE_NAMES = [
25
25
  'FABRIKA_SERVICE_KEY',
26
26
  'FABRIKA_APP_DATABASE_URL',
27
27
  'FABRIKA_APP_RUNTIME_DATABASE_URL',
28
+ 'FABRIKA_APP_DATABASE_CONNECTIONS',
28
29
  'FABRIKA_APP_STORAGE_ENDPOINT',
29
30
  'FABRIKA_APP_STORAGE_BUCKET',
30
31
  'FABRIKA_APP_STORAGE_ACCESS_KEY_ID',
@@ -41,9 +42,10 @@ export type FrameworkVariableName = (typeof FRAMEWORK_VARIABLE_NAMES)[number]
41
42
 
42
43
  /**
43
44
  * The name families only the platform writes: one variable per job or webhook, named after it (`workloadKeyVariable`),
44
- * and a connector import's address, key and Worker binding (`connectVariables`). Every name under one is framework-only.
45
+ * a connector import's address, key and Worker binding (`connectVariables`), and the installation's mail transport
46
+ * (`isEmailTransportVariable`). Every name under one is framework-only.
45
47
  */
46
- export const FRAMEWORK_VARIABLE_PREFIXES = ['FABRIKA_JOB_', 'FABRIKA_WEBHOOK_', 'FABRIKA_CONNECT_'] as const
48
+ export const FRAMEWORK_VARIABLE_PREFIXES = ['FABRIKA_JOB_', 'FABRIKA_WEBHOOK_', 'FABRIKA_CONNECT_', 'FABRIKA_EMAIL_'] as const
47
49
 
48
50
  const FRAMEWORK_VARIABLES: ReadonlySet<string> = new Set(FRAMEWORK_VARIABLE_NAMES)
49
51
 
@@ -98,6 +100,13 @@ export function isConnectUrlVariable(name: string): boolean {
98
100
  return CONNECT_URL_VARIABLE.test(name)
99
101
  }
100
102
 
103
+ const EMAIL_VARIABLE = /^FABRIKA_EMAIL_[A-Z0-9][A-Z0-9_]*$/
104
+
105
+ /** Whether `name` belongs to the installation's mail transport, which only Control hands an application. */
106
+ export function isEmailTransportVariable(name: string): boolean {
107
+ return EMAIL_VARIABLE.test(name)
108
+ }
109
+
101
110
  /** A Zerops reference: `${NAME}`, `${RUNTIME_NAME}`, `${<host>_NAME}` or `${RUNTIME_<host>_NAME}`. */
102
111
  const REFERENCE = /\$\{([^}]*)\}?/g
103
112
  const RUNTIME_PREFIX = /^RUNTIME_/