@backstage/backend-defaults 0.5.0-next.0 → 0.5.0-next.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 CHANGED
@@ -1,5 +1,47 @@
1
1
  # @backstage/backend-defaults
2
2
 
3
+ ## 0.5.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - a4bac3c: **BREAKING**: You can no longer supply a `basePath` option to the host discovery implementation. In the new backend system, the ability to choose this path has been removed anyway at the plugin router level.
8
+ - 055b75b: **BREAKING**: Simplifications and cleanup as part of the Backend System 1.0 work.
9
+
10
+ For the `/database` subpath exports:
11
+
12
+ - The deprecated `dropDatabase` function has now been removed, without replacement.
13
+ - The deprecated `LegacyRootDatabaseService` type has now been removed.
14
+ - The return type from `DatabaseManager.forPlugin` is now directly a `DatabaseService`, as arguably expected.
15
+ - `DatabaseManager.forPlugin` now requires the `deps` argument, with the logger and lifecycle services.
16
+
17
+ For the `/cache` subpath exports:
18
+
19
+ - The `PluginCacheManager` type has been removed. You can still import it from `@backstage/backend-common`, but it's deprecated there, and you should move off of that package by migrating fully to the new backend system.
20
+ - Accordingly, `CacheManager.forPlugin` immediately returns a `CacheService` instead of a `PluginCacheManager`. The outcome of this is that you no longer need to make the extra `.getClient()` call. The old `CacheManager` with the old behavior still exists on `@backstage/backend-common`, but the above recommendations apply.
21
+
22
+ ### Patch Changes
23
+
24
+ - 622360e: Move down the discovery config to be in the root
25
+ - fe6fd8c: Accept `ConfigService` instead of `Config` in constructors/factories
26
+ - 5705424: Wrap scheduled tasks from the scheduler core service now in OpenTelemetry spans
27
+ - b2a329d: Properly indent the config schema
28
+ - Updated dependencies
29
+ - @backstage/backend-common@0.25.0-next.1
30
+ - @backstage/plugin-auth-node@0.5.2-next.1
31
+ - @backstage/backend-app-api@0.10.0-next.1
32
+ - @backstage/backend-dev-utils@0.1.5
33
+ - @backstage/backend-plugin-api@0.9.0-next.1
34
+ - @backstage/cli-common@0.1.14
35
+ - @backstage/cli-node@0.2.7
36
+ - @backstage/config@1.2.0
37
+ - @backstage/config-loader@1.9.0
38
+ - @backstage/errors@1.2.4
39
+ - @backstage/integration@1.14.0
40
+ - @backstage/integration-aws-node@0.1.12
41
+ - @backstage/types@1.1.1
42
+ - @backstage/plugin-events-node@0.4.0-next.1
43
+ - @backstage/plugin-permission-node@0.8.3-next.1
44
+
3
45
  ## 0.5.0-next.0
4
46
 
5
47
  ### Minor Changes
package/auth/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults__auth",
3
- "version": "0.5.0-next.0",
3
+ "version": "0.5.0-next.1",
4
4
  "main": "../dist/auth.cjs.js",
5
5
  "types": "../dist/auth.d.ts"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults__cache",
3
- "version": "0.5.0-next.0",
3
+ "version": "0.5.0-next.1",
4
4
  "main": "../dist/cache.cjs.js",
5
5
  "types": "../dist/cache.d.ts"
6
6
  }
package/config.d.ts CHANGED
@@ -373,205 +373,205 @@ export interface Config {
373
373
  }
374
374
  >;
375
375
  };
376
- };
377
376
 
378
- /**
379
- * Options used by the default discovery service.
380
- */
381
- discovery?: {
382
- /**
383
- * A list of target baseUrls and the associated plugins.
384
- */
385
- endpoints: Array<{
377
+ /** Database connection configuration, select base database type using the `client` field */
378
+ database: {
379
+ /** Default database client to use */
380
+ client: 'better-sqlite3' | 'sqlite3' | 'pg';
386
381
  /**
387
- * The target base URL to use for the plugin.
382
+ * Base database connection string, or object with individual connection properties
383
+ * @visibility secret
384
+ */
385
+ connection:
386
+ | string
387
+ | {
388
+ /**
389
+ * Password that belongs to the client User
390
+ * @visibility secret
391
+ */
392
+ password?: string;
393
+ /**
394
+ * Other connection settings
395
+ */
396
+ [key: string]: unknown;
397
+ };
398
+ /** Database name prefix override */
399
+ prefix?: string;
400
+ /**
401
+ * Whether to ensure the given database exists by creating it if it does not.
402
+ * Defaults to true if unspecified.
403
+ */
404
+ ensureExists?: boolean;
405
+ /**
406
+ * Whether to ensure the given database schema exists by creating it if it does not.
407
+ * Defaults to false if unspecified.
388
408
  *
389
- * Can be either a string or an object with internal and external keys.
390
- * Targets with `{{pluginId}}` or `{{ pluginId }} in the URL will be replaced with the plugin ID.
409
+ * NOTE: Currently only supported by the `pg` client when pluginDivisionMode: schema
391
410
  */
392
- target: string | { internal: string; external: string };
411
+ ensureSchemaExists?: boolean;
393
412
  /**
394
- * Array of plugins which use the target base URL.
413
+ * How plugins databases are managed/divided in the provided database instance.
414
+ *
415
+ * `database` -> Plugins are each given their own database to manage their schemas/tables.
416
+ *
417
+ * `schema` -> Plugins will be given their own schema (in the specified/default database)
418
+ * to manage their tables.
419
+ *
420
+ * NOTE: Currently only supported by the `pg` client.
421
+ *
422
+ * @default database
395
423
  */
396
- plugins: string[];
397
- }>;
398
- };
424
+ pluginDivisionMode?: 'database' | 'schema';
425
+ /** Configures the ownership of newly created schemas in pg databases. */
426
+ role?: string;
427
+ /**
428
+ * Arbitrary config object to pass to knex when initializing
429
+ * (https://knexjs.org/#Installation-client). Most notable is the debug
430
+ * and asyncStackTraces booleans
431
+ */
432
+ knexConfig?: object;
433
+ /** Skip running database migrations. */
434
+ skipMigrations?: boolean;
435
+ /** Plugin specific database configuration and client override */
436
+ plugin?: {
437
+ [pluginId: string]: {
438
+ /** Database client override */
439
+ client?: 'better-sqlite3' | 'sqlite3' | 'pg';
440
+ /**
441
+ * Database connection string or Knex object override
442
+ * @visibility secret
443
+ */
444
+ connection?: string | object;
445
+ /**
446
+ * Whether to ensure the given database exists by creating it if it does not.
447
+ * Defaults to base config if unspecified.
448
+ */
449
+ ensureExists?: boolean;
450
+ /**
451
+ * Whether to ensure the given database schema exists by creating it if it does not.
452
+ * Defaults to false if unspecified.
453
+ *
454
+ * NOTE: Currently only supported by the `pg` client when pluginDivisionMode: schema
455
+ */
456
+ ensureSchemaExists?: boolean;
457
+ /**
458
+ * Arbitrary config object to pass to knex when initializing
459
+ * (https://knexjs.org/#Installation-client). Most notable is the
460
+ * debug and asyncStackTraces booleans.
461
+ *
462
+ * This is merged recursively into the base knexConfig
463
+ */
464
+ knexConfig?: object;
465
+ /** Configures the ownership of newly created schemas in pg databases. */
466
+ role?: string;
467
+ /** Skip running database migrations. */
468
+ skipMigrations?: boolean;
469
+ };
470
+ };
471
+ };
399
472
 
400
- /** Database connection configuration, select base database type using the `client` field */
401
- database: {
402
- /** Default database client to use */
403
- client: 'better-sqlite3' | 'sqlite3' | 'pg';
404
- /**
405
- * Base database connection string, or object with individual connection properties
406
- * @visibility secret
407
- */
408
- connection:
409
- | string
473
+ /** Cache connection configuration, select cache type using the `store` field */
474
+ cache?:
475
+ | {
476
+ store: 'memory';
477
+ /** An optional default TTL (in milliseconds). */
478
+ defaultTtl?: number | HumanDuration;
479
+ }
410
480
  | {
481
+ store: 'redis';
411
482
  /**
412
- * Password that belongs to the client User
483
+ * A redis connection string in the form `redis://user:pass@host:port`.
413
484
  * @visibility secret
414
485
  */
415
- password?: string;
486
+ connection: string;
487
+ /** An optional default TTL (in milliseconds). */
488
+ defaultTtl?: number | HumanDuration;
416
489
  /**
417
- * Other connection settings
490
+ * Whether or not [useRedisSets](https://github.com/jaredwray/keyv/tree/main/packages/redis#useredissets) should be configured to this redis cache.
491
+ * Defaults to true if unspecified.
418
492
  */
419
- [key: string]: unknown;
493
+ useRedisSets?: boolean;
494
+ }
495
+ | {
496
+ store: 'memcache';
497
+ /**
498
+ * A memcache connection string in the form `user:pass@host:port`.
499
+ * @visibility secret
500
+ */
501
+ connection: string;
502
+ /** An optional default TTL (in milliseconds). */
503
+ defaultTtl?: number | HumanDuration;
420
504
  };
421
- /** Database name prefix override */
422
- prefix?: string;
423
- /**
424
- * Whether to ensure the given database exists by creating it if it does not.
425
- * Defaults to true if unspecified.
426
- */
427
- ensureExists?: boolean;
505
+
506
+ cors?: {
507
+ origin?: string | string[];
508
+ methods?: string | string[];
509
+ allowedHeaders?: string | string[];
510
+ exposedHeaders?: string | string[];
511
+ credentials?: boolean;
512
+ maxAge?: number;
513
+ preflightContinue?: boolean;
514
+ optionsSuccessStatus?: number;
515
+ };
516
+
428
517
  /**
429
- * Whether to ensure the given database schema exists by creating it if it does not.
430
- * Defaults to false if unspecified.
518
+ * Content Security Policy options.
431
519
  *
432
- * NOTE: Currently only supported by the `pg` client when pluginDivisionMode: schema
520
+ * The keys are the plain policy ID, e.g. "upgrade-insecure-requests". The
521
+ * values are on the format that the helmet library expects them, as an
522
+ * array of strings. There is also the special value false, which means to
523
+ * remove the default value that Backstage puts in place for that policy.
433
524
  */
434
- ensureSchemaExists?: boolean;
435
- /**
436
- * How plugins databases are managed/divided in the provided database instance.
437
- *
438
- * `database` -> Plugins are each given their own database to manage their schemas/tables.
439
- *
440
- * `schema` -> Plugins will be given their own schema (in the specified/default database)
441
- * to manage their tables.
442
- *
443
- * NOTE: Currently only supported by the `pg` client.
444
- *
445
- * @default database
446
- */
447
- pluginDivisionMode?: 'database' | 'schema';
448
- /** Configures the ownership of newly created schemas in pg databases. */
449
- role?: string;
525
+ csp?: { [policyId: string]: string[] | false };
526
+
450
527
  /**
451
- * Arbitrary config object to pass to knex when initializing
452
- * (https://knexjs.org/#Installation-client). Most notable is the debug
453
- * and asyncStackTraces booleans
528
+ * Configuration related to URL reading, used for example for reading catalog info
529
+ * files, scaffolder templates, and techdocs content.
454
530
  */
455
- knexConfig?: object;
456
- /** Skip running database migrations. */
457
- skipMigrations?: boolean;
458
- /** Plugin specific database configuration and client override */
459
- plugin?: {
460
- [pluginId: string]: {
461
- /** Database client override */
462
- client?: 'better-sqlite3' | 'sqlite3' | 'pg';
463
- /**
464
- * Database connection string or Knex object override
465
- * @visibility secret
466
- */
467
- connection?: string | object;
468
- /**
469
- * Whether to ensure the given database exists by creating it if it does not.
470
- * Defaults to base config if unspecified.
471
- */
472
- ensureExists?: boolean;
473
- /**
474
- * Whether to ensure the given database schema exists by creating it if it does not.
475
- * Defaults to false if unspecified.
476
- *
477
- * NOTE: Currently only supported by the `pg` client when pluginDivisionMode: schema
478
- */
479
- ensureSchemaExists?: boolean;
531
+ reading?: {
532
+ /**
533
+ * A list of targets to allow outgoing requests to. Users will be able to make
534
+ * requests on behalf of the backend to the targets that are allowed by this list.
535
+ */
536
+ allow?: Array<{
480
537
  /**
481
- * Arbitrary config object to pass to knex when initializing
482
- * (https://knexjs.org/#Installation-client). Most notable is the
483
- * debug and asyncStackTraces booleans.
484
- *
485
- * This is merged recursively into the base knexConfig
538
+ * A host to allow outgoing requests to, being either a full host or
539
+ * a subdomain wildcard pattern with a leading `*`. For example `example.com`
540
+ * and `*.example.com` are valid values, `prod.*.example.com` is not.
541
+ * The host may also contain a port, for example `example.com:8080`.
486
542
  */
487
- knexConfig?: object;
488
- /** Configures the ownership of newly created schemas in pg databases. */
489
- role?: string;
490
- /** Skip running database migrations. */
491
- skipMigrations?: boolean;
492
- };
493
- };
494
- };
543
+ host: string;
495
544
 
496
- /** Cache connection configuration, select cache type using the `store` field */
497
- cache?:
498
- | {
499
- store: 'memory';
500
- /** An optional default TTL (in milliseconds). */
501
- defaultTtl?: number | HumanDuration;
502
- }
503
- | {
504
- store: 'redis';
505
- /**
506
- * A redis connection string in the form `redis://user:pass@host:port`.
507
- * @visibility secret
508
- */
509
- connection: string;
510
- /** An optional default TTL (in milliseconds). */
511
- defaultTtl?: number | HumanDuration;
512
- /**
513
- * Whether or not [useRedisSets](https://github.com/jaredwray/keyv/tree/main/packages/redis#useredissets) should be configured to this redis cache.
514
- * Defaults to true if unspecified.
515
- */
516
- useRedisSets?: boolean;
517
- }
518
- | {
519
- store: 'memcache';
520
545
  /**
521
- * A memcache connection string in the form `user:pass@host:port`.
522
- * @visibility secret
546
+ * An optional list of paths. In case they are present only targets matching
547
+ * any of them will are allowed. You can use trailing slashes to make sure only
548
+ * subdirectories are allowed, for example `/mydir/` will allow targets with
549
+ * paths like `/mydir/a` but will block paths like `/mydir2`.
523
550
  */
524
- connection: string;
525
- /** An optional default TTL (in milliseconds). */
526
- defaultTtl?: number | HumanDuration;
527
- };
528
-
529
- cors?: {
530
- origin?: string | string[];
531
- methods?: string | string[];
532
- allowedHeaders?: string | string[];
533
- exposedHeaders?: string | string[];
534
- credentials?: boolean;
535
- maxAge?: number;
536
- preflightContinue?: boolean;
537
- optionsSuccessStatus?: number;
551
+ paths?: string[];
552
+ }>;
553
+ };
538
554
  };
539
555
 
540
556
  /**
541
- * Content Security Policy options.
542
- *
543
- * The keys are the plain policy ID, e.g. "upgrade-insecure-requests". The
544
- * values are on the format that the helmet library expects them, as an
545
- * array of strings. There is also the special value false, which means to
546
- * remove the default value that Backstage puts in place for that policy.
547
- */
548
- csp?: { [policyId: string]: string[] | false };
549
-
550
- /**
551
- * Configuration related to URL reading, used for example for reading catalog info
552
- * files, scaffolder templates, and techdocs content.
557
+ * Options used by the default discovery service.
553
558
  */
554
- reading?: {
559
+ discovery?: {
555
560
  /**
556
- * A list of targets to allow outgoing requests to. Users will be able to make
557
- * requests on behalf of the backend to the targets that are allowed by this list.
561
+ * A list of target baseUrls and the associated plugins.
558
562
  */
559
- allow?: Array<{
563
+ endpoints: Array<{
560
564
  /**
561
- * A host to allow outgoing requests to, being either a full host or
562
- * a subdomain wildcard pattern with a leading `*`. For example `example.com`
563
- * and `*.example.com` are valid values, `prod.*.example.com` is not.
564
- * The host may also contain a port, for example `example.com:8080`.
565
+ * The target base URL to use for the plugin.
566
+ *
567
+ * Can be either a string or an object with internal and external keys.
568
+ * Targets with `{{pluginId}}` or `{{ pluginId }} in the URL will be replaced with the plugin ID.
565
569
  */
566
- host: string;
567
-
570
+ target: string | { internal: string; external: string };
568
571
  /**
569
- * An optional list of paths. In case they are present only targets matching
570
- * any of them will are allowed. You can use trailing slashes to make sure only
571
- * subdirectories are allowed, for example `/mydir/` will allow targets with
572
- * paths like `/mydir/a` but will block paths like `/mydir2`.
572
+ * Array of plugins which use the target base URL.
573
573
  */
574
- paths?: string[];
574
+ plugins: string[];
575
575
  }>;
576
576
  };
577
577
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults__database",
3
- "version": "0.5.0-next.0",
3
+ "version": "0.5.0-next.1",
4
4
  "main": "../dist/database.cjs.js",
5
5
  "types": "../dist/database.d.ts"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults__discovery",
3
- "version": "0.5.0-next.0",
3
+ "version": "0.5.0-next.1",
4
4
  "main": "../dist/discovery.cjs.js",
5
5
  "types": "../dist/discovery.d.ts"
6
6
  }
package/dist/auth.cjs.js CHANGED
@@ -84,6 +84,7 @@ class DefaultAuthService {
84
84
  return { token: "" };
85
85
  }
86
86
  switch (type) {
87
+ // TODO: Check whether the principal is ourselves
87
88
  case "service":
88
89
  return this.pluginTokenHandler.issueToken({
89
90
  pluginId: this.pluginId,