@selvajs/platform 0.21.0-beta.3 → 1.0.0-beta.5
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/README.md +11 -8
- package/dist/access/index.d.ts +0 -1
- package/dist/access/index.js +0 -1
- package/dist/access/rules.d.ts +7 -14
- package/dist/access/rules.js +22 -26
- package/dist/apiTokens/index.d.ts +1 -2
- package/dist/apiTokens/index.js +1 -2
- package/dist/apiTokens/interface.d.ts +0 -1
- package/dist/apiTokens/interface.js +0 -1
- package/dist/apiTokens/scope.d.ts +0 -1
- package/dist/apiTokens/scope.js +0 -1
- package/dist/apiTokens/types.d.ts +0 -1
- package/dist/apiTokens/types.js +0 -1
- package/dist/auth/index.d.ts +0 -1
- package/dist/auth/index.js +0 -1
- package/dist/auth/interface.d.ts +4 -23
- package/dist/auth/interface.js +0 -1
- package/dist/auth/types.d.ts +4 -2
- package/dist/auth/types.js +0 -1
- package/dist/bindings/index.d.ts +0 -1
- package/dist/bindings/index.js +0 -1
- package/dist/bindings/interface.d.ts +0 -1
- package/dist/bindings/interface.js +0 -1
- package/dist/computeServer/index.d.ts +1 -7
- package/dist/computeServer/index.js +2 -8
- package/dist/computeServer/interface.d.ts +9 -6
- package/dist/computeServer/interface.js +0 -1
- package/dist/computeServer/public.d.ts +6 -0
- package/dist/computeServer/public.js +2 -0
- package/dist/computeServer/secrets.d.ts +12 -6
- package/dist/computeServer/secrets.js +35 -15
- package/dist/computeServer/types.d.ts +5 -2
- package/dist/computeServer/types.js +4 -1
- package/dist/computeServer/utils.d.ts +17 -6
- package/dist/computeServer/utils.js +31 -21
- package/dist/config.d.ts +1 -2
- package/dist/config.js +0 -1
- package/dist/context.d.ts +11 -1
- package/dist/context.js +51 -2
- package/dist/data/index.d.ts +0 -1
- package/dist/data/index.js +0 -1
- package/dist/data/interface.d.ts +0 -1
- package/dist/data/interface.js +0 -1
- package/dist/definitions/index.d.ts +2 -3
- package/dist/definitions/index.js +2 -3
- package/dist/definitions/interface.d.ts +0 -1
- package/dist/definitions/interface.js +0 -1
- package/dist/definitions/paths.d.ts +0 -1
- package/dist/definitions/paths.js +1 -12
- package/dist/definitions/schemas.d.ts +0 -21
- package/dist/definitions/schemas.js +6 -19
- package/dist/definitions/types.d.ts +3 -4
- package/dist/definitions/types.js +0 -3
- package/dist/errors/interface.d.ts +1 -2
- package/dist/errors/interface.js +0 -1
- package/dist/errors.d.ts +8 -1
- package/dist/errors.js +11 -1
- package/dist/events/audit.d.ts +1 -2
- package/dist/events/audit.js +0 -1
- package/dist/events/index.d.ts +0 -1
- package/dist/events/index.js +0 -1
- package/dist/events/interface.d.ts +0 -1
- package/dist/events/interface.js +0 -1
- package/dist/index.d.ts +18 -61
- package/dist/index.js +18 -24
- package/dist/invites/index.d.ts +0 -1
- package/dist/invites/index.js +0 -1
- package/dist/invites/interface.d.ts +5 -6
- package/dist/invites/interface.js +0 -1
- package/dist/invites/types.d.ts +0 -1
- package/dist/invites/types.js +0 -1
- package/dist/logging/interface.d.ts +0 -1
- package/dist/logging/interface.js +0 -1
- package/dist/metrics/interface.d.ts +0 -1
- package/dist/metrics/interface.js +0 -1
- package/dist/notifications/index.d.ts +0 -1
- package/dist/notifications/index.js +0 -1
- package/dist/notifications/interface.d.ts +1 -3
- package/dist/notifications/interface.js +1 -3
- package/dist/notifications/types.d.ts +0 -1
- package/dist/notifications/types.js +0 -1
- package/dist/organizations/index.d.ts +2 -3
- package/dist/organizations/index.js +1 -2
- package/dist/organizations/interface.d.ts +3 -5
- package/dist/organizations/interface.js +0 -1
- package/dist/organizations/paths.d.ts +1 -6
- package/dist/organizations/paths.js +2 -20
- package/dist/organizations/schemas.d.ts +5 -7
- package/dist/organizations/schemas.js +20 -13
- package/dist/organizations/types.d.ts +0 -1
- package/dist/organizations/types.js +0 -1
- package/dist/pagination.d.ts +21 -3
- package/dist/pagination.js +34 -1
- package/dist/permissions/index.d.ts +2 -2
- package/dist/permissions/index.js +2 -2
- package/dist/permissions/interface.d.ts +4 -4
- package/dist/permissions/interface.js +0 -1
- package/dist/permissions/types.d.ts +0 -1
- package/dist/permissions/types.js +0 -1
- package/dist/platformProjects/index.d.ts +1 -3
- package/dist/platformProjects/index.js +1 -2
- package/dist/platformProjects/interface.d.ts +0 -1
- package/dist/platformProjects/interface.js +0 -1
- package/dist/platformProjects/schemas.d.ts +0 -1
- package/dist/platformProjects/schemas.js +0 -1
- package/dist/platformProjects/types.d.ts +3 -2
- package/dist/platformProjects/types.js +0 -1
- package/dist/projects/index.d.ts +0 -1
- package/dist/projects/index.js +0 -1
- package/dist/projects/interface.d.ts +0 -1
- package/dist/projects/interface.js +0 -1
- package/dist/projects/schemas.d.ts +0 -1
- package/dist/projects/schemas.js +0 -1
- package/dist/projects/types.d.ts +0 -1
- package/dist/projects/types.js +0 -1
- package/dist/shareLinks/index.d.ts +0 -1
- package/dist/shareLinks/index.js +0 -1
- package/dist/shareLinks/interface.d.ts +6 -3
- package/dist/shareLinks/interface.js +0 -1
- package/dist/shareLinks/schemas.d.ts +0 -1
- package/dist/shareLinks/schemas.js +4 -2
- package/dist/shareLinks/types.d.ts +0 -1
- package/dist/shareLinks/types.js +0 -1
- package/dist/solveCache/interface.d.ts +2 -3
- package/dist/solveCache/interface.js +0 -1
- package/dist/storage/assetClasses.d.ts +4 -8
- package/dist/storage/assetClasses.js +6 -21
- package/dist/storage/cacheBust.d.ts +0 -1
- package/dist/storage/cacheBust.js +5 -3
- package/dist/storage/image.d.ts +8 -5
- package/dist/storage/image.js +74 -12
- package/dist/storage/index.d.ts +2 -4
- package/dist/storage/index.js +2 -3
- package/dist/storage/interface.d.ts +11 -3
- package/dist/storage/interface.js +0 -1
- package/dist/storage/safeKey.d.ts +7 -0
- package/dist/storage/safeKey.js +12 -0
- package/dist/testing/index.d.ts +5 -2
- package/dist/testing/index.js +3 -2
- package/dist/testing/suites/apiTokenStoreSuite.d.ts +0 -1
- package/dist/testing/suites/apiTokenStoreSuite.js +0 -1
- package/dist/testing/suites/auditQuerySuite.d.ts +18 -0
- package/dist/testing/suites/auditQuerySuite.js +73 -0
- package/dist/testing/suites/authProviderSuite.d.ts +14 -3
- package/dist/testing/suites/authProviderSuite.js +57 -32
- package/dist/testing/suites/computeServerStoreSuite.d.ts +1 -2
- package/dist/testing/suites/computeServerStoreSuite.js +68 -4
- package/dist/testing/suites/definitionStoreSuite.d.ts +2 -1
- package/dist/testing/suites/definitionStoreSuite.js +19 -16
- package/dist/testing/suites/emailLinkAuthSuite.d.ts +2 -5
- package/dist/testing/suites/emailLinkAuthSuite.js +1 -9
- package/dist/testing/suites/eventSinkSuite.d.ts +0 -1
- package/dist/testing/suites/eventSinkSuite.js +9 -1
- package/dist/testing/suites/helpers.d.ts +5 -1
- package/dist/testing/suites/helpers.js +7 -1
- package/dist/testing/suites/inviteStoreSuite.d.ts +0 -1
- package/dist/testing/suites/inviteStoreSuite.js +17 -7
- package/dist/testing/suites/oauthAuthSuite.d.ts +18 -0
- package/dist/testing/suites/oauthAuthSuite.js +26 -0
- package/dist/testing/suites/orgStoreSuite.d.ts +5 -1
- package/dist/testing/suites/orgStoreSuite.js +26 -7
- package/dist/testing/suites/platformPermissionStoreSuite.d.ts +0 -5
- package/dist/testing/suites/platformPermissionStoreSuite.js +12 -63
- package/dist/testing/suites/platformProjectGrantStoreSuite.d.ts +0 -1
- package/dist/testing/suites/platformProjectGrantStoreSuite.js +0 -5
- package/dist/testing/suites/projectStoreSuite.d.ts +5 -1
- package/dist/testing/suites/projectStoreSuite.js +6 -6
- package/dist/testing/suites/shareLinkStoreSuite.d.ts +2 -1
- package/dist/testing/suites/shareLinkStoreSuite.js +22 -25
- package/dist/testing/suites/solveMetricSinkSuite.d.ts +0 -1
- package/dist/testing/suites/solveMetricSinkSuite.js +2 -2
- package/dist/testing/suites/storageProviderSuite.d.ts +0 -1
- package/dist/testing/suites/storageProviderSuite.js +15 -10
- package/dist/testing/suites/userProfileStoreSuite.d.ts +1 -2
- package/dist/testing/suites/userProfileStoreSuite.js +42 -7
- package/dist/userProfile/index.d.ts +2 -2
- package/dist/userProfile/index.js +2 -2
- package/dist/userProfile/interface.d.ts +5 -6
- package/dist/userProfile/interface.js +0 -1
- package/dist/userProfile/types.d.ts +2 -1
- package/dist/userProfile/types.js +2 -1
- package/dist/utils/audit.d.ts +0 -1
- package/dist/utils/audit.js +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -1
- package/package.json +7 -6
- package/dist/access/index.d.ts.map +0 -1
- package/dist/access/index.js.map +0 -1
- package/dist/access/rules.d.ts.map +0 -1
- package/dist/access/rules.js.map +0 -1
- package/dist/apiTokens/index.d.ts.map +0 -1
- package/dist/apiTokens/index.js.map +0 -1
- package/dist/apiTokens/interface.d.ts.map +0 -1
- package/dist/apiTokens/interface.js.map +0 -1
- package/dist/apiTokens/scope.d.ts.map +0 -1
- package/dist/apiTokens/scope.js.map +0 -1
- package/dist/apiTokens/types.d.ts.map +0 -1
- package/dist/apiTokens/types.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/interface.d.ts.map +0 -1
- package/dist/auth/interface.js.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js.map +0 -1
- package/dist/bindings/index.d.ts.map +0 -1
- package/dist/bindings/index.js.map +0 -1
- package/dist/bindings/interface.d.ts.map +0 -1
- package/dist/bindings/interface.js.map +0 -1
- package/dist/computeServer/index.d.ts.map +0 -1
- package/dist/computeServer/index.js.map +0 -1
- package/dist/computeServer/interface.d.ts.map +0 -1
- package/dist/computeServer/interface.js.map +0 -1
- package/dist/computeServer/secrets.d.ts.map +0 -1
- package/dist/computeServer/secrets.js.map +0 -1
- package/dist/computeServer/types.d.ts.map +0 -1
- package/dist/computeServer/types.js.map +0 -1
- package/dist/computeServer/utils.d.ts.map +0 -1
- package/dist/computeServer/utils.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/data/index.d.ts.map +0 -1
- package/dist/data/index.js.map +0 -1
- package/dist/data/interface.d.ts.map +0 -1
- package/dist/data/interface.js.map +0 -1
- package/dist/definitions/index.d.ts.map +0 -1
- package/dist/definitions/index.js.map +0 -1
- package/dist/definitions/interface.d.ts.map +0 -1
- package/dist/definitions/interface.js.map +0 -1
- package/dist/definitions/paths.d.ts.map +0 -1
- package/dist/definitions/paths.js.map +0 -1
- package/dist/definitions/schemas.d.ts.map +0 -1
- package/dist/definitions/schemas.js.map +0 -1
- package/dist/definitions/types.d.ts.map +0 -1
- package/dist/definitions/types.js.map +0 -1
- package/dist/errors/interface.d.ts.map +0 -1
- package/dist/errors/interface.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/events/audit.d.ts.map +0 -1
- package/dist/events/audit.js.map +0 -1
- package/dist/events/index.d.ts.map +0 -1
- package/dist/events/index.js.map +0 -1
- package/dist/events/interface.d.ts.map +0 -1
- package/dist/events/interface.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/invites/index.d.ts.map +0 -1
- package/dist/invites/index.js.map +0 -1
- package/dist/invites/interface.d.ts.map +0 -1
- package/dist/invites/interface.js.map +0 -1
- package/dist/invites/types.d.ts.map +0 -1
- package/dist/invites/types.js.map +0 -1
- package/dist/logging/interface.d.ts.map +0 -1
- package/dist/logging/interface.js.map +0 -1
- package/dist/metrics/interface.d.ts.map +0 -1
- package/dist/metrics/interface.js.map +0 -1
- package/dist/notifications/index.d.ts.map +0 -1
- package/dist/notifications/index.js.map +0 -1
- package/dist/notifications/interface.d.ts.map +0 -1
- package/dist/notifications/interface.js.map +0 -1
- package/dist/notifications/types.d.ts.map +0 -1
- package/dist/notifications/types.js.map +0 -1
- package/dist/organizations/index.d.ts.map +0 -1
- package/dist/organizations/index.js.map +0 -1
- package/dist/organizations/interface.d.ts.map +0 -1
- package/dist/organizations/interface.js.map +0 -1
- package/dist/organizations/paths.d.ts.map +0 -1
- package/dist/organizations/paths.js.map +0 -1
- package/dist/organizations/schemas.d.ts.map +0 -1
- package/dist/organizations/schemas.js.map +0 -1
- package/dist/organizations/types.d.ts.map +0 -1
- package/dist/organizations/types.js.map +0 -1
- package/dist/pagination.d.ts.map +0 -1
- package/dist/pagination.js.map +0 -1
- package/dist/permissions/index.d.ts.map +0 -1
- package/dist/permissions/index.js.map +0 -1
- package/dist/permissions/interface.d.ts.map +0 -1
- package/dist/permissions/interface.js.map +0 -1
- package/dist/permissions/types.d.ts.map +0 -1
- package/dist/permissions/types.js.map +0 -1
- package/dist/platformProjects/index.d.ts.map +0 -1
- package/dist/platformProjects/index.js.map +0 -1
- package/dist/platformProjects/interface.d.ts.map +0 -1
- package/dist/platformProjects/interface.js.map +0 -1
- package/dist/platformProjects/schemas.d.ts.map +0 -1
- package/dist/platformProjects/schemas.js.map +0 -1
- package/dist/platformProjects/types.d.ts.map +0 -1
- package/dist/platformProjects/types.js.map +0 -1
- package/dist/projects/index.d.ts.map +0 -1
- package/dist/projects/index.js.map +0 -1
- package/dist/projects/interface.d.ts.map +0 -1
- package/dist/projects/interface.js.map +0 -1
- package/dist/projects/schemas.d.ts.map +0 -1
- package/dist/projects/schemas.js.map +0 -1
- package/dist/projects/types.d.ts.map +0 -1
- package/dist/projects/types.js.map +0 -1
- package/dist/shareLinks/index.d.ts.map +0 -1
- package/dist/shareLinks/index.js.map +0 -1
- package/dist/shareLinks/interface.d.ts.map +0 -1
- package/dist/shareLinks/interface.js.map +0 -1
- package/dist/shareLinks/schemas.d.ts.map +0 -1
- package/dist/shareLinks/schemas.js.map +0 -1
- package/dist/shareLinks/types.d.ts.map +0 -1
- package/dist/shareLinks/types.js.map +0 -1
- package/dist/solveCache/interface.d.ts.map +0 -1
- package/dist/solveCache/interface.js.map +0 -1
- package/dist/storage/assetClasses.d.ts.map +0 -1
- package/dist/storage/assetClasses.js.map +0 -1
- package/dist/storage/cacheBust.d.ts.map +0 -1
- package/dist/storage/cacheBust.js.map +0 -1
- package/dist/storage/image.d.ts.map +0 -1
- package/dist/storage/image.js.map +0 -1
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/index.js.map +0 -1
- package/dist/storage/interface.d.ts.map +0 -1
- package/dist/storage/interface.js.map +0 -1
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/index.js.map +0 -1
- package/dist/testing/suites/apiTokenStoreSuite.d.ts.map +0 -1
- package/dist/testing/suites/apiTokenStoreSuite.js.map +0 -1
- package/dist/testing/suites/authProviderSuite.d.ts.map +0 -1
- package/dist/testing/suites/authProviderSuite.js.map +0 -1
- package/dist/testing/suites/computeServerStoreSuite.d.ts.map +0 -1
- package/dist/testing/suites/computeServerStoreSuite.js.map +0 -1
- package/dist/testing/suites/definitionStoreSuite.d.ts.map +0 -1
- package/dist/testing/suites/definitionStoreSuite.js.map +0 -1
- package/dist/testing/suites/emailLinkAuthSuite.d.ts.map +0 -1
- package/dist/testing/suites/emailLinkAuthSuite.js.map +0 -1
- package/dist/testing/suites/eventSinkSuite.d.ts.map +0 -1
- package/dist/testing/suites/eventSinkSuite.js.map +0 -1
- package/dist/testing/suites/helpers.d.ts.map +0 -1
- package/dist/testing/suites/helpers.js.map +0 -1
- package/dist/testing/suites/inviteStoreSuite.d.ts.map +0 -1
- package/dist/testing/suites/inviteStoreSuite.js.map +0 -1
- package/dist/testing/suites/orgStoreSuite.d.ts.map +0 -1
- package/dist/testing/suites/orgStoreSuite.js.map +0 -1
- package/dist/testing/suites/platformPermissionStoreSuite.d.ts.map +0 -1
- package/dist/testing/suites/platformPermissionStoreSuite.js.map +0 -1
- package/dist/testing/suites/platformProjectGrantStoreSuite.d.ts.map +0 -1
- package/dist/testing/suites/platformProjectGrantStoreSuite.js.map +0 -1
- package/dist/testing/suites/projectStoreSuite.d.ts.map +0 -1
- package/dist/testing/suites/projectStoreSuite.js.map +0 -1
- package/dist/testing/suites/shareLinkStoreSuite.d.ts.map +0 -1
- package/dist/testing/suites/shareLinkStoreSuite.js.map +0 -1
- package/dist/testing/suites/solveMetricSinkSuite.d.ts.map +0 -1
- package/dist/testing/suites/solveMetricSinkSuite.js.map +0 -1
- package/dist/testing/suites/storageProviderSuite.d.ts.map +0 -1
- package/dist/testing/suites/storageProviderSuite.js.map +0 -1
- package/dist/testing/suites/userProfileStoreSuite.d.ts.map +0 -1
- package/dist/testing/suites/userProfileStoreSuite.js.map +0 -1
- package/dist/userProfile/index.d.ts.map +0 -1
- package/dist/userProfile/index.js.map +0 -1
- package/dist/userProfile/interface.d.ts.map +0 -1
- package/dist/userProfile/interface.js.map +0 -1
- package/dist/userProfile/types.d.ts.map +0 -1
- package/dist/userProfile/types.js.map +0 -1
- package/dist/utils/audit.d.ts.map +0 -1
- package/dist/utils/audit.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
|
@@ -10,18 +10,27 @@ export declare function serversVisibleTo(config: ComputeConfig, orgId: string |
|
|
|
10
10
|
* default. Returns `undefined` if neither is set or visible.
|
|
11
11
|
*/
|
|
12
12
|
export declare function defaultServerIdFor(config: ComputeConfig, orgId: string | null | undefined): string | undefined;
|
|
13
|
+
export interface ResolveOptions {
|
|
14
|
+
/** Per-definition pin. Falls through silently if not visible. */
|
|
15
|
+
definitionPin?: string | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* From servers already filtered for visibility, the pin if it is among them, then
|
|
19
|
+
* the default, then the first. Only for a caller holding the filtered list: use
|
|
20
|
+
* {@link resolveServerForOrg} when you have the config.
|
|
21
|
+
*/
|
|
22
|
+
export declare function pickServer<T extends {
|
|
23
|
+
id: string;
|
|
24
|
+
}>(visible: readonly T[], defaultId: string | null | undefined, pin: string | null | undefined): T | undefined;
|
|
13
25
|
/**
|
|
14
26
|
* Resolves a definition's compute server, in order:
|
|
15
27
|
* 1. Definition pin (`computeServerId`) if visible to the project's org.
|
|
16
28
|
* 2. `orgDefaults[orgId]` if set.
|
|
17
29
|
* 3. Global `defaultServerId`.
|
|
30
|
+
* 4. The first visible server, mainly before a default is chosen.
|
|
18
31
|
*
|
|
19
32
|
* Throws if no usable server exists.
|
|
20
33
|
*/
|
|
21
|
-
export interface ResolveOptions {
|
|
22
|
-
/** Per-definition pin. Falls through silently if not visible. */
|
|
23
|
-
definitionPin?: string | null;
|
|
24
|
-
}
|
|
25
34
|
export declare function resolveServerForOrg(config: ComputeConfig, orgId: string | null | undefined, opts?: ResolveOptions): ComputeServerConfig;
|
|
26
35
|
/**
|
|
27
36
|
* The config as one org may see it: visible servers only, `orgDefaults` reduced
|
|
@@ -36,5 +45,7 @@ export declare function scopeConfigToOrg(config: ComputeConfig, orgId: string):
|
|
|
36
45
|
/** Lookup by id, ignoring scope or visibility — for admin contexts that display a server outside the visibility filter. */
|
|
37
46
|
export declare function findServerById(config: ComputeConfig, id: string): ComputeServerConfig | undefined;
|
|
38
47
|
export declare function platformServers(config: ComputeConfig): import("./types.js").PlatformComputeServer[];
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
/** What a compute settings form should send for a typed timeout. */
|
|
49
|
+
export declare function clampTimeoutMs(value: unknown): number;
|
|
50
|
+
/** What a compute settings form should send for a typed retry count. */
|
|
51
|
+
export declare function clampRetryCount(value: unknown): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { COMPUTE_RETRY_MAX, COMPUTE_TIMEOUT_DEFAULT_MS, COMPUTE_TIMEOUT_MAX_MS, COMPUTE_TIMEOUT_MIN_MS, isPlatformServer } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Servers an org can see in pickers and use for solves:
|
|
4
4
|
* platform servers shared with this org (or `'all'`, or the global default)
|
|
@@ -36,25 +36,30 @@ export function defaultServerIdFor(config, orgId) {
|
|
|
36
36
|
}
|
|
37
37
|
return undefined;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* From servers already filtered for visibility, the pin if it is among them, then
|
|
41
|
+
* the default, then the first. Only for a caller holding the filtered list: use
|
|
42
|
+
* {@link resolveServerForOrg} when you have the config.
|
|
43
|
+
*/
|
|
44
|
+
export function pickServer(visible, defaultId, pin) {
|
|
45
|
+
// A pin can go stale when an admin un-shares the server, so it falls through.
|
|
46
|
+
return visible.find((s) => s.id === pin) ?? visible.find((s) => s.id === defaultId) ?? visible[0];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolves a definition's compute server, in order:
|
|
50
|
+
* 1. Definition pin (`computeServerId`) if visible to the project's org.
|
|
51
|
+
* 2. `orgDefaults[orgId]` if set.
|
|
52
|
+
* 3. Global `defaultServerId`.
|
|
53
|
+
* 4. The first visible server, mainly before a default is chosen.
|
|
54
|
+
*
|
|
55
|
+
* Throws if no usable server exists.
|
|
56
|
+
*/
|
|
39
57
|
export function resolveServerForOrg(config, orgId, opts = {}) {
|
|
40
58
|
const visible = serversVisibleTo(config, orgId);
|
|
41
|
-
|
|
59
|
+
const server = pickServer(visible, defaultServerIdFor(config, orgId), opts.definitionPin);
|
|
60
|
+
if (!server)
|
|
42
61
|
throw new Error('No compute servers are configured or visible for this org.');
|
|
43
|
-
|
|
44
|
-
if (opts.definitionPin) {
|
|
45
|
-
const pinned = visible.find((s) => s.id === opts.definitionPin);
|
|
46
|
-
if (pinned)
|
|
47
|
-
return pinned;
|
|
48
|
-
// Not visible — admin may have un-shared the server since the pin was set. Fall through.
|
|
49
|
-
}
|
|
50
|
-
const defaultId = defaultServerIdFor(config, orgId);
|
|
51
|
-
if (defaultId) {
|
|
52
|
-
const found = visible.find((s) => s.id === defaultId);
|
|
53
|
-
if (found)
|
|
54
|
-
return found;
|
|
55
|
-
}
|
|
56
|
-
// Last resort: first visible server. Mainly hit in tests and initial setup before a default is chosen.
|
|
57
|
-
return visible[0];
|
|
62
|
+
return server;
|
|
58
63
|
}
|
|
59
64
|
/**
|
|
60
65
|
* The config as one org may see it: visible servers only, `orgDefaults` reduced
|
|
@@ -74,7 +79,7 @@ export function scopeConfigToOrg(config, orgId) {
|
|
|
74
79
|
defaultServerId: config.defaultServerId && visibleIds.has(config.defaultServerId)
|
|
75
80
|
? config.defaultServerId
|
|
76
81
|
: undefined,
|
|
77
|
-
orgDefaults: orgDefault ? { [orgId]: orgDefault } : {}
|
|
82
|
+
orgDefaults: orgDefault && visibleIds.has(orgDefault) ? { [orgId]: orgDefault } : {}
|
|
78
83
|
};
|
|
79
84
|
}
|
|
80
85
|
/** Lookup by id, ignoring scope or visibility — for admin contexts that display a server outside the visibility filter. */
|
|
@@ -87,7 +92,12 @@ export function findServerById(config, id) {
|
|
|
87
92
|
export function platformServers(config) {
|
|
88
93
|
return config.servers.filter(isPlatformServer);
|
|
89
94
|
}
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
/** What a compute settings form should send for a typed timeout. */
|
|
96
|
+
export function clampTimeoutMs(value) {
|
|
97
|
+
const ms = Number(value) || COMPUTE_TIMEOUT_DEFAULT_MS;
|
|
98
|
+
return Math.min(COMPUTE_TIMEOUT_MAX_MS, Math.max(COMPUTE_TIMEOUT_MIN_MS, ms));
|
|
99
|
+
}
|
|
100
|
+
/** What a compute settings form should send for a typed retry count. */
|
|
101
|
+
export function clampRetryCount(value) {
|
|
102
|
+
return Math.min(COMPUTE_RETRY_MAX, Math.max(0, Number(value) || 0));
|
|
92
103
|
}
|
|
93
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/config.d.ts
CHANGED
|
@@ -60,5 +60,4 @@ export interface SelvaConfig {
|
|
|
60
60
|
export type SelvaConfigFactory = (env: Record<string, string | undefined>) => SelvaConfig;
|
|
61
61
|
export declare function isFlagEnabled(config: SelvaConfig, flag: keyof SelvaFlags): boolean;
|
|
62
62
|
/** Identity function for type inference and IDE autocomplete. */
|
|
63
|
-
export declare function defineConfig
|
|
64
|
-
//# sourceMappingURL=config.d.ts.map
|
|
63
|
+
export declare function defineConfig<T extends SelvaConfig | SelvaConfigFactory>(config: T): T;
|
package/dist/config.js
CHANGED
package/dist/context.d.ts
CHANGED
|
@@ -62,10 +62,20 @@ export declare function isShareContext(ctx: RequestContext): boolean;
|
|
|
62
62
|
* definition on one channel, never instance authority.
|
|
63
63
|
*/
|
|
64
64
|
export declare function assertNotShareContext(ctx: RequestContext, what: string): void;
|
|
65
|
+
/** May `ctx` read `userId`'s platform permissions? Throws `ProviderError(403)` if not. */
|
|
66
|
+
export declare function assertCanReadPermissions(ctx: RequestContext, userId: string): void;
|
|
67
|
+
/** May `ctx` read several users' platform permissions? Throws `ProviderError(403)` if not. */
|
|
68
|
+
export declare function assertCanReadPermissionsBatch(ctx: RequestContext): void;
|
|
69
|
+
/** May `ctx` change platform permissions? Throws `ProviderError(403)` if not. */
|
|
70
|
+
export declare function assertCanManagePermissions(ctx: RequestContext): void;
|
|
71
|
+
/**
|
|
72
|
+
* For provider authors: may `ctx` read or change `userId`'s profile? Throws
|
|
73
|
+
* `ProviderError(403)` if not.
|
|
74
|
+
*/
|
|
75
|
+
export declare function assertCanAccessProfile(ctx: RequestContext, userId: string): void;
|
|
65
76
|
/**
|
|
66
77
|
* Returns the org the caller is acting as, or throws `ProviderError(403)`.
|
|
67
78
|
* Centralizes this guard so every store that scopes rows to an acting org fails
|
|
68
79
|
* the same consistent way, instead of leaking `org_id = undefined` into a query.
|
|
69
80
|
*/
|
|
70
81
|
export declare function requireActingOrg(ctx: RequestContext): string;
|
|
71
|
-
//# sourceMappingURL=context.d.ts.map
|
package/dist/context.js
CHANGED
|
@@ -14,7 +14,7 @@ export const SYSTEM_CONTEXT = {
|
|
|
14
14
|
* `actingOrgId` returns false unless `instance_admin` or `system`.
|
|
15
15
|
*/
|
|
16
16
|
export function hasPermission(ctx, permission) {
|
|
17
|
-
if (ctx.system)
|
|
17
|
+
if (ctx.system && !isShareContext(ctx))
|
|
18
18
|
return true;
|
|
19
19
|
if (ctx.platformPermissions.includes('instance_admin'))
|
|
20
20
|
return true;
|
|
@@ -41,6 +41,56 @@ export function assertNotShareContext(ctx, what) {
|
|
|
41
41
|
throw new ProviderError(`Forbidden: a share link cannot ${what}`, 403);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
// For provider authors: `IPlatformPermissionStore` adapters whose backing store is
|
|
45
|
+
// too coarse to enforce this themselves. Reading one row and reading many agree, and
|
|
46
|
+
// read access is not authority: `set` stays `instance_admin`-only.
|
|
47
|
+
/** May `ctx` read `userId`'s platform permissions? Throws `ProviderError(403)` if not. */
|
|
48
|
+
export function assertCanReadPermissions(ctx, userId) {
|
|
49
|
+
assertNotShareContext(ctx, 'read permissions');
|
|
50
|
+
if (ctx.system)
|
|
51
|
+
return;
|
|
52
|
+
if (ctx.userId === userId)
|
|
53
|
+
return;
|
|
54
|
+
if (hasPermission(ctx, 'instance_admin'))
|
|
55
|
+
return;
|
|
56
|
+
if (hasPermission(ctx, 'manage_instance_users'))
|
|
57
|
+
return;
|
|
58
|
+
throw new ProviderError('Forbidden: cannot read another user’s permissions', 403);
|
|
59
|
+
}
|
|
60
|
+
/** May `ctx` read several users' platform permissions? Throws `ProviderError(403)` if not. */
|
|
61
|
+
export function assertCanReadPermissionsBatch(ctx) {
|
|
62
|
+
assertNotShareContext(ctx, 'read permissions');
|
|
63
|
+
if (ctx.system)
|
|
64
|
+
return;
|
|
65
|
+
if (hasPermission(ctx, 'instance_admin'))
|
|
66
|
+
return;
|
|
67
|
+
if (hasPermission(ctx, 'manage_instance_users'))
|
|
68
|
+
return;
|
|
69
|
+
throw new ProviderError('Forbidden: instance admin or manage_instance_users required', 403);
|
|
70
|
+
}
|
|
71
|
+
/** May `ctx` change platform permissions? Throws `ProviderError(403)` if not. */
|
|
72
|
+
export function assertCanManagePermissions(ctx) {
|
|
73
|
+
assertNotShareContext(ctx, 'manage permissions');
|
|
74
|
+
if (ctx.system)
|
|
75
|
+
return;
|
|
76
|
+
if (hasPermission(ctx, 'instance_admin'))
|
|
77
|
+
return;
|
|
78
|
+
throw new ProviderError('Forbidden: instance admin required', 403);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* For provider authors: may `ctx` read or change `userId`'s profile? Throws
|
|
82
|
+
* `ProviderError(403)` if not.
|
|
83
|
+
*/
|
|
84
|
+
export function assertCanAccessProfile(ctx, userId) {
|
|
85
|
+
assertNotShareContext(ctx, 'access user profiles');
|
|
86
|
+
if (ctx.system)
|
|
87
|
+
return;
|
|
88
|
+
if (ctx.userId === userId)
|
|
89
|
+
return;
|
|
90
|
+
if (hasPermission(ctx, 'instance_admin'))
|
|
91
|
+
return;
|
|
92
|
+
throw new ProviderError('Forbidden: cannot access another user’s profile', 403);
|
|
93
|
+
}
|
|
44
94
|
const PLATFORM_PERMISSION_VALUES = new Set(ALL_PLATFORM_PERMISSIONS);
|
|
45
95
|
function isPlatformPermission(p) {
|
|
46
96
|
return PLATFORM_PERMISSION_VALUES.has(p);
|
|
@@ -56,4 +106,3 @@ export function requireActingOrg(ctx) {
|
|
|
56
106
|
}
|
|
57
107
|
return ctx.actingOrgId;
|
|
58
108
|
}
|
|
59
|
-
//# sourceMappingURL=context.js.map
|
package/dist/data/index.d.ts
CHANGED
package/dist/data/index.js
CHANGED
package/dist/data/interface.d.ts
CHANGED
package/dist/data/interface.js
CHANGED
|
@@ -2,8 +2,7 @@ export type { DefinitionFileExt, DefinitionListItem, DefinitionRecord, Definitio
|
|
|
2
2
|
export { toDefinitionListItem } from './types.js';
|
|
3
3
|
export type { IDefinitionStore } from './interface.js';
|
|
4
4
|
export type { UISchema } from '@selvajs/schemas';
|
|
5
|
-
export { GH_EXTENSIONS,
|
|
5
|
+
export { GH_EXTENSIONS, COVER_IMAGE_CONTENT_TYPES } from './types.js';
|
|
6
6
|
export { definitionPaths } from './paths.js';
|
|
7
7
|
export type { UpdateMetadataInput } from './schemas.js';
|
|
8
|
-
export {
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
8
|
+
export { PublishVersionInputSchema, CreateDefinitionInputSchema, UpdateMetadataInputSchema, GuidSchema, toSourceDocumentId } from './schemas.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { toDefinitionListItem } from './types.js';
|
|
2
|
-
export { GH_EXTENSIONS,
|
|
2
|
+
export { GH_EXTENSIONS, COVER_IMAGE_CONTENT_TYPES } from './types.js';
|
|
3
3
|
export { definitionPaths } from './paths.js';
|
|
4
|
-
export {
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
4
|
+
export { PublishVersionInputSchema, CreateDefinitionInputSchema, UpdateMetadataInputSchema, GuidSchema, toSourceDocumentId } from './schemas.js';
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Path-segment safety check. Blocks traversal, separators, NUL, and empty
|
|
3
|
-
* segments. Allowed alphabet `[A-Za-z0-9._-]+` covers GUIDs and sanitized
|
|
4
|
-
* refs. Called by every helper so a malicious `guid` can't escape the
|
|
5
|
-
* `definitions/` prefix.
|
|
6
|
-
*/
|
|
7
|
-
function assertSafeKey(value, label) {
|
|
8
|
-
if (!value || !/^[A-Za-z0-9._-]+$/.test(value) || value === '.' || value === '..') {
|
|
9
|
-
throw new Error(`Unsafe ${label}: ${JSON.stringify(value)}`);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
import { assertSafeKey } from '../storage/safeKey.js';
|
|
12
2
|
export const definitionPaths = {
|
|
13
3
|
version: (guid, versionNumber, ext) => {
|
|
14
4
|
assertSafeKey(guid, 'guid');
|
|
@@ -26,4 +16,3 @@ export const definitionPaths = {
|
|
|
26
16
|
return `definitions/${guid}/`;
|
|
27
17
|
}
|
|
28
18
|
};
|
|
29
|
-
//# sourceMappingURL=paths.js.map
|
|
@@ -8,26 +8,6 @@ export declare const DefinitionStatusSchema: z.ZodEnum<{
|
|
|
8
8
|
published: "published";
|
|
9
9
|
archived: "archived";
|
|
10
10
|
}>;
|
|
11
|
-
export declare const DefinitionFileExtSchema: z.ZodEnum<{
|
|
12
|
-
gh: "gh";
|
|
13
|
-
ghx: "ghx";
|
|
14
|
-
}>;
|
|
15
|
-
export declare const DefinitionVersionSchema: z.ZodObject<{
|
|
16
|
-
id: z.ZodString;
|
|
17
|
-
definitionId: z.ZodString;
|
|
18
|
-
versionNumber: z.ZodNumber;
|
|
19
|
-
fileExt: z.ZodEnum<{
|
|
20
|
-
gh: "gh";
|
|
21
|
-
ghx: "ghx";
|
|
22
|
-
}>;
|
|
23
|
-
fileKey: z.ZodString;
|
|
24
|
-
originalFilename: z.ZodOptional<z.ZodString>;
|
|
25
|
-
uploadedBy: z.ZodString;
|
|
26
|
-
uploadedAt: z.ZodString;
|
|
27
|
-
changeNote: z.ZodOptional<z.ZodString>;
|
|
28
|
-
schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
29
|
-
schemaExtractedAt: z.ZodOptional<z.ZodString>;
|
|
30
|
-
}, z.core.$strip>;
|
|
31
11
|
export declare const DefinitionChannelSchema: z.ZodEnum<{
|
|
32
12
|
draft: "draft";
|
|
33
13
|
live: "live";
|
|
@@ -68,4 +48,3 @@ export type UpdateMetadataInput = z.infer<typeof UpdateMetadataInputSchema>;
|
|
|
68
48
|
export declare const PublishVersionInputSchema: z.ZodDefault<z.ZodObject<{
|
|
69
49
|
versionId: z.ZodOptional<z.ZodString>;
|
|
70
50
|
}, z.core.$strip>>;
|
|
71
|
-
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -4,7 +4,10 @@ export const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9
|
|
|
4
4
|
// regex is what keeps `__proto__` and `constructor` out of a key position.
|
|
5
5
|
// Relaxing it to a looser string re-opens prototype pollution in every store
|
|
6
6
|
// that does `config.definitions[guid]`.
|
|
7
|
-
|
|
7
|
+
//
|
|
8
|
+
// Lowercases because local keys by raw string while Postgres compares `uuid`
|
|
9
|
+
// columns case-insensitively, so one GUID in two cases is two records on local.
|
|
10
|
+
export const GuidSchema = z.string().toLowerCase().regex(UUID_REGEX, 'Invalid GUID format');
|
|
8
11
|
/** A Grasshopper document GUID as stores keep and compare it (lowercase), or null for anything else. */
|
|
9
12
|
export function toSourceDocumentId(value) {
|
|
10
13
|
return typeof value === 'string' && UUID_REGEX.test(value) ? value.toLowerCase() : null;
|
|
@@ -13,25 +16,10 @@ export function toSourceDocumentId(value) {
|
|
|
13
16
|
// create-internal state `DefinitionService.create` writes during the
|
|
14
17
|
// metadata-first window, and a client must never hand-set it through an update.
|
|
15
18
|
export const DefinitionStatusSchema = z.enum(['draft', 'published', 'archived']);
|
|
16
|
-
export const DefinitionFileExtSchema = z.enum(['gh', 'ghx']);
|
|
17
|
-
export const DefinitionVersionSchema = z.object({
|
|
18
|
-
id: GuidSchema,
|
|
19
|
-
definitionId: GuidSchema,
|
|
20
|
-
versionNumber: z.number().int().min(1),
|
|
21
|
-
fileExt: DefinitionFileExtSchema,
|
|
22
|
-
fileKey: z.string().min(1),
|
|
23
|
-
originalFilename: z.string().max(256).optional(),
|
|
24
|
-
uploadedBy: z.string().min(1),
|
|
25
|
-
uploadedAt: z.string(),
|
|
26
|
-
changeNote: z.string().max(1000).optional(),
|
|
27
|
-
// Rhino.Compute validates structural correctness at upload; this only asserts it's an object.
|
|
28
|
-
schema: z.record(z.string(), z.unknown()).optional(),
|
|
29
|
-
schemaExtractedAt: z.string().optional()
|
|
30
|
-
});
|
|
31
19
|
export const DefinitionChannelSchema = z.enum(['live', 'draft']);
|
|
32
20
|
/** HTTP-body validator for new-definition input. */
|
|
33
21
|
export const CreateDefinitionInputSchema = z.object({
|
|
34
|
-
displayName: z.string().min(1, 'Display name is required').max(256),
|
|
22
|
+
displayName: z.string().trim().min(1, 'Display name is required').max(256),
|
|
35
23
|
description: z.string().max(2000).optional(),
|
|
36
24
|
coverImage: z.string().max(2048).optional(),
|
|
37
25
|
category: z.string().max(128).optional(),
|
|
@@ -46,7 +34,7 @@ export const CreateDefinitionInputSchema = z.object({
|
|
|
46
34
|
* - value — set
|
|
47
35
|
*/
|
|
48
36
|
export const UpdateMetadataInputSchema = z.object({
|
|
49
|
-
displayName: z.string().min(1, 'Display name is required').max(256).optional(),
|
|
37
|
+
displayName: z.string().trim().min(1, 'Display name is required').max(256).optional(),
|
|
50
38
|
description: z.string().max(2000).nullable().optional(),
|
|
51
39
|
coverImage: z.string().max(2048).nullable().optional(),
|
|
52
40
|
category: z.string().max(128).nullable().optional(),
|
|
@@ -64,4 +52,3 @@ export const PublishVersionInputSchema = z
|
|
|
64
52
|
versionId: GuidSchema.optional()
|
|
65
53
|
})
|
|
66
54
|
.default({});
|
|
67
|
-
//# sourceMappingURL=schemas.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { UISchema } from '@selvajs/schemas';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { DefinitionChannelSchema } from './schemas.js';
|
|
2
4
|
export type DefinitionFileExt = 'gh' | 'ghx';
|
|
3
5
|
export declare const GH_EXTENSIONS: string[];
|
|
4
|
-
export declare const COVER_IMAGE_EXTENSIONS: string[];
|
|
5
|
-
export declare const ALLOWED_UPLOAD_EXTENSIONS: string[];
|
|
6
6
|
export declare const COVER_IMAGE_CONTENT_TYPES: Record<string, string>;
|
|
7
7
|
/**
|
|
8
8
|
* - `pending` — internal: metadata written, blob upload may be in flight.
|
|
@@ -142,5 +142,4 @@ export interface DefinitionRecordPatch {
|
|
|
142
142
|
ownerId?: string;
|
|
143
143
|
sourceDocumentId?: string | null;
|
|
144
144
|
}
|
|
145
|
-
export type DefinitionChannel =
|
|
146
|
-
//# sourceMappingURL=types.d.ts.map
|
|
145
|
+
export type DefinitionChannel = z.infer<typeof DefinitionChannelSchema>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export const GH_EXTENSIONS = ['.gh', '.ghx'];
|
|
2
|
-
export const COVER_IMAGE_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.webp', '.gif'];
|
|
3
|
-
export const ALLOWED_UPLOAD_EXTENSIONS = [...GH_EXTENSIONS, ...COVER_IMAGE_EXTENSIONS];
|
|
4
2
|
export const COVER_IMAGE_CONTENT_TYPES = {
|
|
5
3
|
'.jpg': 'image/jpeg',
|
|
6
4
|
'.jpeg': 'image/jpeg',
|
|
@@ -24,4 +22,3 @@ export function toDefinitionListItem(r) {
|
|
|
24
22
|
updatedAt: r.updatedAt
|
|
25
23
|
};
|
|
26
24
|
}
|
|
27
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Structured context attached to a reported error. All fields optional — a
|
|
3
3
|
* report can fire before any request context is built (e.g. an
|
|
4
4
|
* `unhandledRejection` with no active request). Deliberately NOT a
|
|
5
|
-
* `RequestContext`: reporters must never receive the opaque `
|
|
5
|
+
* `RequestContext`: reporters must never receive the opaque `adapterContext`, so
|
|
6
6
|
* only non-sensitive routing/identity fields are surfaced here.
|
|
7
7
|
*/
|
|
8
8
|
export interface ErrorContext {
|
|
@@ -37,4 +37,3 @@ export interface IErrorReporter {
|
|
|
37
37
|
export declare class NoopErrorReporter implements IErrorReporter {
|
|
38
38
|
capture(_error: unknown, _context?: ErrorContext): void;
|
|
39
39
|
}
|
|
40
|
-
//# sourceMappingURL=interface.d.ts.map
|
package/dist/errors/interface.js
CHANGED
package/dist/errors.d.ts
CHANGED
|
@@ -2,8 +2,15 @@
|
|
|
2
2
|
* Thrown by providers to signal an expected failure the API layer forwards with
|
|
3
3
|
* a specific status. Unknown errors should propagate as plain `Error` and become 500s.
|
|
4
4
|
*/
|
|
5
|
+
declare const BRAND: unique symbol;
|
|
5
6
|
export declare class ProviderError extends Error {
|
|
6
7
|
readonly statusCode: number;
|
|
8
|
+
readonly [BRAND] = true;
|
|
9
|
+
/**
|
|
10
|
+
* Providers depend on this package, so a version mismatch installs two copies
|
|
11
|
+
* and plain `instanceof` would turn a 403 from one into a 500 in the other.
|
|
12
|
+
*/
|
|
13
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
7
14
|
constructor(message: string, statusCode?: number);
|
|
8
15
|
}
|
|
9
|
-
|
|
16
|
+
export {};
|
package/dist/errors.js
CHANGED
|
@@ -2,12 +2,22 @@
|
|
|
2
2
|
* Thrown by providers to signal an expected failure the API layer forwards with
|
|
3
3
|
* a specific status. Unknown errors should propagate as plain `Error` and become 500s.
|
|
4
4
|
*/
|
|
5
|
+
const BRAND = Symbol.for('@selvajs/platform/ProviderError');
|
|
5
6
|
export class ProviderError extends Error {
|
|
6
7
|
statusCode;
|
|
8
|
+
[BRAND] = true;
|
|
9
|
+
/**
|
|
10
|
+
* Providers depend on this package, so a version mismatch installs two copies
|
|
11
|
+
* and plain `instanceof` would turn a 403 from one into a 500 in the other.
|
|
12
|
+
*/
|
|
13
|
+
static [Symbol.hasInstance](value) {
|
|
14
|
+
if (this !== ProviderError)
|
|
15
|
+
return Function.prototype[Symbol.hasInstance].call(this, value);
|
|
16
|
+
return typeof value === 'object' && value !== null && BRAND in value;
|
|
17
|
+
}
|
|
7
18
|
constructor(message, statusCode = 400) {
|
|
8
19
|
super(message);
|
|
9
20
|
this.name = 'ProviderError';
|
|
10
21
|
this.statusCode = statusCode;
|
|
11
22
|
}
|
|
12
23
|
}
|
|
13
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/events/audit.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface AuditQueryFilters {
|
|
|
34
34
|
/** Inclusive bounds, ISO 8601. */
|
|
35
35
|
sinceIso?: string;
|
|
36
36
|
untilIso?: string;
|
|
37
|
-
/** Implementations clamp to
|
|
37
|
+
/** Implementations clamp to at least 1 and at most 200. */
|
|
38
38
|
limit?: number;
|
|
39
39
|
cursor?: AuditCursor;
|
|
40
40
|
}
|
|
@@ -46,4 +46,3 @@ export interface AuditQueryResult {
|
|
|
46
46
|
export interface IAuditQuery {
|
|
47
47
|
list(ctx: RequestContext, filters: AuditQueryFilters): Promise<AuditQueryResult>;
|
|
48
48
|
}
|
|
49
|
-
//# sourceMappingURL=audit.d.ts.map
|
package/dist/events/audit.js
CHANGED
package/dist/events/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export type { DomainEvent, DomainEventType, IEventSink } from './interface.js';
|
|
2
2
|
export { actorFrom, actorOf, NoopEventSink, AUDIT_EVENT_VERSION } from './interface.js';
|
|
3
3
|
export type { AuditEventRow, AuditCursor, AuditQueryFilters, AuditQueryResult, IAuditQuery } from './audit.js';
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/events/index.js
CHANGED
package/dist/events/interface.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,58 +1,20 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export type { Project, ProjectMember } from './projects/types.js';
|
|
19
|
-
export type { IProjectStore } from './projects/interface.js';
|
|
20
|
-
export type { ProjectVisibility, ProjectRole } from './projects/schemas.js';
|
|
21
|
-
export { ProjectVisibilitySchema, ProjectRoleSchema, validateProjectFlags } from './projects/schemas.js';
|
|
22
|
-
export type { PlatformProjectGrant, PlatformProjectGranteeType } from './platformProjects/types.js';
|
|
23
|
-
export type { IPlatformProjectGrantStore } from './platformProjects/interface.js';
|
|
24
|
-
export { PlatformProjectGrantSchema, PlatformProjectGranteeTypeSchema } from './platformProjects/schemas.js';
|
|
25
|
-
export type { DefinitionFileExt, DefinitionListItem, DefinitionRecord, DefinitionRecordPatch, DefinitionStatus, DefinitionVersion, DefinitionChannel } from './definitions/types.js';
|
|
26
|
-
export type { IDefinitionStore } from './definitions/interface.js';
|
|
27
|
-
export type { UISchema } from '@selvajs/schemas';
|
|
28
|
-
export { GH_EXTENSIONS, COVER_IMAGE_EXTENSIONS, ALLOWED_UPLOAD_EXTENSIONS, COVER_IMAGE_CONTENT_TYPES, toDefinitionListItem } from './definitions/types.js';
|
|
29
|
-
export { definitionPaths } from './definitions/paths.js';
|
|
30
|
-
export type { UpdateMetadataInput } from './definitions/schemas.js';
|
|
31
|
-
export { DefinitionChannelSchema, PublishVersionInputSchema, CreateDefinitionInputSchema, UpdateMetadataInputSchema, GuidSchema, UUID_REGEX, toSourceDocumentId } from './definitions/schemas.js';
|
|
32
|
-
export type { OrgShareLink, ShareLink } from './shareLinks/types.js';
|
|
33
|
-
export type { IShareLinkStore } from './shareLinks/interface.js';
|
|
34
|
-
export { DEFAULT_SHARE_LINK_MAX_SOLVES } from './shareLinks/types.js';
|
|
35
|
-
export type { CreateShareLinkInput } from './shareLinks/schemas.js';
|
|
36
|
-
export { CreateShareLinkInputSchema } from './shareLinks/schemas.js';
|
|
37
|
-
export type { IStorageProvider } from './storage/interface.js';
|
|
38
|
-
export { IMAGE_MAX_WIDTH, IMAGE_WEBP_QUALITY, isImageUpload, toWebpPath, transcodeImageIfNeeded } from './storage/image.js';
|
|
39
|
-
export type { TranscodeResult } from './storage/image.js';
|
|
40
|
-
export { ASSET_CLASSES, classifyAssetPath, isPublicAssetPath } from './storage/assetClasses.js';
|
|
41
|
-
export type { AssetVisibility, AssetScope, AssetClass, AssetMatch } from './storage/assetClasses.js';
|
|
42
|
-
export { withCacheBust } from './storage/cacheBust.js';
|
|
43
|
-
export type { IDataProvider, SchemaVersionReport, UserErasureOptions } from './data/interface.js';
|
|
44
|
-
export { ERASED_ACTOR_ID } from './data/interface.js';
|
|
45
|
-
export type { ComputeServerConfig, ComputeConfig, PlatformComputeServer, OrgComputeServer } from './computeServer/types.js';
|
|
46
|
-
export { isPlatformServer, isOrgServer } from './computeServer/types.js';
|
|
47
|
-
export type { IComputeServerStore, GetConfigOptions } from './computeServer/interface.js';
|
|
48
|
-
export type { SecretVerificationReport, SecretVerificationFailure, SecretVerificationFailureReason } from './computeServer/secrets.js';
|
|
49
|
-
export type { ResolveOptions } from './computeServer/utils.js';
|
|
50
|
-
export { serversVisibleTo, defaultServerIdFor, resolveServerForOrg, findServerById, platformServers, orgServersFor, scopeConfigToOrg } from './computeServer/utils.js';
|
|
51
|
-
export type { ProjectAccessInput, DefinitionAccessInput, VisibilityChangeInput, ReclaimAccessInput, CreateProjectAccessInput, OrgOwnerAuthorityInput, OwnerRemovalInput, OwnerRemovalCheck } from './access/rules.js';
|
|
52
|
-
export { canView, canSolve, canEdit, canCreateDefinition, canManage, canEditProjectSettings, canChangeVisibilityToPublic, canEditDefinition, canReclaim, canCreateProject, canChangeOrgRole, checkOwnerRemoval, withAdminBypass } from './access/rules.js';
|
|
53
|
-
export type { DomainEvent, DomainEventType, IEventSink } from './events/interface.js';
|
|
54
|
-
export { actorFrom, actorOf, NoopEventSink, AUDIT_EVENT_VERSION } from './events/interface.js';
|
|
55
|
-
export type { AuditEventRow, AuditCursor, AuditQueryFilters, AuditQueryResult, IAuditQuery } from './events/audit.js';
|
|
1
|
+
export * from './access/index.js';
|
|
2
|
+
export * from './apiTokens/index.js';
|
|
3
|
+
export * from './auth/index.js';
|
|
4
|
+
export * from './computeServer/public.js';
|
|
5
|
+
export * from './data/index.js';
|
|
6
|
+
export * from './definitions/index.js';
|
|
7
|
+
export * from './events/index.js';
|
|
8
|
+
export * from './invites/index.js';
|
|
9
|
+
export * from './notifications/index.js';
|
|
10
|
+
export * from './organizations/index.js';
|
|
11
|
+
export * from './permissions/index.js';
|
|
12
|
+
export * from './platformProjects/index.js';
|
|
13
|
+
export * from './projects/index.js';
|
|
14
|
+
export * from './shareLinks/index.js';
|
|
15
|
+
export * from './storage/index.js';
|
|
16
|
+
export * from './userProfile/index.js';
|
|
17
|
+
export * from './utils/index.js';
|
|
56
18
|
export type { ISolveMetricSink, SolveMetric, SolveFailureKind } from './metrics/interface.js';
|
|
57
19
|
export { NoopSolveMetricSink } from './metrics/interface.js';
|
|
58
20
|
export type { ISolveResultCache, SolveCacheKey, SolveCacheSetOptions } from './solveCache/interface.js';
|
|
@@ -61,17 +23,12 @@ export type { IErrorReporter, ErrorContext } from './errors/interface.js';
|
|
|
61
23
|
export { NoopErrorReporter } from './errors/interface.js';
|
|
62
24
|
export type { ILogger, LogFields, LogLevel } from './logging/interface.js';
|
|
63
25
|
export { NoopLogger } from './logging/interface.js';
|
|
64
|
-
export type { INotificationProvider, NotificationKind, OutboundMessage, SendResult } from './notifications/index.js';
|
|
65
|
-
export { NoopNotificationProvider } from './notifications/index.js';
|
|
66
26
|
export type { IBindingResolver } from './bindings/interface.js';
|
|
67
27
|
export { NoopBindingResolver } from './bindings/interface.js';
|
|
68
|
-
export type { AuditUpdate, AuditSoftDelete } from './utils/audit.js';
|
|
69
|
-
export { auditUpdate, auditSoftDelete } from './utils/audit.js';
|
|
70
28
|
export type { RequestContext } from './context.js';
|
|
71
29
|
export { SYSTEM_CONTEXT, hasPermission, requireActingOrg, isShareContext, assertNotShareContext } from './context.js';
|
|
72
30
|
export type { ListOptions, DefinitionListOptions, Page } from './pagination.js';
|
|
73
|
-
export { DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT } from './pagination.js';
|
|
31
|
+
export { DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT, clampPageLimit, decodeOffsetCursor, encodeOffsetCursor, listAll, walkPages } from './pagination.js';
|
|
74
32
|
export type { TenancyMode, SelvaFlags, SelvaBranding, SelvaConfig, SelvaConfigFactory } from './config.js';
|
|
75
33
|
export { isFlagEnabled, defineConfig } from './config.js';
|
|
76
34
|
export { ProviderError } from './errors.js';
|
|
77
|
-
//# sourceMappingURL=index.d.ts.map
|