@tumbaland/backend-core 1.43.0 → 1.45.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.
Files changed (101) hide show
  1. package/package.json +5 -1
  2. package/.versionrc.json +0 -7
  3. package/__mocks__/uuid.js +0 -8
  4. package/jest.config.js +0 -24
  5. package/src/apiKeys/ApiKey.test.ts +0 -142
  6. package/src/apiKeys/ApiKey.ts +0 -102
  7. package/src/apiKeys/crypto.test.ts +0 -161
  8. package/src/apiKeys/crypto.ts +0 -163
  9. package/src/apiKeys/index.test.ts +0 -72
  10. package/src/apiKeys/index.ts +0 -35
  11. package/src/apiKeys/middleware.test.ts +0 -651
  12. package/src/apiKeys/middleware.ts +0 -341
  13. package/src/apiKeys/service.test.ts +0 -401
  14. package/src/apiKeys/service.ts +0 -168
  15. package/src/apiKeys/types.test.ts +0 -41
  16. package/src/apiKeys/types.ts +0 -124
  17. package/src/app/createBaseApp.test.ts +0 -109
  18. package/src/app/createBaseApp.ts +0 -102
  19. package/src/app/shutdown.test.ts +0 -129
  20. package/src/app/shutdown.ts +0 -81
  21. package/src/audit/AuditEvent.ts +0 -123
  22. package/src/audit/actor.test.ts +0 -95
  23. package/src/audit/actor.ts +0 -68
  24. package/src/audit/context.test.ts +0 -91
  25. package/src/audit/context.ts +0 -83
  26. package/src/audit/index.ts +0 -11
  27. package/src/audit/plugin.test.ts +0 -258
  28. package/src/audit/plugin.ts +0 -254
  29. package/src/audit/reads.test.ts +0 -164
  30. package/src/audit/reads.ts +0 -88
  31. package/src/audit/service.test.ts +0 -115
  32. package/src/audit/service.ts +0 -95
  33. package/src/auth/session.test.ts +0 -89
  34. package/src/auth/session.ts +0 -75
  35. package/src/config/env.test.ts +0 -28
  36. package/src/config/env.ts +0 -13
  37. package/src/database/connection.test.ts +0 -188
  38. package/src/database/connection.ts +0 -90
  39. package/src/entitlements/UsageMeter.ts +0 -49
  40. package/src/entitlements/client.test.ts +0 -200
  41. package/src/entitlements/client.ts +0 -179
  42. package/src/entitlements/definitions.test.ts +0 -161
  43. package/src/entitlements/definitions.ts +0 -268
  44. package/src/entitlements/index.ts +0 -42
  45. package/src/entitlements/middleware.test.ts +0 -196
  46. package/src/entitlements/middleware.ts +0 -150
  47. package/src/entitlements/reconcile.test.ts +0 -333
  48. package/src/entitlements/reconcile.ts +0 -384
  49. package/src/entitlements/types.ts +0 -21
  50. package/src/entitlements/usage.test.ts +0 -314
  51. package/src/entitlements/usage.ts +0 -223
  52. package/src/errors/HttpError.test.ts +0 -76
  53. package/src/errors/HttpError.ts +0 -91
  54. package/src/groups/client.test.ts +0 -215
  55. package/src/groups/client.ts +0 -182
  56. package/src/groups/index.ts +0 -7
  57. package/src/groups/membership.test.ts +0 -84
  58. package/src/groups/membership.ts +0 -133
  59. package/src/groups/subject.test.ts +0 -85
  60. package/src/groups/subject.ts +0 -50
  61. package/src/health/createHealthCheck.test.ts +0 -89
  62. package/src/health/createHealthCheck.ts +0 -67
  63. package/src/health/healthController.test.ts +0 -113
  64. package/src/health/healthController.ts +0 -56
  65. package/src/index.ts +0 -88
  66. package/src/logging/logger.test.ts +0 -91
  67. package/src/logging/logger.ts +0 -103
  68. package/src/metrics/index.test.ts +0 -116
  69. package/src/metrics/index.ts +0 -111
  70. package/src/middleware/authMiddleware.test.ts +0 -275
  71. package/src/middleware/authMiddleware.ts +0 -91
  72. package/src/middleware/corsMiddleware.test.ts +0 -135
  73. package/src/middleware/corsMiddleware.ts +0 -65
  74. package/src/middleware/errorHandler.test.ts +0 -188
  75. package/src/middleware/errorHandler.ts +0 -103
  76. package/src/middleware/internalServiceAuth.test.ts +0 -173
  77. package/src/middleware/internalServiceAuth.ts +0 -96
  78. package/src/middleware/requestLogger.test.ts +0 -81
  79. package/src/middleware/requestLogger.ts +0 -48
  80. package/src/middleware/security.test.ts +0 -45
  81. package/src/middleware/security.ts +0 -43
  82. package/src/middleware/validate.test.ts +0 -72
  83. package/src/middleware/validate.ts +0 -23
  84. package/src/oauth/index.ts +0 -29
  85. package/src/oauth/models.ts +0 -164
  86. package/src/oauth/service.test.ts +0 -432
  87. package/src/oauth/service.ts +0 -299
  88. package/src/oauth/tokens.test.ts +0 -146
  89. package/src/oauth/tokens.ts +0 -186
  90. package/src/testing/serviceTestSetup.ts +0 -17
  91. package/src/tracing/index.test.ts +0 -272
  92. package/src/tracing/index.ts +0 -110
  93. package/src/types/auth.ts +0 -45
  94. package/src/utils/correlation.test.ts +0 -47
  95. package/src/utils/correlation.ts +0 -22
  96. package/src/utils/permissionUtils.test.ts +0 -47
  97. package/src/utils/permissionUtils.ts +0 -68
  98. package/src/utils/response.test.ts +0 -64
  99. package/src/utils/response.ts +0 -60
  100. package/tsconfig.build.json +0 -7
  101. package/tsconfig.json +0 -23
@@ -1,72 +0,0 @@
1
- import * as core from '../index';
2
- import * as apiKeys from './index';
3
-
4
- /**
5
- * The package's public surface, as the services actually consume it.
6
- *
7
- * Services install this lib from npm, so an export dropped in a refactor does
8
- * not fail here — it fails inside a Docker build as "has no exported member X",
9
- * against a registry that genuinely has the code. That is a slow and confusing
10
- * loop, and it is entirely preventable by naming the surface once.
11
- */
12
- const PUBLIC_SURFACE = [
13
- // middleware the services mount
14
- 'authenticateAgent',
15
- 'requireScope',
16
- 'denyApiKeys',
17
- // key lifecycle, used by auth-service
18
- 'createApiKey',
19
- 'listApiKeys',
20
- 'revealApiKey',
21
- 'revokeApiKey',
22
- 'deleteApiKey',
23
- 'verifyApiKey',
24
- // configuration and vocabulary
25
- 'isEncryptionConfigured',
26
- 'API_KEY_SCOPES',
27
- 'isApiKeyScope',
28
- 'ApiKey',
29
- // helpers
30
- 'looksLikeApiKey',
31
- 'displayPrefix',
32
- 'resetEncryptionKeyCache'
33
- ] as const;
34
-
35
- describe('the apiKeys barrel', () => {
36
- it.each(PUBLIC_SURFACE)('exports %s', (name) => {
37
- expect(apiKeys).toHaveProperty(name);
38
- expect((apiKeys as Record<string, unknown>)[name]).toBeDefined();
39
- });
40
- });
41
-
42
- describe('the package root', () => {
43
- it.each(PUBLIC_SURFACE)('re-exports %s, which is how services import it', (name) => {
44
- expect((core as Record<string, unknown>)[name]).toBeDefined();
45
- });
46
-
47
- it('exposes the same binding through both paths', () => {
48
- for (const name of PUBLIC_SURFACE) {
49
- expect((core as Record<string, unknown>)[name]).toBe((apiKeys as Record<string, unknown>)[name]);
50
- }
51
- });
52
-
53
- it('still exports the session middleware the key work sits alongside', () => {
54
- // `authenticateToken` stays JWT-only and is what auth-service and
55
- // payment-service rely on to refuse keys outright.
56
- expect(core.authenticateToken).toBeDefined();
57
- expect(core.optionalAuth).toBeDefined();
58
- });
59
- });
60
-
61
- describe('the scope vocabulary', () => {
62
- it('is the same list the services and the UI are written against', () => {
63
- expect([...core.API_KEY_SCOPES]).toEqual([
64
- 'relationship:read',
65
- 'relationship:write',
66
- 'album:read',
67
- 'album:write',
68
- 'finance:read',
69
- 'finance:write'
70
- ]);
71
- });
72
- });
@@ -1,35 +0,0 @@
1
- export { ApiKey } from './ApiKey';
2
- export type { IApiKey } from './ApiKey';
3
- export {
4
- createApiKey,
5
- listApiKeys,
6
- revealApiKey,
7
- revokeApiKey,
8
- deleteApiKey,
9
- verifyApiKey
10
- } from './service';
11
- export type { CreateApiKeyInput, CreatedApiKey } from './service';
12
- export { authenticateAgent, requireScope, denyApiKeys } from './middleware';
13
- export type { ApiKeyContext } from './middleware';
14
- export {
15
- API_KEY_SCOPES,
16
- isApiKeyScope,
17
- PERSONAL_TENANT,
18
- groupIdOf,
19
- groupIdsOf,
20
- readTenants
21
- } from './types';
22
- export type {
23
- ApiKeyScope,
24
- ApiKeySummary,
25
- ApiKeyVerification,
26
- ApiKeyRejection,
27
- ApiKeyTenant,
28
- Tenant
29
- } from './types';
30
- export {
31
- looksLikeApiKey,
32
- displayPrefix,
33
- isEncryptionConfigured,
34
- resetEncryptionKeyCache
35
- } from './crypto';