@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.
- package/package.json +5 -1
- package/.versionrc.json +0 -7
- package/__mocks__/uuid.js +0 -8
- package/jest.config.js +0 -24
- package/src/apiKeys/ApiKey.test.ts +0 -142
- package/src/apiKeys/ApiKey.ts +0 -102
- package/src/apiKeys/crypto.test.ts +0 -161
- package/src/apiKeys/crypto.ts +0 -163
- package/src/apiKeys/index.test.ts +0 -72
- package/src/apiKeys/index.ts +0 -35
- package/src/apiKeys/middleware.test.ts +0 -651
- package/src/apiKeys/middleware.ts +0 -341
- package/src/apiKeys/service.test.ts +0 -401
- package/src/apiKeys/service.ts +0 -168
- package/src/apiKeys/types.test.ts +0 -41
- package/src/apiKeys/types.ts +0 -124
- package/src/app/createBaseApp.test.ts +0 -109
- package/src/app/createBaseApp.ts +0 -102
- package/src/app/shutdown.test.ts +0 -129
- package/src/app/shutdown.ts +0 -81
- package/src/audit/AuditEvent.ts +0 -123
- package/src/audit/actor.test.ts +0 -95
- package/src/audit/actor.ts +0 -68
- package/src/audit/context.test.ts +0 -91
- package/src/audit/context.ts +0 -83
- package/src/audit/index.ts +0 -11
- package/src/audit/plugin.test.ts +0 -258
- package/src/audit/plugin.ts +0 -254
- package/src/audit/reads.test.ts +0 -164
- package/src/audit/reads.ts +0 -88
- package/src/audit/service.test.ts +0 -115
- package/src/audit/service.ts +0 -95
- package/src/auth/session.test.ts +0 -89
- package/src/auth/session.ts +0 -75
- package/src/config/env.test.ts +0 -28
- package/src/config/env.ts +0 -13
- package/src/database/connection.test.ts +0 -188
- package/src/database/connection.ts +0 -90
- package/src/entitlements/UsageMeter.ts +0 -49
- package/src/entitlements/client.test.ts +0 -200
- package/src/entitlements/client.ts +0 -179
- package/src/entitlements/definitions.test.ts +0 -161
- package/src/entitlements/definitions.ts +0 -268
- package/src/entitlements/index.ts +0 -42
- package/src/entitlements/middleware.test.ts +0 -196
- package/src/entitlements/middleware.ts +0 -150
- package/src/entitlements/reconcile.test.ts +0 -333
- package/src/entitlements/reconcile.ts +0 -384
- package/src/entitlements/types.ts +0 -21
- package/src/entitlements/usage.test.ts +0 -314
- package/src/entitlements/usage.ts +0 -223
- package/src/errors/HttpError.test.ts +0 -76
- package/src/errors/HttpError.ts +0 -91
- package/src/groups/client.test.ts +0 -215
- package/src/groups/client.ts +0 -182
- package/src/groups/index.ts +0 -7
- package/src/groups/membership.test.ts +0 -84
- package/src/groups/membership.ts +0 -133
- package/src/groups/subject.test.ts +0 -85
- package/src/groups/subject.ts +0 -50
- package/src/health/createHealthCheck.test.ts +0 -89
- package/src/health/createHealthCheck.ts +0 -67
- package/src/health/healthController.test.ts +0 -113
- package/src/health/healthController.ts +0 -56
- package/src/index.ts +0 -88
- package/src/logging/logger.test.ts +0 -91
- package/src/logging/logger.ts +0 -103
- package/src/metrics/index.test.ts +0 -116
- package/src/metrics/index.ts +0 -111
- package/src/middleware/authMiddleware.test.ts +0 -275
- package/src/middleware/authMiddleware.ts +0 -91
- package/src/middleware/corsMiddleware.test.ts +0 -135
- package/src/middleware/corsMiddleware.ts +0 -65
- package/src/middleware/errorHandler.test.ts +0 -188
- package/src/middleware/errorHandler.ts +0 -103
- package/src/middleware/internalServiceAuth.test.ts +0 -173
- package/src/middleware/internalServiceAuth.ts +0 -96
- package/src/middleware/requestLogger.test.ts +0 -81
- package/src/middleware/requestLogger.ts +0 -48
- package/src/middleware/security.test.ts +0 -45
- package/src/middleware/security.ts +0 -43
- package/src/middleware/validate.test.ts +0 -72
- package/src/middleware/validate.ts +0 -23
- package/src/oauth/index.ts +0 -29
- package/src/oauth/models.ts +0 -164
- package/src/oauth/service.test.ts +0 -432
- package/src/oauth/service.ts +0 -299
- package/src/oauth/tokens.test.ts +0 -146
- package/src/oauth/tokens.ts +0 -186
- package/src/testing/serviceTestSetup.ts +0 -17
- package/src/tracing/index.test.ts +0 -272
- package/src/tracing/index.ts +0 -110
- package/src/types/auth.ts +0 -45
- package/src/utils/correlation.test.ts +0 -47
- package/src/utils/correlation.ts +0 -22
- package/src/utils/permissionUtils.test.ts +0 -47
- package/src/utils/permissionUtils.ts +0 -68
- package/src/utils/response.test.ts +0 -64
- package/src/utils/response.ts +0 -60
- package/tsconfig.build.json +0 -7
- 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
|
-
});
|
package/src/apiKeys/index.ts
DELETED
|
@@ -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';
|