@sylphx/contract 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/endpoint.d.ts +6 -0
  3. package/dist/endpoint.d.ts.map +1 -1
  4. package/dist/endpoints/admin-projects.d.ts +29 -0
  5. package/dist/endpoints/admin-projects.d.ts.map +1 -1
  6. package/dist/endpoints/admin-projects.js +30 -1
  7. package/dist/endpoints/auth.d.ts +47 -0
  8. package/dist/endpoints/auth.d.ts.map +1 -1
  9. package/dist/endpoints/auth.js +19 -1
  10. package/dist/endpoints/branch-databases.d.ts +27 -28
  11. package/dist/endpoints/branch-databases.d.ts.map +1 -1
  12. package/dist/endpoints/branch-databases.js +7 -7
  13. package/dist/endpoints/databases.d.ts +253 -3
  14. package/dist/endpoints/databases.d.ts.map +1 -1
  15. package/dist/endpoints/databases.js +19 -12
  16. package/dist/endpoints/organizations.d.ts +11 -0
  17. package/dist/endpoints/organizations.d.ts.map +1 -1
  18. package/dist/endpoints/organizations.js +8 -1
  19. package/dist/endpoints/project-manifest.d.ts +26 -18
  20. package/dist/endpoints/project-manifest.d.ts.map +1 -1
  21. package/dist/endpoints/secrets.d.ts +6 -6
  22. package/dist/endpoints/secrets.d.ts.map +1 -1
  23. package/dist/endpoints/secrets.js +6 -5
  24. package/dist/endpoints/storage.d.ts +183 -125
  25. package/dist/endpoints/storage.d.ts.map +1 -1
  26. package/dist/endpoints/storage.js +96 -59
  27. package/dist/index.d.ts +323 -164
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/schemas/admin-projects.d.ts +20 -0
  31. package/dist/schemas/admin-projects.d.ts.map +1 -1
  32. package/dist/schemas/admin-projects.js +17 -0
  33. package/dist/schemas/auth.d.ts +65 -0
  34. package/dist/schemas/auth.d.ts.map +1 -1
  35. package/dist/schemas/auth.js +32 -0
  36. package/dist/schemas/branch-database.d.ts +20 -19
  37. package/dist/schemas/branch-database.d.ts.map +1 -1
  38. package/dist/schemas/branch-database.js +9 -7
  39. package/dist/schemas/ids.d.ts +2 -0
  40. package/dist/schemas/ids.d.ts.map +1 -1
  41. package/dist/schemas/ids.js +1 -0
  42. package/dist/schemas/organization.d.ts +24 -2
  43. package/dist/schemas/organization.d.ts.map +1 -1
  44. package/dist/schemas/organization.js +13 -1
  45. package/dist/schemas/project-manifest.d.ts +43 -21
  46. package/dist/schemas/project-manifest.d.ts.map +1 -1
  47. package/dist/schemas/project-manifest.js +11 -3
  48. package/dist/schemas/secret.d.ts +1 -1
  49. package/dist/schemas/secret.js +2 -2
  50. package/dist/schemas/storage.d.ts +259 -203
  51. package/dist/schemas/storage.d.ts.map +1 -1
  52. package/dist/schemas/storage.js +159 -144
  53. package/package.json +5 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @sylphx/contract
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#469](https://github.com/SylphxAI/platform/pull/469) [`ba02c04`](https://github.com/SylphxAI/platform/commit/ba02c0412712dc8a5f19d17c16707eb5ae11ec47) Thanks [@shtse8](https://github.com/shtse8)! - Replace the legacy storage upload-token surface with ADR-100 storage uploads v2: upload sessions, multipart resume, file actions, soft-delete/restore, signed URLs, copy, and version restore are now contract-first with no legacy alias envelopes.
8
+
9
+ ## 0.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`03dbd29`](https://github.com/SylphxAI/platform/commit/03dbd2986024fa650378e10958890d6ac063f516) Thanks [@shtse8](https://github.com/shtse8)! - Add a privacy-preserving public auth resend-verification contract and SDK helper.
14
+
3
15
  ## 0.2.0
4
16
 
5
17
  ### Minor Changes
@@ -46,6 +46,12 @@ export interface Endpoint<Method extends HttpMethod = HttpMethod, Path extends s
46
46
  * that customers never consume (super-admin platform administration).
47
47
  */
48
48
  readonly plane?: 'management' | 'baas' | 'admin';
49
+ /**
50
+ * OpenAPI security requirements. Omit for the default bearerAuth contract;
51
+ * use an empty array for deliberately public endpoints such as sign-in and
52
+ * email verification resend.
53
+ */
54
+ readonly security?: readonly string[];
49
55
  /** LLM-targeted description emitted as `x-agent-hint` (OpenAPI 4 forward-compat). */
50
56
  readonly agentHint?: string;
51
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../src/endpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,qDAAqD;AACrD,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEpE;;;;;;;;GAQG;AACH,MAAM,WAAW,QAAQ,CACxB,MAAM,SAAS,UAAU,GAAG,UAAU,EACtC,IAAI,SAAS,MAAM,GAAG,MAAM,EAE5B,MAAM,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,SAAS,GAAG,GAAG,EAE/D,KAAK,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,SAAS,GAAG,GAAG,EAE9D,IAAI,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,SAAS,GAAG,GAAG,EAE7D,QAAQ,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC;IAEhF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;IACtB,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AAA;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,OAAO,CAAA;IAChD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACrC,qFAAqF;IACrF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAC1B,MAAM,SAAS,UAAU,EACzB,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,GAAG,SAAS,EACrD,KAAK,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,GAAG,SAAS,EACpD,IAAI,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,GAAG,SAAS,EACnD,QAAQ,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,EAE3C,UAAU,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,KAC7D,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAa,CAAA;AAEpE;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC7B,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,aAAa,CAAA;CAChD"}
@@ -112,6 +112,35 @@ export declare const adminProjectsEndpoints: {
112
112
  secretKey: typeof import("effect/Schema").String;
113
113
  publicKey: typeof import("effect/Schema").String;
114
114
  }>>;
115
+ readonly rotateEnvironmentCredentials: import("../endpoint.js").Endpoint<"POST", "/operator/projects/environments/:environmentId/credentials/rotate", import("effect/Schema").Struct<{
116
+ environmentId: typeof import("effect/Schema").String;
117
+ }>, import("effect/Schema").Schema.AnyNoContext | undefined, import("effect/Schema").Struct<{
118
+ reason: import("effect/Schema").filter<import("effect/Schema").filter<typeof import("effect/Schema").String>>;
119
+ syncDeploymentSecret: import("effect/Schema").optional<typeof import("effect/Schema").Boolean>;
120
+ }>, import("effect/Schema").Struct<{
121
+ environmentId: typeof import("effect/Schema").String;
122
+ envType: import("effect/Schema").Literal<["development", "staging", "production"]>;
123
+ secretKey: typeof import("effect/Schema").String;
124
+ publicKey: typeof import("effect/Schema").String;
125
+ syncedDeploymentSecret: typeof import("effect/Schema").Boolean;
126
+ queued: typeof import("effect/Schema").Boolean;
127
+ generation: typeof import("effect/Schema").Number;
128
+ }>>;
129
+ readonly rotateEnvironmentCredentialsBySlug: import("../endpoint.js").Endpoint<"POST", "/operator/projects/by-slug/:projectSlug/environments/:environmentName/credentials/rotate", import("effect/Schema").Struct<{
130
+ projectSlug: typeof import("effect/Schema").String;
131
+ environmentName: typeof import("effect/Schema").String;
132
+ }>, import("effect/Schema").Schema.AnyNoContext | undefined, import("effect/Schema").Struct<{
133
+ reason: import("effect/Schema").filter<import("effect/Schema").filter<typeof import("effect/Schema").String>>;
134
+ syncDeploymentSecret: import("effect/Schema").optional<typeof import("effect/Schema").Boolean>;
135
+ }>, import("effect/Schema").Struct<{
136
+ environmentId: typeof import("effect/Schema").String;
137
+ envType: import("effect/Schema").Literal<["development", "staging", "production"]>;
138
+ secretKey: typeof import("effect/Schema").String;
139
+ publicKey: typeof import("effect/Schema").String;
140
+ syncedDeploymentSecret: typeof import("effect/Schema").Boolean;
141
+ queued: typeof import("effect/Schema").Boolean;
142
+ generation: typeof import("effect/Schema").Number;
143
+ }>>;
115
144
  readonly platformResources: import("../endpoint.js").Endpoint<"GET", "/operator/projects/:id/platform-resources", import("effect/Schema").Struct<{
116
145
  id: typeof import("effect/Schema").String;
117
146
  }>, import("effect/Schema").Schema.AnyNoContext | undefined, import("effect/Schema").Schema.AnyNoContext | undefined, import("effect/Schema").Array$<import("effect/Schema").Struct<{
@@ -1 +1 @@
1
- {"version":3,"file":"admin-projects.d.ts","sourceRoot":"","sources":["../../src/endpoints/admin-projects.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiEzB,CAAA"}
1
+ {"version":3,"file":"admin-projects.d.ts","sourceRoot":"","sources":["../../src/endpoints/admin-projects.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqBH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGzB,CAAA"}
@@ -5,7 +5,7 @@
5
5
  * Production mount: `/admin/projects/*`.
6
6
  */
7
7
  import { defineEndpoint } from '../endpoint.js';
8
- import { AdminCreateProjectInput, AdminCreateProjectResult, AdminDeleteProjectResult, AdminEnvironmentIdParams, AdminGetProjectResult, AdminListProjectsQuery, AdminListProjectsResult, AdminPlatformResourcesResult, AdminProjectIdParams, AdminRegenerateSecretKeyResult, AdminUpdateProjectInput, AdminUpdateProjectResult, } from '../schemas/admin-projects.js';
8
+ import { AdminCreateProjectInput, AdminCreateProjectResult, AdminDeleteProjectResult, AdminEnvironmentIdParams, AdminEnvironmentSlugParams, AdminGetProjectResult, AdminListProjectsQuery, AdminListProjectsResult, AdminPlatformResourcesResult, AdminProjectIdParams, AdminRegenerateSecretKeyResult, AdminRotateEnvironmentCredentialsInput, AdminRotateEnvironmentCredentialsResult, AdminUpdateProjectInput, AdminUpdateProjectResult, } from '../schemas/admin-projects.js';
9
9
  export const adminProjectsEndpoints = {
10
10
  list: defineEndpoint({
11
11
  method: 'GET',
@@ -62,6 +62,35 @@ export const adminProjectsEndpoints = {
62
62
  summary: 'Regenerate environment secret key (super_admin only)',
63
63
  tags: ['admin-projects'],
64
64
  }),
65
+ rotateEnvironmentCredentials: defineEndpoint({
66
+ method: 'POST',
67
+ path: '/operator/projects/environments/:environmentId/credentials/rotate',
68
+ params: AdminEnvironmentIdParams,
69
+ body: AdminRotateEnvironmentCredentialsInput,
70
+ response: AdminRotateEnvironmentCredentialsResult,
71
+ plane: 'management',
72
+ summary: 'Rotate environment BaaS credentials and optionally sync deployed app secret',
73
+ description: 'Operator-only credential rotation for an environment. Generates a new ' +
74
+ '`sk_*`/`pk_*` pair, stores only the secret hash on the environment, ' +
75
+ 'optionally writes the raw secret once into the environment shared ' +
76
+ '`SYLPHX_SECRET_KEY` app secret, emits audit, and queues reconciliation. ' +
77
+ 'Requires a service token carrying `platform:admin` and `platform:secrets:rotate`.',
78
+ tags: ['admin-projects'],
79
+ }),
80
+ rotateEnvironmentCredentialsBySlug: defineEndpoint({
81
+ method: 'POST',
82
+ path: '/operator/projects/by-slug/:projectSlug/environments/:environmentName/credentials/rotate',
83
+ params: AdminEnvironmentSlugParams,
84
+ body: AdminRotateEnvironmentCredentialsInput,
85
+ response: AdminRotateEnvironmentCredentialsResult,
86
+ plane: 'management',
87
+ summary: 'Rotate environment BaaS credentials by project slug and environment name',
88
+ description: 'Operator-only credential rotation for a named environment on a project slug. ' +
89
+ 'This is the human/operator selector variant of the TypeID route; it does not ' +
90
+ 'accept raw UUIDs. Requires a service token carrying `platform:admin` and ' +
91
+ '`platform:secrets:rotate`.',
92
+ tags: ['admin-projects'],
93
+ }),
65
94
  platformResources: defineEndpoint({
66
95
  method: 'GET',
67
96
  path: '/operator/projects/:id/platform-resources',
@@ -29,6 +29,12 @@ export declare const authEndpoints: {
29
29
  email: typeof Schema.String;
30
30
  emailVerified: typeof Schema.Boolean;
31
31
  }>>;
32
+ readonly resendEmailVerification: import("../endpoint.js").Endpoint<"POST", "/auth/resend-verification", Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
33
+ email: Schema.filter<typeof Schema.String>;
34
+ }>, Schema.Struct<{
35
+ success: Schema.Literal<[true]>;
36
+ message: typeof Schema.String;
37
+ }>>;
32
38
  readonly signOut: import("../endpoint.js").Endpoint<"POST", "/auth/logout", Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
33
39
  success: typeof Schema.Boolean;
34
40
  }>>;
@@ -41,6 +47,47 @@ export declare const authEndpoints: {
41
47
  emailVerified: typeof Schema.Boolean;
42
48
  }>>;
43
49
  }>>;
50
+ readonly getPrincipal: import("../endpoint.js").Endpoint<"GET", "/auth/principal", Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Union<[Schema.Struct<{
51
+ principalType: Schema.Literal<["user"]>;
52
+ user: Schema.Struct<{
53
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "UserId">;
54
+ email: typeof Schema.String;
55
+ name: Schema.NullOr<typeof Schema.String>;
56
+ }>;
57
+ orgs: Schema.Array$<Schema.Struct<{
58
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "OrgId">;
59
+ slug: typeof Schema.String;
60
+ name: typeof Schema.String;
61
+ email: Schema.optional<Schema.NullOr<typeof Schema.String>>;
62
+ billingEmail: Schema.optional<Schema.NullOr<typeof Schema.String>>;
63
+ logoUrl: Schema.optional<Schema.NullOr<typeof Schema.String>>;
64
+ metadata: Schema.optional<Schema.NullOr<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>;
65
+ createdAt: Schema.optional<typeof Schema.String>;
66
+ }>>;
67
+ }>, Schema.Struct<{
68
+ principalType: Schema.Literal<["service_token"]>;
69
+ serviceToken: Schema.Struct<{
70
+ id: typeof Schema.String;
71
+ name: typeof Schema.String;
72
+ tokenType: Schema.Literal<["service", "oidc"]>;
73
+ tokenPrefix: Schema.NullOr<typeof Schema.String>;
74
+ orgId: typeof Schema.String;
75
+ projectId: Schema.NullOr<typeof Schema.String>;
76
+ environmentId: Schema.NullOr<typeof Schema.String>;
77
+ scopes: Schema.Array$<typeof Schema.String>;
78
+ expiresAt: Schema.NullOr<typeof Schema.String>;
79
+ }>;
80
+ org: Schema.Struct<{
81
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "OrgId">;
82
+ slug: typeof Schema.String;
83
+ name: typeof Schema.String;
84
+ email: Schema.optional<Schema.NullOr<typeof Schema.String>>;
85
+ billingEmail: Schema.optional<Schema.NullOr<typeof Schema.String>>;
86
+ logoUrl: Schema.optional<Schema.NullOr<typeof Schema.String>>;
87
+ metadata: Schema.optional<Schema.NullOr<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>;
88
+ createdAt: Schema.optional<typeof Schema.String>;
89
+ }>;
90
+ }>]>>;
44
91
  readonly deviceInit: import("../endpoint.js").Endpoint<"POST", "/auth/device", Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
45
92
  client_id: typeof Schema.String;
46
93
  scope: Schema.optional<Schema.Array$<typeof Schema.String>>;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/endpoints/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAoC/B,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyMhB,CAAA"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/endpoints/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAuC/B,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2NhB,CAAA"}
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { Schema } from 'effect';
11
11
  import { defineEndpoint } from '../endpoint.js';
12
- import { AuthUserDeleteRequest, AuthUserDeleteResponse, AuthUserExportResponse, DeviceApproveRequest, DeviceApproveResponse, DeviceDenyRequest, DeviceDenyResponse, DeviceInitRequest, DeviceInitResponse, DevicePollResponse, OAuthIntrospectRequest, OAuthIntrospectResponse, OAuthRevokeRequest, OAuthRevokeResponse, PlatformPasswordChangeRequest, PlatformPasswordChangeResponse, PlatformPasswordSetRequest, PlatformPasswordSetResponse, PlatformPasswordStatusResponse, PlatformSessionRenameRequest, PlatformSessionRenameResponse, PlatformSessionRevokeAllResponse, PlatformSessionRevokeOtherResponse, PlatformSessionRevokeRequest, PlatformSessionRevokeResponse, PlatformSessionsListResponse, SessionResult, SignInInput, SignInResult, SignUpInput, SignUpResult, } from '../schemas/auth.js';
12
+ import { AuthenticatedPrincipal, AuthUserDeleteRequest, AuthUserDeleteResponse, AuthUserExportResponse, DeviceApproveRequest, DeviceApproveResponse, DeviceDenyRequest, DeviceDenyResponse, DeviceInitRequest, DeviceInitResponse, DevicePollResponse, OAuthIntrospectRequest, OAuthIntrospectResponse, OAuthRevokeRequest, OAuthRevokeResponse, PlatformPasswordChangeRequest, PlatformPasswordChangeResponse, PlatformPasswordSetRequest, PlatformPasswordSetResponse, PlatformPasswordStatusResponse, PlatformSessionRenameRequest, PlatformSessionRenameResponse, PlatformSessionRevokeAllResponse, PlatformSessionRevokeOtherResponse, PlatformSessionRevokeRequest, PlatformSessionRevokeResponse, PlatformSessionsListResponse, ResendEmailVerificationRequest, ResendEmailVerificationResponse, SessionResult, SignInInput, SignInResult, SignUpInput, SignUpResult, } from '../schemas/auth.js';
13
13
  export const authEndpoints = {
14
14
  signIn: defineEndpoint({
15
15
  method: 'POST',
@@ -18,6 +18,7 @@ export const authEndpoints = {
18
18
  response: SignInResult,
19
19
  summary: 'Sign in with email + password (may return 2FA challenge)',
20
20
  tags: ['auth'],
21
+ security: [],
21
22
  }),
22
23
  signUp: defineEndpoint({
23
24
  method: 'POST',
@@ -26,6 +27,16 @@ export const authEndpoints = {
26
27
  response: SignUpResult,
27
28
  summary: 'Register a new user with email + password',
28
29
  tags: ['auth'],
30
+ security: [],
31
+ }),
32
+ resendEmailVerification: defineEndpoint({
33
+ method: 'POST',
34
+ path: '/auth/resend-verification',
35
+ body: ResendEmailVerificationRequest,
36
+ response: ResendEmailVerificationResponse,
37
+ summary: 'Resend a privacy-preserving email verification link',
38
+ tags: ['auth'],
39
+ security: [],
29
40
  }),
30
41
  signOut: defineEndpoint({
31
42
  method: 'POST',
@@ -41,6 +52,13 @@ export const authEndpoints = {
41
52
  summary: 'Get the current authenticated session (null when absent)',
42
53
  tags: ['auth'],
43
54
  }),
55
+ getPrincipal: defineEndpoint({
56
+ method: 'GET',
57
+ path: '/auth/principal',
58
+ response: AuthenticatedPrincipal,
59
+ summary: 'Get the current authenticated user or service-token principal',
60
+ tags: ['auth', 'principal'],
61
+ }),
44
62
  deviceInit: defineEndpoint({
45
63
  method: 'POST',
46
64
  path: '/auth/device',
@@ -8,68 +8,67 @@
8
8
  * environment. The `:id` params correspond to `projects.id` and
9
9
  * `project_environments.id` (the preview env's environment row).
10
10
  *
11
- * See `docs/design/branch-db-per-preview.md` for the full design — this file
12
- * is the scaffolded contract; actual CNPG provisioning lands in the
13
- * controller (ops follow-up).
11
+ * See `docs/design/branch-db-per-preview.md` for the full design. The
12
+ * controller owns CNPG provisioning and teardown.
14
13
  */
15
14
  import { Schema } from 'effect';
16
15
  export declare const branchDatabasesEndpoints: {
17
16
  readonly list: import("../endpoint.js").Endpoint<"GET", "/projects/:id/preview-envs/branch-dbs", Schema.Struct<{
18
- id: typeof Schema.String;
17
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "ProjectId">;
19
18
  }>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
20
19
  branches: Schema.Array$<Schema.Struct<{
21
- id: typeof Schema.String;
22
- projectId: typeof Schema.String;
23
- envId: typeof Schema.String;
24
- sourceDbId: typeof Schema.String;
20
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "BranchDatabaseId">;
21
+ projectId: Schema.brand<Schema.filter<typeof Schema.String>, "ProjectId">;
22
+ envId: Schema.brand<Schema.filter<typeof Schema.String>, "EnvironmentId">;
23
+ sourceDbId: Schema.brand<Schema.filter<typeof Schema.String>, "ResourceId">;
25
24
  cnpgClusterName: Schema.NullOr<typeof Schema.String>;
26
25
  connectionString: Schema.NullOr<typeof Schema.String>;
27
26
  dataMode: Schema.Literal<["none", "last-1d", "last-7d", "all"]>;
28
- status: Schema.Literal<["provisioning", "ready", "destroyed", "degraded"]>;
27
+ status: Schema.Literal<["provisioning", "ready", "destroying", "destroyed", "degraded"]>;
29
28
  createdAt: typeof Schema.String;
30
29
  destroyedAt: Schema.NullOr<typeof Schema.String>;
31
30
  }>>;
32
31
  }>>;
33
32
  readonly create: import("../endpoint.js").Endpoint<"POST", "/projects/:id/preview-envs/:envId/branch-db", Schema.Struct<{
34
- id: typeof Schema.String;
35
- envId: typeof Schema.String;
33
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "ProjectId">;
34
+ envId: Schema.brand<Schema.filter<typeof Schema.String>, "EnvironmentId">;
36
35
  }>, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
37
- previewEnvId: typeof Schema.String;
36
+ previewEnvId: Schema.brand<Schema.filter<typeof Schema.String>, "EnvironmentId">;
38
37
  withData: Schema.optional<Schema.Literal<["none", "last-1d", "last-7d", "all"]>>;
39
38
  }>, Schema.Struct<{
40
- id: typeof Schema.String;
41
- projectId: typeof Schema.String;
42
- envId: typeof Schema.String;
43
- sourceDbId: typeof Schema.String;
39
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "BranchDatabaseId">;
40
+ projectId: Schema.brand<Schema.filter<typeof Schema.String>, "ProjectId">;
41
+ envId: Schema.brand<Schema.filter<typeof Schema.String>, "EnvironmentId">;
42
+ sourceDbId: Schema.brand<Schema.filter<typeof Schema.String>, "ResourceId">;
44
43
  cnpgClusterName: Schema.NullOr<typeof Schema.String>;
45
44
  connectionString: Schema.NullOr<typeof Schema.String>;
46
45
  dataMode: Schema.Literal<["none", "last-1d", "last-7d", "all"]>;
47
- status: Schema.Literal<["provisioning", "ready", "destroyed", "degraded"]>;
46
+ status: Schema.Literal<["provisioning", "ready", "destroying", "destroyed", "degraded"]>;
48
47
  createdAt: typeof Schema.String;
49
48
  destroyedAt: Schema.NullOr<typeof Schema.String>;
50
49
  }>>;
51
50
  readonly get: import("../endpoint.js").Endpoint<"GET", "/projects/:id/preview-envs/:envId/branch-db", Schema.Struct<{
52
- id: typeof Schema.String;
53
- envId: typeof Schema.String;
51
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "ProjectId">;
52
+ envId: Schema.brand<Schema.filter<typeof Schema.String>, "EnvironmentId">;
54
53
  }>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
55
- id: typeof Schema.String;
56
- projectId: typeof Schema.String;
57
- envId: typeof Schema.String;
58
- sourceDbId: typeof Schema.String;
54
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "BranchDatabaseId">;
55
+ projectId: Schema.brand<Schema.filter<typeof Schema.String>, "ProjectId">;
56
+ envId: Schema.brand<Schema.filter<typeof Schema.String>, "EnvironmentId">;
57
+ sourceDbId: Schema.brand<Schema.filter<typeof Schema.String>, "ResourceId">;
59
58
  cnpgClusterName: Schema.NullOr<typeof Schema.String>;
60
59
  connectionString: Schema.NullOr<typeof Schema.String>;
61
60
  dataMode: Schema.Literal<["none", "last-1d", "last-7d", "all"]>;
62
- status: Schema.Literal<["provisioning", "ready", "destroyed", "degraded"]>;
61
+ status: Schema.Literal<["provisioning", "ready", "destroying", "destroyed", "degraded"]>;
63
62
  createdAt: typeof Schema.String;
64
63
  destroyedAt: Schema.NullOr<typeof Schema.String>;
65
64
  }>>;
66
65
  readonly destroy: import("../endpoint.js").Endpoint<"DELETE", "/projects/:id/preview-envs/:envId/branch-db", Schema.Struct<{
67
- id: typeof Schema.String;
68
- envId: typeof Schema.String;
66
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "ProjectId">;
67
+ envId: Schema.brand<Schema.filter<typeof Schema.String>, "EnvironmentId">;
69
68
  }>, Schema.Schema.AnyNoContext | undefined, Schema.Schema.AnyNoContext | undefined, Schema.Struct<{
70
69
  success: typeof Schema.Boolean;
71
- branchId: typeof Schema.String;
72
- status: Schema.Literal<["provisioning", "ready", "destroyed", "degraded"]>;
70
+ branchId: Schema.brand<Schema.filter<typeof Schema.String>, "BranchDatabaseId">;
71
+ status: Schema.Literal<["provisioning", "ready", "destroying", "destroyed", "degraded"]>;
73
72
  }>>;
74
73
  };
75
74
  //# sourceMappingURL=branch-databases.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"branch-databases.d.ts","sourceRoot":"","sources":["../../src/endpoints/branch-databases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAiB/B,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuC3B,CAAA"}
1
+ {"version":3,"file":"branch-databases.d.ts","sourceRoot":"","sources":["../../src/endpoints/branch-databases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAkB/B,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuC3B,CAAA"}
@@ -8,18 +8,18 @@
8
8
  * environment. The `:id` params correspond to `projects.id` and
9
9
  * `project_environments.id` (the preview env's environment row).
10
10
  *
11
- * See `docs/design/branch-db-per-preview.md` for the full design — this file
12
- * is the scaffolded contract; actual CNPG provisioning lands in the
13
- * controller (ops follow-up).
11
+ * See `docs/design/branch-db-per-preview.md` for the full design. The
12
+ * controller owns CNPG provisioning and teardown.
14
13
  */
15
14
  import { Schema } from 'effect';
16
15
  import { defineEndpoint } from '../endpoint.js';
17
16
  import { BranchDatabase, CreateBranchDatabaseInput, DestroyBranchDatabaseResult, GetBranchDatabaseResult, ListBranchDatabasesResult, } from '../schemas/branch-database.js';
17
+ import { EnvironmentId, ProjectId } from '../schemas/ids.js';
18
18
  const ProjectEnvPath = Schema.Struct({
19
- id: Schema.String,
20
- envId: Schema.String,
19
+ id: ProjectId,
20
+ envId: EnvironmentId,
21
21
  });
22
- const ProjectIdPath = Schema.Struct({ id: Schema.String });
22
+ const ProjectIdPath = Schema.Struct({ id: ProjectId });
23
23
  export const branchDatabasesEndpoints = {
24
24
  list: defineEndpoint({
25
25
  method: 'GET',
@@ -55,7 +55,7 @@ export const branchDatabasesEndpoints = {
55
55
  params: ProjectEnvPath,
56
56
  response: DestroyBranchDatabaseResult,
57
57
  plane: 'management',
58
- summary: 'Destroy a branch database (tombstones the row; reclaims PVCs)',
58
+ summary: 'Schedule branch database teardown (controller reclaims PVCs asynchronously)',
59
59
  tags: ['branch-databases'],
60
60
  }),
61
61
  };