@selvajs/platform 0.14.2 → 0.15.0-beta.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/LICENSE +1 -1
- package/dist/auth.d.ts +60 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +12 -0
- package/dist/auth.js.map +1 -0
- package/dist/compute.d.ts +47 -0
- package/dist/compute.d.ts.map +1 -0
- package/dist/compute.js +11 -0
- package/dist/compute.js.map +1 -0
- package/dist/computeServer/index.d.ts +2 -0
- package/dist/computeServer/index.d.ts.map +1 -1
- package/dist/computeServer/index.js +6 -0
- package/dist/computeServer/index.js.map +1 -1
- package/dist/computeServer/interface.d.ts +10 -0
- package/dist/computeServer/interface.d.ts.map +1 -1
- package/dist/computeServer/secrets.d.ts +53 -0
- package/dist/computeServer/secrets.d.ts.map +1 -0
- package/dist/computeServer/secrets.js +67 -0
- package/dist/computeServer/secrets.js.map +1 -0
- package/dist/context.d.ts +7 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +13 -0
- package/dist/context.js.map +1 -1
- package/dist/data/interface.d.ts +33 -0
- package/dist/data/interface.d.ts.map +1 -1
- package/dist/definitions/interface.d.ts +18 -0
- package/dist/definitions/interface.d.ts.map +1 -1
- package/dist/definitions/schemas.d.ts +1 -0
- package/dist/definitions/schemas.d.ts.map +1 -1
- package/dist/definitions/schemas.js +3 -0
- package/dist/definitions/schemas.js.map +1 -1
- package/dist/definitions/service.d.ts +62 -0
- package/dist/definitions/service.d.ts.map +1 -0
- package/dist/definitions/service.js +149 -0
- package/dist/definitions/service.js.map +1 -0
- package/dist/definitions/types.d.ts +24 -1
- package/dist/definitions/types.d.ts.map +1 -1
- package/dist/definitions.d.ts +146 -0
- package/dist/definitions.d.ts.map +1 -0
- package/dist/definitions.js +23 -0
- package/dist/definitions.js.map +1 -0
- package/dist/errors/interface.d.ts +44 -0
- package/dist/errors/interface.d.ts.map +1 -0
- package/dist/errors/interface.js +9 -0
- package/dist/errors/interface.js.map +1 -0
- package/dist/events/interface.d.ts +23 -0
- package/dist/events/interface.d.ts.map +1 -1
- package/dist/events/interface.js.map +1 -1
- package/dist/index.d.ts +14 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/invites/schemas.d.ts +24 -0
- package/dist/invites/schemas.d.ts.map +1 -0
- package/dist/invites/schemas.js +17 -0
- package/dist/invites/schemas.js.map +1 -0
- package/dist/metrics/interface.d.ts +6 -0
- package/dist/metrics/interface.d.ts.map +1 -1
- package/dist/metrics/interface.js.map +1 -1
- package/dist/organizations/index.d.ts +4 -3
- package/dist/organizations/index.d.ts.map +1 -1
- package/dist/organizations/index.js +2 -1
- package/dist/organizations/index.js.map +1 -1
- package/dist/organizations/interface.d.ts +1 -1
- package/dist/organizations/interface.d.ts.map +1 -1
- package/dist/organizations/paths.d.ts +22 -0
- package/dist/organizations/paths.d.ts.map +1 -0
- package/dist/organizations/paths.js +43 -0
- package/dist/organizations/paths.js.map +1 -0
- package/dist/organizations/schemas.d.ts +10 -0
- package/dist/organizations/schemas.d.ts.map +1 -1
- package/dist/organizations/schemas.js +6 -0
- package/dist/organizations/schemas.js.map +1 -1
- package/dist/organizations/types.d.ts +10 -1
- package/dist/organizations/types.d.ts.map +1 -1
- package/dist/organizations.d.ts +93 -0
- package/dist/organizations.d.ts.map +1 -0
- package/dist/organizations.js +14 -0
- package/dist/organizations.js.map +1 -0
- package/dist/solveCache/interface.d.ts +86 -0
- package/dist/solveCache/interface.d.ts.map +1 -0
- package/dist/solveCache/interface.js +12 -0
- package/dist/solveCache/interface.js.map +1 -0
- package/dist/storage/assetClasses.d.ts +59 -0
- package/dist/storage/assetClasses.d.ts.map +1 -0
- package/dist/storage/assetClasses.js +86 -0
- package/dist/storage/assetClasses.js.map +1 -0
- package/dist/storage/cacheBust.d.ts +21 -0
- package/dist/storage/cacheBust.d.ts.map +1 -0
- package/dist/storage/cacheBust.js +29 -0
- package/dist/storage/cacheBust.js.map +1 -0
- package/dist/storage/image.d.ts +6 -1
- package/dist/storage/image.d.ts.map +1 -1
- package/dist/storage/image.js +8 -3
- package/dist/storage/image.js.map +1 -1
- package/dist/storage/index.d.ts +3 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -0
- package/dist/storage/index.js.map +1 -1
- package/dist/testing/adapterSuite.d.ts +33 -0
- package/dist/testing/adapterSuite.d.ts.map +1 -0
- package/dist/testing/adapterSuite.js +166 -0
- package/dist/testing/adapterSuite.js.map +1 -0
- package/dist/testing/suites/definitionStoreSuite.d.ts.map +1 -1
- package/dist/testing/suites/definitionStoreSuite.js +87 -0
- package/dist/testing/suites/definitionStoreSuite.js.map +1 -1
- package/dist/testing/suites/eventSinkSuite.js +1 -0
- package/dist/testing/suites/eventSinkSuite.js.map +1 -1
- package/dist/testing/suites/orgStoreSuite.d.ts.map +1 -1
- package/dist/testing/suites/orgStoreSuite.js +12 -0
- package/dist/testing/suites/orgStoreSuite.js.map +1 -1
- package/dist/testing/suites/platformPermissionStoreSuite.d.ts +9 -0
- package/dist/testing/suites/platformPermissionStoreSuite.d.ts.map +1 -1
- package/dist/testing/suites/platformPermissionStoreSuite.js +34 -1
- package/dist/testing/suites/platformPermissionStoreSuite.js.map +1 -1
- package/dist/testing/suites/runner.d.ts +21 -0
- package/dist/testing/suites/runner.d.ts.map +1 -0
- package/dist/testing/suites/runner.js +7 -0
- package/dist/testing/suites/runner.js.map +1 -0
- package/dist/testing/suites/storageProviderSuite.d.ts.map +1 -1
- package/dist/testing/suites/storageProviderSuite.js +18 -0
- package/dist/testing/suites/storageProviderSuite.js.map +1 -1
- package/package.json +9 -24
- package/src/access/index.ts +0 -23
- package/src/access/rules.ts +0 -276
- package/src/auth/index.ts +0 -8
- package/src/auth/interface.ts +0 -279
- package/src/auth/types.ts +0 -32
- package/src/bindings/index.ts +0 -2
- package/src/bindings/interface.ts +0 -61
- package/src/computeServer/index.ts +0 -17
- package/src/computeServer/interface.ts +0 -62
- package/src/computeServer/types.ts +0 -74
- package/src/computeServer/utils.ts +0 -112
- package/src/config.ts +0 -99
- package/src/context.ts +0 -66
- package/src/data/index.ts +0 -1
- package/src/data/interface.ts +0 -70
- package/src/definitions/index.ts +0 -26
- package/src/definitions/interface.ts +0 -78
- package/src/definitions/paths.ts +0 -31
- package/src/definitions/schemas.ts +0 -64
- package/src/definitions/types.ts +0 -111
- package/src/errors.ts +0 -16
- package/src/events/audit.ts +0 -67
- package/src/events/index.ts +0 -9
- package/src/events/interface.ts +0 -102
- package/src/index.ts +0 -219
- package/src/invites/index.ts +0 -2
- package/src/invites/interface.ts +0 -38
- package/src/invites/types.ts +0 -39
- package/src/metrics/interface.ts +0 -86
- package/src/organizations/index.ts +0 -14
- package/src/organizations/interface.ts +0 -68
- package/src/organizations/schemas.ts +0 -52
- package/src/organizations/types.ts +0 -31
- package/src/pagination.ts +0 -45
- package/src/permissions/index.ts +0 -3
- package/src/permissions/interface.ts +0 -60
- package/src/permissions/types.ts +0 -21
- package/src/platformProjects/index.ts +0 -3
- package/src/platformProjects/interface.ts +0 -27
- package/src/platformProjects/schemas.ts +0 -13
- package/src/platformProjects/types.ts +0 -22
- package/src/projects/index.ts +0 -4
- package/src/projects/interface.ts +0 -58
- package/src/projects/schemas.ts +0 -28
- package/src/projects/types.ts +0 -36
- package/src/shareLinks/index.ts +0 -5
- package/src/shareLinks/interface.ts +0 -35
- package/src/shareLinks/schemas.ts +0 -21
- package/src/shareLinks/types.ts +0 -34
- package/src/storage/image.ts +0 -77
- package/src/storage/index.ts +0 -9
- package/src/storage/interface.ts +0 -27
- package/src/testing/index.ts +0 -47
- package/src/testing/suites/authProviderSuite.ts +0 -207
- package/src/testing/suites/computeServerStoreSuite.ts +0 -195
- package/src/testing/suites/definitionStoreSuite.ts +0 -585
- package/src/testing/suites/emailLinkAuthSuite.ts +0 -83
- package/src/testing/suites/eventSinkSuite.ts +0 -379
- package/src/testing/suites/helpers.ts +0 -87
- package/src/testing/suites/inviteStoreSuite.ts +0 -143
- package/src/testing/suites/orgStoreSuite.ts +0 -412
- package/src/testing/suites/platformPermissionStoreSuite.ts +0 -196
- package/src/testing/suites/platformProjectGrantStoreSuite.ts +0 -166
- package/src/testing/suites/projectStoreSuite.ts +0 -381
- package/src/testing/suites/shareLinkStoreSuite.ts +0 -203
- package/src/testing/suites/solveMetricSinkSuite.ts +0 -135
- package/src/testing/suites/storageProviderSuite.ts +0 -175
- package/src/testing/suites/userProfileStoreSuite.ts +0 -134
- package/src/userProfile/index.ts +0 -3
- package/src/userProfile/interface.ts +0 -48
- package/src/userProfile/types.ts +0 -24
- package/src/utils/audit.ts +0 -46
- package/src/utils/index.ts +0 -2
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { UserManagementResult } from '../auth/types.js';
|
|
2
|
-
import type { RequestContext } from '../context.js';
|
|
3
|
-
import type { RecentRun, UserProfile } from './types.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Mutable per-user profile state — separate from `IAuthProvider` so OAuth
|
|
7
|
-
* providers (Entra, Supabase Auth) don't have to model fields they can't
|
|
8
|
-
* persist.
|
|
9
|
-
*
|
|
10
|
-
* Adapters MUST scope by `ctx`: a caller cannot read or modify another
|
|
11
|
-
* user's profile via the `userId` argument. SQL adapters delegate to RLS;
|
|
12
|
-
* document-store adapters check `ctx.userId === userId` (or
|
|
13
|
-
* `instance_admin` for admin tooling). Pass `SYSTEM_CONTEXT` for trusted
|
|
14
|
-
* server flows (auto-seed on signup, janitors).
|
|
15
|
-
*/
|
|
16
|
-
export interface IUserProfileStore {
|
|
17
|
-
/** Returns null when no profile row exists — treat as `emptyProfile(id)`. */
|
|
18
|
-
getProfile(ctx: RequestContext, userId: string): Promise<UserProfile | null>;
|
|
19
|
-
|
|
20
|
-
/** Missing users are omitted; order is not guaranteed. */
|
|
21
|
-
getProfiles(ctx: RequestContext, userIds: readonly string[]): Promise<UserProfile[]>;
|
|
22
|
-
|
|
23
|
-
updateProfile(
|
|
24
|
-
ctx: RequestContext,
|
|
25
|
-
userId: string,
|
|
26
|
-
patch: { displayName?: string }
|
|
27
|
-
): Promise<UserManagementResult>;
|
|
28
|
-
|
|
29
|
-
/** No-op if already starred. */
|
|
30
|
-
starDefinition(
|
|
31
|
-
ctx: RequestContext,
|
|
32
|
-
userId: string,
|
|
33
|
-
definitionId: string
|
|
34
|
-
): Promise<UserManagementResult>;
|
|
35
|
-
|
|
36
|
-
/** No-op if not starred. */
|
|
37
|
-
unstarDefinition(
|
|
38
|
-
ctx: RequestContext,
|
|
39
|
-
userId: string,
|
|
40
|
-
definitionId: string
|
|
41
|
-
): Promise<UserManagementResult>;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Record a solve run. Adapters cap the list (e.g. 20) and dedupe by
|
|
45
|
-
* `definitionId`.
|
|
46
|
-
*/
|
|
47
|
-
recordRun(ctx: RequestContext, userId: string, run: RecentRun): Promise<UserManagementResult>;
|
|
48
|
-
}
|
package/src/userProfile/types.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface RecentRun {
|
|
2
|
-
definitionId: string;
|
|
3
|
-
runId: string;
|
|
4
|
-
definitionName: string;
|
|
5
|
-
timestamp: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Mutable per-user profile state. Owned by `IUserProfileStore` so OIDC
|
|
10
|
-
* providers (Supabase Auth, Entra, Firebase) don't have to model fields they
|
|
11
|
-
* can't persist — identity from the IdP, profile state from your DB.
|
|
12
|
-
*/
|
|
13
|
-
export interface UserProfile {
|
|
14
|
-
userId: string;
|
|
15
|
-
displayName?: string;
|
|
16
|
-
/** Definition GUIDs pinned by this user. */
|
|
17
|
-
starredDefinitions: string[];
|
|
18
|
-
/** Last N solve runs, newest first. Capped by the adapter. */
|
|
19
|
-
recentRuns: RecentRun[];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function emptyProfile(userId: string): UserProfile {
|
|
23
|
-
return { userId, starredDefinitions: [], recentRuns: [] };
|
|
24
|
-
}
|
package/src/utils/audit.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { RequestContext } from '../context.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Audit-field stamping helpers. Every mutable entity carries `createdAt` /
|
|
5
|
-
* `createdBy` / `updatedAt` / `updatedBy` / `deletedAt`.
|
|
6
|
-
*
|
|
7
|
-
* `createdAt` / `createdBy` are stamped by the consumer when constructing
|
|
8
|
-
* the record. `updatedAt` / `updatedBy` and `deletedAt` are stamped by
|
|
9
|
-
* stores on every mutation.
|
|
10
|
-
*
|
|
11
|
-
* `fallbackActor` is used when `ctx.userId` is empty (system contexts) —
|
|
12
|
-
* pass the record's prior `updatedBy` (or `ownerId` / `createdBy` if unset).
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const nowIso = (): string => new Date().toISOString();
|
|
16
|
-
|
|
17
|
-
export interface AuditUpdate {
|
|
18
|
-
updatedAt: string;
|
|
19
|
-
updatedBy: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function auditUpdate(
|
|
23
|
-
ctx: RequestContext,
|
|
24
|
-
fallbackActor: string | null | undefined
|
|
25
|
-
): AuditUpdate {
|
|
26
|
-
return {
|
|
27
|
-
updatedAt: nowIso(),
|
|
28
|
-
updatedBy: ctx.userId || fallbackActor || ''
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface AuditSoftDelete extends AuditUpdate {
|
|
33
|
-
deletedAt: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function auditSoftDelete(
|
|
37
|
-
ctx: RequestContext,
|
|
38
|
-
fallbackActor: string | null | undefined
|
|
39
|
-
): AuditSoftDelete {
|
|
40
|
-
const now = nowIso();
|
|
41
|
-
return {
|
|
42
|
-
deletedAt: now,
|
|
43
|
-
updatedAt: now,
|
|
44
|
-
updatedBy: ctx.userId || fallbackActor || ''
|
|
45
|
-
};
|
|
46
|
-
}
|
package/src/utils/index.ts
DELETED