@selvajs/platform 0.21.0-beta.2 → 1.0.0-beta.4
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 +10 -7
- package/dist/access/index.d.ts +1 -2
- package/dist/access/index.js +1 -2
- package/dist/access/rules.d.ts +11 -12
- package/dist/access/rules.js +27 -23
- package/dist/apiTokens/index.d.ts +2 -3
- package/dist/apiTokens/index.js +2 -3
- package/dist/apiTokens/interface.d.ts +0 -1
- package/dist/apiTokens/interface.js +0 -1
- package/dist/apiTokens/scope.d.ts +3 -2
- package/dist/apiTokens/scope.js +9 -5
- package/dist/apiTokens/types.d.ts +7 -2
- package/dist/apiTokens/types.js +10 -5
- 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 +12 -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 +2 -21
- package/dist/definitions/schemas.js +10 -19
- package/dist/definitions/types.d.ts +12 -4
- package/dist/definitions/types.js +1 -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 +11 -3
- package/dist/pagination.js +15 -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 +48 -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
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 } 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, 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 } 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
|
package/dist/index.js
CHANGED
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
// @selvajs/platform — published API contract. Every symbol here is breaking-change-protected.
|
|
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
|
|
19
|
-
export { serversVisibleTo, defaultServerIdFor, resolveServerForOrg, findServerById, platformServers, orgServersFor, scopeConfigToOrg } from './computeServer/utils.js';
|
|
20
|
-
export { canView, canSolve, canEdit, canManage, canEditProjectSettings, canChangeVisibilityToPublic, canEditDefinition, canReclaim, canCreateProject, canChangeOrgRole, checkOwnerRemoval, withAdminBypass } from './access/rules.js';
|
|
21
|
-
export { actorFrom, actorOf, NoopEventSink, AUDIT_EVENT_VERSION } from './events/interface.js';
|
|
2
|
+
export * from './access/index.js';
|
|
3
|
+
export * from './apiTokens/index.js';
|
|
4
|
+
export * from './auth/index.js';
|
|
5
|
+
export * from './computeServer/public.js';
|
|
6
|
+
export * from './data/index.js';
|
|
7
|
+
export * from './definitions/index.js';
|
|
8
|
+
export * from './events/index.js';
|
|
9
|
+
export * from './invites/index.js';
|
|
10
|
+
export * from './notifications/index.js';
|
|
11
|
+
export * from './organizations/index.js';
|
|
12
|
+
export * from './permissions/index.js';
|
|
13
|
+
export * from './platformProjects/index.js';
|
|
14
|
+
export * from './projects/index.js';
|
|
15
|
+
export * from './shareLinks/index.js';
|
|
16
|
+
export * from './storage/index.js';
|
|
17
|
+
export * from './userProfile/index.js';
|
|
18
|
+
export * from './utils/index.js';
|
|
22
19
|
export { NoopSolveMetricSink } from './metrics/interface.js';
|
|
23
20
|
export { NoopSolveResultCache } from './solveCache/interface.js';
|
|
24
21
|
export { NoopErrorReporter } from './errors/interface.js';
|
|
25
22
|
export { NoopLogger } from './logging/interface.js';
|
|
26
|
-
export { NoopNotificationProvider } from './notifications/index.js';
|
|
27
23
|
export { NoopBindingResolver } from './bindings/interface.js';
|
|
28
|
-
export { auditUpdate, auditSoftDelete } from './utils/audit.js';
|
|
29
24
|
export { SYSTEM_CONTEXT, hasPermission, requireActingOrg, isShareContext, assertNotShareContext } from './context.js';
|
|
30
|
-
export { DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT } from './pagination.js';
|
|
25
|
+
export { DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT, clampPageLimit, decodeOffsetCursor, encodeOffsetCursor } from './pagination.js';
|
|
31
26
|
export { isFlagEnabled, defineConfig } from './config.js';
|
|
32
27
|
export { ProviderError } from './errors.js';
|
|
33
|
-
//# sourceMappingURL=index.js.map
|
package/dist/invites/index.d.ts
CHANGED
package/dist/invites/index.js
CHANGED
|
@@ -18,7 +18,8 @@ export interface IInviteStore {
|
|
|
18
18
|
getByTokenHash(ctx: RequestContext, tokenHash: string): Promise<Invite | null>;
|
|
19
19
|
listByOrg(ctx: RequestContext, orgId: string, opts?: ListOptions): Promise<Page<Invite>>;
|
|
20
20
|
/** No-op if already accepted. */
|
|
21
|
-
|
|
21
|
+
/** True if this call accepted the invite, false if it was already accepted or is gone. */
|
|
22
|
+
markAccepted(ctx: RequestContext, id: string, userId: string): Promise<boolean>;
|
|
22
23
|
/** No-op if already consumed or missing. */
|
|
23
24
|
revoke(ctx: RequestContext, id: string): Promise<void>;
|
|
24
25
|
/**
|
|
@@ -26,10 +27,9 @@ export interface IInviteStore {
|
|
|
26
27
|
* revoked. Accepted invites are left alone — consuming one is history, not
|
|
27
28
|
* a live grant.
|
|
28
29
|
*
|
|
29
|
-
* Offboarding needs this: `removeOrgMember`
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* rather than user id is deliberate — an invite names an address, and the
|
|
30
|
+
* Offboarding needs this: `removeOrgMember` does not touch invites, so a
|
|
31
|
+
* dormant invite would let a removed user walk back in at their original role
|
|
32
|
+
* for the rest of its TTL. Matching by email rather than user id is deliberate — an invite names an address, and the
|
|
33
33
|
* account it will create may not exist yet.
|
|
34
34
|
*
|
|
35
35
|
* One call rather than list-then-revoke-each: the loop would race a
|
|
@@ -39,4 +39,3 @@ export interface IInviteStore {
|
|
|
39
39
|
/** Called from the `deleteOrg` cascade — invites to a deleted org are unredeemable orphans otherwise. */
|
|
40
40
|
deleteByOrg(ctx: RequestContext, orgId: string): Promise<void>;
|
|
41
41
|
}
|
|
42
|
-
//# sourceMappingURL=interface.d.ts.map
|
package/dist/invites/types.d.ts
CHANGED
package/dist/invites/types.js
CHANGED
|
@@ -35,12 +35,10 @@ export interface INotificationProvider {
|
|
|
35
35
|
* Default `INotificationProvider` — sends nothing, reports `not-configured`.
|
|
36
36
|
*
|
|
37
37
|
* Mail is optional in every deployment, so this is a supported wiring rather
|
|
38
|
-
* than a test double: callers already handle `not-configured` as "no mail"
|
|
39
|
-
* which keeps the no-SMTP path identical to the pre-notification behaviour.
|
|
38
|
+
* than a test double: callers already handle `not-configured` as "no mail".
|
|
40
39
|
*/
|
|
41
40
|
export declare class NoopNotificationProvider implements INotificationProvider {
|
|
42
41
|
readonly name = "None";
|
|
43
42
|
send(_message: OutboundMessage, _log?: ILogger): Promise<SendResult>;
|
|
44
43
|
isConfigured(): boolean;
|
|
45
44
|
}
|
|
46
|
-
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Default `INotificationProvider` — sends nothing, reports `not-configured`.
|
|
3
3
|
*
|
|
4
4
|
* Mail is optional in every deployment, so this is a supported wiring rather
|
|
5
|
-
* than a test double: callers already handle `not-configured` as "no mail"
|
|
6
|
-
* which keeps the no-SMTP path identical to the pre-notification behaviour.
|
|
5
|
+
* than a test double: callers already handle `not-configured` as "no mail".
|
|
7
6
|
*/
|
|
8
7
|
export class NoopNotificationProvider {
|
|
9
8
|
name = 'None';
|
|
@@ -14,4 +13,3 @@ export class NoopNotificationProvider {
|
|
|
14
13
|
return false;
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
|
-
//# sourceMappingURL=interface.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export type { Organization, OrgMember, OrgAssets } from './types.js';
|
|
2
2
|
export type { IOrgStore } from './interface.js';
|
|
3
3
|
export { orgPaths } from './paths.js';
|
|
4
|
-
export type { OrgRole, OrgPermission, OrgAssetKind
|
|
5
|
-
export { OrgRoleSchema, OrgPermissionSchema, OrgAssetKindSchema,
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
4
|
+
export type { OrgRole, OrgPermission, OrgAssetKind } from './schemas.js';
|
|
5
|
+
export { OrgRoleSchema, OrgPermissionSchema, OrgAssetKindSchema, SlugSchema, slugify, RESERVED_SLUGS, orgSlugFromName, CreateOrgSchema, UpdateOrgSchema, ALL_ORG_PERMISSIONS, DEFAULT_ORG_PERMISSIONS, OWNER_ADMIN_ONLY_PERMISSIONS, MEMBER_ASSIGNABLE_PERMISSIONS } from './schemas.js';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export { orgPaths } from './paths.js';
|
|
2
|
-
export { OrgRoleSchema, OrgPermissionSchema, OrgAssetKindSchema,
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
|
2
|
+
export { OrgRoleSchema, OrgPermissionSchema, OrgAssetKindSchema, SlugSchema, slugify, RESERVED_SLUGS, orgSlugFromName, CreateOrgSchema, UpdateOrgSchema, ALL_ORG_PERMISSIONS, DEFAULT_ORG_PERMISSIONS, OWNER_ADMIN_ONLY_PERMISSIONS, MEMBER_ASSIGNABLE_PERMISSIONS } from './schemas.js';
|
|
@@ -13,10 +13,9 @@ export interface IOrgStore {
|
|
|
13
13
|
createOrg(ctx: RequestContext, org: Organization): Promise<void>;
|
|
14
14
|
updateOrg(ctx: RequestContext, id: string, patch: Partial<Pick<Organization, 'name' | 'slug' | 'assets'>>): Promise<void>;
|
|
15
15
|
/**
|
|
16
|
-
* Soft-deletes the org, cascading to org members, projects, and
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* those up explicitly if needed.
|
|
16
|
+
* Soft-deletes the org, cascading to org members, projects, project members and
|
|
17
|
+
* definitions. Share links die with their definition. Hard-deletes its invites,
|
|
18
|
+
* API tokens, compute servers and compute defaults.
|
|
20
19
|
*/
|
|
21
20
|
deleteOrg(ctx: RequestContext, id: string): Promise<void>;
|
|
22
21
|
listOrgMembers(ctx: RequestContext, orgId: string, opts?: ListOptions): Promise<Page<OrgMember>>;
|
|
@@ -47,4 +46,3 @@ export interface IOrgStore {
|
|
|
47
46
|
updateOrgMemberPermissions(ctx: RequestContext, orgId: string, userId: string, permissions: readonly OrgPermission[]): Promise<void>;
|
|
48
47
|
removeOrgMember(ctx: RequestContext, orgId: string, userId: string): Promise<void>;
|
|
49
48
|
}
|
|
50
|
-
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -6,14 +6,9 @@ import type { OrgAssetKind } from './schemas.js';
|
|
|
6
6
|
*
|
|
7
7
|
* Branding lives under `orgs/{id}/branding/` because it's a *public* asset
|
|
8
8
|
* class — anyone, including logged-out viewers, may read a company logo.
|
|
9
|
-
*
|
|
10
|
-
* `classifyAssetPath` / `ASSET_CLASSES` decide public-vs-private from these
|
|
11
|
-
* prefixes.
|
|
9
|
+
* `classifyAssetPath` / `ASSET_CLASSES` decide visibility from these prefixes.
|
|
12
10
|
*/
|
|
13
11
|
export declare const orgPaths: {
|
|
14
12
|
readonly asset: (id: string, kind: OrgAssetKind) => string;
|
|
15
|
-
/** Members-only blob; `name` includes the extension. */
|
|
16
|
-
readonly privateAsset: (id: string, name: string) => string;
|
|
17
13
|
readonly prefix: (id: string) => string;
|
|
18
14
|
};
|
|
19
|
-
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Blocks path traversal, separators, and empty segments. Called by every
|
|
3
|
-
* helper below so a malicious `id` can't escape the `orgs/` prefix.
|
|
4
|
-
*/
|
|
5
|
-
function assertSafeKey(value, label) {
|
|
6
|
-
// The regex alone allows '.' and '..' — both fully match the allowed alphabet — so they need an explicit check.
|
|
7
|
-
if (!value || !/^[A-Za-z0-9._-]+$/.test(value) || value === '.' || value === '..') {
|
|
8
|
-
throw new Error(`Unsafe ${label}: ${JSON.stringify(value)}`);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
import { assertSafeKey } from '../storage/safeKey.js';
|
|
11
2
|
/**
|
|
12
3
|
* Every branding asset is stored as `.webp` (uploads go through the shared
|
|
13
4
|
* transcoder), so the path per kind is fixed and a re-upload overwrites in
|
|
@@ -15,9 +6,7 @@ function assertSafeKey(value, label) {
|
|
|
15
6
|
*
|
|
16
7
|
* Branding lives under `orgs/{id}/branding/` because it's a *public* asset
|
|
17
8
|
* class — anyone, including logged-out viewers, may read a company logo.
|
|
18
|
-
*
|
|
19
|
-
* `classifyAssetPath` / `ASSET_CLASSES` decide public-vs-private from these
|
|
20
|
-
* prefixes.
|
|
9
|
+
* `classifyAssetPath` / `ASSET_CLASSES` decide visibility from these prefixes.
|
|
21
10
|
*/
|
|
22
11
|
export const orgPaths = {
|
|
23
12
|
asset: (id, kind) => {
|
|
@@ -25,15 +14,8 @@ export const orgPaths = {
|
|
|
25
14
|
assertSafeKey(kind, 'assetKind');
|
|
26
15
|
return `orgs/${id}/branding/${kind}.webp`;
|
|
27
16
|
},
|
|
28
|
-
/** Members-only blob; `name` includes the extension. */
|
|
29
|
-
privateAsset: (id, name) => {
|
|
30
|
-
assertSafeKey(id, 'orgId');
|
|
31
|
-
assertSafeKey(name, 'assetName');
|
|
32
|
-
return `orgs/${id}/private/${name}`;
|
|
33
|
-
},
|
|
34
17
|
prefix: (id) => {
|
|
35
18
|
assertSafeKey(id, 'orgId');
|
|
36
19
|
return `orgs/${id}/`;
|
|
37
20
|
}
|
|
38
21
|
};
|
|
39
|
-
//# sourceMappingURL=paths.js.map
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* Top-level path segments a tenant slug must never equal, so a slug can never
|
|
4
|
-
* shadow (or be shadowed by) a route. `/o/{slug}/`
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* collision-free before any external link is minted against a slug.
|
|
8
|
-
* Lowercase; matching is case-insensitive so `Admin` can't slip through. Keep
|
|
9
|
-
* in sync with the route tree's top-level directories.
|
|
4
|
+
* shadow (or be shadowed by) a route. `o` is reserved for `/o/{slug}/` even though
|
|
5
|
+
* the length gate below already makes a 1-char slug impossible.
|
|
6
|
+
* `reserved-slugs.test.ts` in the selva app holds this to the route tree.
|
|
10
7
|
*/
|
|
11
8
|
export declare const RESERVED_SLUGS: readonly string[];
|
|
12
9
|
/**
|
|
@@ -15,6 +12,8 @@ export declare const RESERVED_SLUGS: readonly string[];
|
|
|
15
12
|
* untouched — run the result through `SlugSchema` where validity matters.
|
|
16
13
|
*/
|
|
17
14
|
export declare function slugify(name: string): string;
|
|
15
|
+
/** A slug for an org named without a slug of its own. Always passes `SlugSchema`. */
|
|
16
|
+
export declare function orgSlugFromName(name: string, fallback?: string): string;
|
|
18
17
|
/** Lowercase alphanumeric with internal hyphens, 3–63 chars, not a reserved word. */
|
|
19
18
|
export declare const SlugSchema: z.ZodString;
|
|
20
19
|
export declare const OrgRoleSchema: z.ZodEnum<{
|
|
@@ -54,4 +53,3 @@ export declare const UpdateOrgSchema: z.ZodObject<{
|
|
|
54
53
|
}, z.core.$strip>;
|
|
55
54
|
export type CreateOrgInput = z.infer<typeof CreateOrgSchema>;
|
|
56
55
|
export type UpdateOrgInput = z.infer<typeof UpdateOrgSchema>;
|
|
57
|
-
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* Top-level path segments a tenant slug must never equal, so a slug can never
|
|
4
|
-
* shadow (or be shadowed by) a route. `/o/{slug}/`
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* collision-free before any external link is minted against a slug.
|
|
8
|
-
* Lowercase; matching is case-insensitive so `Admin` can't slip through. Keep
|
|
9
|
-
* in sync with the route tree's top-level directories.
|
|
4
|
+
* shadow (or be shadowed by) a route. `o` is reserved for `/o/{slug}/` even though
|
|
5
|
+
* the length gate below already makes a 1-char slug impossible.
|
|
6
|
+
* `reserved-slugs.test.ts` in the selva app holds this to the route tree.
|
|
10
7
|
*/
|
|
11
8
|
export const RESERVED_SLUGS = [
|
|
12
9
|
'o',
|
|
@@ -16,11 +13,13 @@ export const RESERVED_SLUGS = [
|
|
|
16
13
|
'login',
|
|
17
14
|
'logout',
|
|
18
15
|
'setup',
|
|
19
|
-
'settings',
|
|
20
16
|
'team',
|
|
21
17
|
'library',
|
|
22
18
|
'projects',
|
|
23
|
-
'accept-invite'
|
|
19
|
+
'accept-invite',
|
|
20
|
+
'docs',
|
|
21
|
+
'mcp',
|
|
22
|
+
'oauth'
|
|
24
23
|
];
|
|
25
24
|
const RESERVED_SLUG_SET = new Set(RESERVED_SLUGS);
|
|
26
25
|
/**
|
|
@@ -30,18 +29,27 @@ const RESERVED_SLUG_SET = new Set(RESERVED_SLUGS);
|
|
|
30
29
|
*/
|
|
31
30
|
export function slugify(name) {
|
|
32
31
|
return name
|
|
32
|
+
.normalize('NFKD')
|
|
33
|
+
.replace(/\p{M}/gu, '')
|
|
33
34
|
.trim()
|
|
34
35
|
.toLowerCase()
|
|
35
36
|
.replace(/[^a-z0-9]+/g, '-')
|
|
36
|
-
.
|
|
37
|
-
.
|
|
37
|
+
.slice(0, 63)
|
|
38
|
+
.replace(/^-+|-+$/g, '');
|
|
39
|
+
}
|
|
40
|
+
/** A slug for an org named without a slug of its own. Always passes `SlugSchema`. */
|
|
41
|
+
export function orgSlugFromName(name, fallback = 'default') {
|
|
42
|
+
const slug = slugify(name);
|
|
43
|
+
if (slug.length < 3)
|
|
44
|
+
return fallback;
|
|
45
|
+
return RESERVED_SLUG_SET.has(slug) ? `${slug}-org` : slug;
|
|
38
46
|
}
|
|
39
47
|
/** Lowercase alphanumeric with internal hyphens, 3–63 chars, not a reserved word. */
|
|
40
48
|
export const SlugSchema = z
|
|
41
49
|
.string()
|
|
42
50
|
.min(3, 'Slug must be at least 3 characters')
|
|
43
51
|
.max(63, 'Slug must be at most 63 characters')
|
|
44
|
-
.regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, 'Slug must be lowercase alphanumeric with hyphens (no leading
|
|
52
|
+
.regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, 'Slug must be lowercase alphanumeric with hyphens (no leading or trailing hyphen)')
|
|
45
53
|
.refine((s) => !RESERVED_SLUG_SET.has(s), {
|
|
46
54
|
message: 'Slug is reserved and cannot be used'
|
|
47
55
|
});
|
|
@@ -70,8 +78,7 @@ export const DEFAULT_ORG_PERMISSIONS = {
|
|
|
70
78
|
member: []
|
|
71
79
|
};
|
|
72
80
|
export const CreateOrgSchema = z.object({
|
|
73
|
-
name: z.string().min(1, 'Organization name is required').max(128),
|
|
81
|
+
name: z.string().trim().min(1, 'Organization name is required').max(128),
|
|
74
82
|
slug: SlugSchema
|
|
75
83
|
});
|
|
76
84
|
export const UpdateOrgSchema = CreateOrgSchema.partial();
|
|
77
|
-
//# sourceMappingURL=schemas.js.map
|
package/dist/pagination.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { DefinitionStatus } from './definitions/types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Cursor-paginated list options. Adapters default to limit=50
|
|
4
|
-
* desc
|
|
3
|
+
* Cursor-paginated list options. Adapters default to limit=50 and clamp limit to
|
|
4
|
+
* `MAX_PAGE_LIMIT`. Order is `createdAt` desc unless a store says otherwise: local
|
|
5
|
+
* definitions default to `name` asc, and the Supabase member, invite and token
|
|
6
|
+
* lists have one fixed order and ignore `orderBy`.
|
|
5
7
|
*
|
|
6
8
|
* Cursors are opaque — adapters may use row ids, offsets, or keyset encodings.
|
|
7
9
|
* Callers must not inspect them.
|
|
@@ -35,6 +37,8 @@ export interface DefinitionListOptions extends Omit<ListOptions, 'orderBy'> {
|
|
|
35
37
|
* post-fetch can return a page of 50 with 3 items.
|
|
36
38
|
*/
|
|
37
39
|
projectIds?: readonly string[];
|
|
40
|
+
/** Only definitions whose `sourceDocumentId` equals this lowercase GUID. */
|
|
41
|
+
sourceDocumentId?: string;
|
|
38
42
|
}
|
|
39
43
|
export interface Page<T> {
|
|
40
44
|
items: T[];
|
|
@@ -42,4 +46,8 @@ export interface Page<T> {
|
|
|
42
46
|
}
|
|
43
47
|
export declare const DEFAULT_PAGE_LIMIT = 50;
|
|
44
48
|
export declare const MAX_PAGE_LIMIT = 200;
|
|
45
|
-
|
|
49
|
+
/** For adapters paging by offset. Junk and negatives read as the first page. */
|
|
50
|
+
export declare function decodeOffsetCursor(cursor: string | undefined): number;
|
|
51
|
+
export declare function encodeOffsetCursor(offset: number): string;
|
|
52
|
+
/** The effective page size for a requested limit. */
|
|
53
|
+
export declare function clampPageLimit(limit: number | undefined): number;
|
package/dist/pagination.js
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
export const DEFAULT_PAGE_LIMIT = 50;
|
|
2
2
|
export const MAX_PAGE_LIMIT = 200;
|
|
3
|
-
|
|
3
|
+
/** For adapters paging by offset. Junk and negatives read as the first page. */
|
|
4
|
+
export function decodeOffsetCursor(cursor) {
|
|
5
|
+
const offset = cursor ? parseInt(cursor, 10) : 0;
|
|
6
|
+
return Number.isFinite(offset) && offset >= 0 ? offset : 0;
|
|
7
|
+
}
|
|
8
|
+
export function encodeOffsetCursor(offset) {
|
|
9
|
+
return String(offset);
|
|
10
|
+
}
|
|
11
|
+
/** The effective page size for a requested limit. */
|
|
12
|
+
export function clampPageLimit(limit) {
|
|
13
|
+
const requested = limit ?? DEFAULT_PAGE_LIMIT;
|
|
14
|
+
if (!Number.isFinite(requested))
|
|
15
|
+
return DEFAULT_PAGE_LIMIT;
|
|
16
|
+
return Math.min(Math.max(1, Math.floor(requested)), MAX_PAGE_LIMIT);
|
|
17
|
+
}
|