@salsita-ai/contracts 0.0.0-stage → 0.49.0-develop.2a2e8d75e7

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 (154) hide show
  1. package/CHANGELOG.md +419 -0
  2. package/LICENSE +61 -0
  3. package/README.md +28 -2
  4. package/dist/api/access-level.d.ts +7 -0
  5. package/dist/api/access-level.js +1 -0
  6. package/dist/api/access-token.d.ts +6 -0
  7. package/dist/api/access-token.js +1 -0
  8. package/dist/api/index.d.ts +4 -0
  9. package/dist/api/index.js +1 -0
  10. package/dist/api/session-role.d.ts +8 -0
  11. package/dist/api/session-role.js +1 -0
  12. package/dist/api/session-token.d.ts +22 -0
  13. package/dist/api/session-token.js +1 -0
  14. package/dist/assistant/browser-details-tool.d.ts +16 -0
  15. package/dist/assistant/browser-details-tool.js +1 -0
  16. package/dist/assistant/deployment-assistant.d.ts +84 -0
  17. package/dist/assistant/deployment-assistant.js +1 -0
  18. package/dist/assistant/graphql-tools.d.ts +120 -0
  19. package/dist/assistant/graphql-tools.js +1 -0
  20. package/dist/assistant/index.d.ts +6 -0
  21. package/dist/assistant/index.js +1 -0
  22. package/dist/assistant/message-metadata.d.ts +17 -0
  23. package/dist/assistant/message-metadata.js +1 -0
  24. package/dist/chat/api.d.ts +52 -0
  25. package/dist/chat/api.js +1 -0
  26. package/dist/chat/completions/messages.d.ts +3 -0
  27. package/dist/chat/completions/messages.js +1 -0
  28. package/dist/chat/completions/types.d.ts +28 -0
  29. package/dist/chat/completions/types.js +1 -0
  30. package/dist/chat/functions/augmentations.d.ts +3 -0
  31. package/dist/chat/functions/augmentations.js +1 -0
  32. package/dist/chat/functions/create.d.ts +5 -0
  33. package/dist/chat/functions/create.js +1 -0
  34. package/dist/chat/functions/process.d.ts +14 -0
  35. package/dist/chat/functions/process.js +1 -0
  36. package/dist/chat/functions/types.d.ts +21 -0
  37. package/dist/chat/functions/types.js +1 -0
  38. package/dist/chat/functions/validate.d.ts +1 -0
  39. package/dist/chat/functions/validate.js +2 -0
  40. package/dist/chat/index.d.ts +10 -0
  41. package/dist/chat/index.js +1 -0
  42. package/dist/chat/utils/types.d.ts +1 -0
  43. package/dist/chat/utils/types.js +1 -0
  44. package/dist/clerk/clerk-backend-api-client.d.ts +129 -0
  45. package/dist/clerk/clerk-backend-api-client.js +1 -0
  46. package/dist/clerk/clerk-backend-api-types.d.ts +740 -0
  47. package/dist/clerk/clerk-backend-api-types.js +1 -0
  48. package/dist/clerk/clerk-session-token.d.ts +28 -0
  49. package/dist/clerk/clerk-session-token.js +1 -0
  50. package/dist/clerk/clerk-token-service.d.ts +15 -0
  51. package/dist/clerk/clerk-token-service.js +1 -0
  52. package/dist/clerk/index.d.ts +4 -0
  53. package/dist/clerk/index.js +1 -0
  54. package/dist/domain/deployments/ai-image-domain.d.ts +10 -0
  55. package/dist/domain/deployments/ai-image-domain.js +1 -0
  56. package/dist/domain/deployments/api-token-domain.d.ts +8 -0
  57. package/dist/domain/deployments/api-token-domain.js +1 -0
  58. package/dist/domain/deployments/configuration-schema-domain.d.ts +22 -0
  59. package/dist/domain/deployments/configuration-schema-domain.js +1 -0
  60. package/dist/domain/deployments/customer-domain.d.ts +69 -0
  61. package/dist/domain/deployments/customer-domain.js +1 -0
  62. package/dist/domain/deployments/deployment-build-domain.d.ts +78 -0
  63. package/dist/domain/deployments/deployment-build-domain.js +1 -0
  64. package/dist/domain/deployments/deployment-domain.d.ts +126 -0
  65. package/dist/domain/deployments/deployment-domain.js +1 -0
  66. package/dist/domain/deployments/embedding-domain.d.ts +9 -0
  67. package/dist/domain/deployments/embedding-domain.js +1 -0
  68. package/dist/domain/deployments/environment-domain.d.ts +107 -0
  69. package/dist/domain/deployments/environment-domain.js +1 -0
  70. package/dist/domain/deployments/image-render-domain.d.ts +22 -0
  71. package/dist/domain/deployments/image-render-domain.js +1 -0
  72. package/dist/domain/deployments/index.d.ts +14 -0
  73. package/dist/domain/deployments/index.js +1 -0
  74. package/dist/domain/deployments/oauth-connection-domain.d.ts +62 -0
  75. package/dist/domain/deployments/oauth-connection-domain.js +1 -0
  76. package/dist/domain/deployments/oauth-provider-domain.d.ts +23 -0
  77. package/dist/domain/deployments/oauth-provider-domain.js +1 -0
  78. package/dist/domain/deployments/project-domain.d.ts +26 -0
  79. package/dist/domain/deployments/project-domain.js +1 -0
  80. package/dist/domain/deployments/sdk-builder-setup-domain.d.ts +13 -0
  81. package/dist/domain/deployments/sdk-builder-setup-domain.js +1 -0
  82. package/dist/domain/deployments/session-domain.d.ts +20 -0
  83. package/dist/domain/deployments/session-domain.js +1 -0
  84. package/dist/domain/feedback/feedback-domain.d.ts +55 -0
  85. package/dist/domain/feedback/feedback-domain.js +1 -0
  86. package/dist/domain/feedback/index.d.ts +1 -0
  87. package/dist/domain/feedback/index.js +1 -0
  88. package/dist/domain/index.d.ts +3 -0
  89. package/dist/domain/index.js +1 -0
  90. package/dist/domain/product-configurations/configurations-domain.d.ts +113 -0
  91. package/dist/domain/product-configurations/configurations-domain.js +1 -0
  92. package/dist/domain/product-configurations/index.d.ts +1 -0
  93. package/dist/domain/product-configurations/index.js +1 -0
  94. package/dist/webhook/core/index.d.ts +3 -0
  95. package/dist/webhook/core/index.js +1 -0
  96. package/dist/webhook/core/task-resource.d.ts +80 -0
  97. package/dist/webhook/core/task-resource.js +1 -0
  98. package/dist/webhook/core/task-type.d.ts +18 -0
  99. package/dist/webhook/core/task-type.js +1 -0
  100. package/dist/webhook/core/template.d.ts +65 -0
  101. package/dist/webhook/core/template.js +1 -0
  102. package/dist/webhook/empty-xlsx.d.ts +10 -0
  103. package/dist/webhook/empty-xlsx.js +1 -0
  104. package/dist/webhook/excel-workbook-client.d.ts +78 -0
  105. package/dist/webhook/excel-workbook-client.js +1 -0
  106. package/dist/webhook/google-sheets-client.d.ts +23 -0
  107. package/dist/webhook/google-sheets-client.js +1 -0
  108. package/dist/webhook/implementation/index.d.ts +4 -0
  109. package/dist/webhook/implementation/index.js +1 -0
  110. package/dist/webhook/implementation/webhook-api-types.d.ts +302 -0
  111. package/dist/webhook/implementation/webhook-api-types.js +1 -0
  112. package/dist/webhook/implementation/webhook-client.d.ts +85 -0
  113. package/dist/webhook/implementation/webhook-client.js +1 -0
  114. package/dist/webhook/implementation/webhook-routing.d.ts +30 -0
  115. package/dist/webhook/implementation/webhook-routing.js +1 -0
  116. package/dist/webhook/implementation/webhook-tunnel-types.d.ts +114 -0
  117. package/dist/webhook/implementation/webhook-tunnel-types.js +1 -0
  118. package/dist/webhook/index.d.ts +7 -0
  119. package/dist/webhook/index.js +1 -0
  120. package/dist/webhook/spreadsheet-adapter-factory.d.ts +10 -0
  121. package/dist/webhook/spreadsheet-adapter-factory.js +1 -0
  122. package/dist/webhook/spreadsheet-adapter.d.ts +94 -0
  123. package/dist/webhook/spreadsheet-adapter.js +1 -0
  124. package/dist/webhook/tasks/call-lambda-back-task.d.ts +22 -0
  125. package/dist/webhook/tasks/call-lambda-back-task.js +1 -0
  126. package/dist/webhook/tasks/edit-google-spreadsheet-task.d.ts +48 -0
  127. package/dist/webhook/tasks/edit-google-spreadsheet-task.js +1 -0
  128. package/dist/webhook/tasks/finalize-task.d.ts +184 -0
  129. package/dist/webhook/tasks/finalize-task.js +1 -0
  130. package/dist/webhook/tasks/generate-configuration-link-task.d.ts +56 -0
  131. package/dist/webhook/tasks/generate-configuration-link-task.js +1 -0
  132. package/dist/webhook/tasks/generate-csv-task.d.ts +30 -0
  133. package/dist/webhook/tasks/generate-csv-task.js +1 -0
  134. package/dist/webhook/tasks/generate-images-task.d.ts +404 -0
  135. package/dist/webhook/tasks/generate-images-task.js +1 -0
  136. package/dist/webhook/tasks/generate-pdf-task.d.ts +188 -0
  137. package/dist/webhook/tasks/generate-pdf-task.js +1 -0
  138. package/dist/webhook/tasks/index.d.ts +13 -0
  139. package/dist/webhook/tasks/index.js +1 -0
  140. package/dist/webhook/tasks/publish-revision-chunks-staged-task.d.ts +73 -0
  141. package/dist/webhook/tasks/publish-revision-chunks-staged-task.js +1 -0
  142. package/dist/webhook/tasks/publish-revision-chunks-task.d.ts +76 -0
  143. package/dist/webhook/tasks/publish-revision-chunks-task.js +1 -0
  144. package/dist/webhook/tasks/publish-revision-task.d.ts +38 -0
  145. package/dist/webhook/tasks/publish-revision-task.js +1 -0
  146. package/dist/webhook/tasks/send-email-task.d.ts +129 -0
  147. package/dist/webhook/tasks/send-email-task.js +1 -0
  148. package/dist/webhook/tasks/send-http-task.d.ts +27 -0
  149. package/dist/webhook/tasks/send-http-task.js +1 -0
  150. package/dist/webhook/tasks/woocommerce-add-to-cart-task.d.ts +91 -0
  151. package/dist/webhook/tasks/woocommerce-add-to-cart-task.js +1 -0
  152. package/dist/webhook/webhook-payload.d.ts +56 -0
  153. package/dist/webhook/webhook-payload.js +1 -0
  154. package/package.json +84 -3
@@ -0,0 +1 @@
1
+ var e,t,r,a;import{P as s,match as n}from"ts-pattern";import{z as o}from"zod";export var ClerkRole=((e={}).Admin="admin",e.SuperAdmin="superadmin",e.User="user",e);export var ClerkUserStatus=((t={}).Active="active",t.Banned="banned",t.Locked="locked",t);export var ClerkInvitationStatus=((r={}).Accepted="accepted",r.Pending="pending",r.Revoked="revoked",r.Expired="expired",r);export const UserTag=o.object({id:o.string(),label:o.string()});let i=o.enum(["admin","user","superadmin"]);export var ClerkErrorCode=((a={}).FormIdentifierExists="form_identifier_exists",a);export const ClerkErrorDescription=o.object({message:o.string(),long_message:o.string(),code:o.string()});export const ClerkErrorResponse=o.object({errors:o.array(ClerkErrorDescription)});export class ClerkError extends Error{clerkError;constructor(e){super(`${e.code}: ${e.message} - ${e.long_message}`),this.clerkError=e}}export const IdTokenData=o.object({exp:o.number(),iss:o.string()});export const RefreshTokenData=o.object({clerkRefreshToken:o.string()});export const OAuthRefreshTokenResult=o.object({access_token:o.string(),expires_in:o.number(),refresh_token:o.string(),scope:o.string(),token_type:o.string()});export const OAuthUserInfo=o.object({object:o.literal("oauth_user_info"),instance_id:o.string(),user_id:o.string(),email:o.string(),email_verified:o.boolean()});let d=o.object({role:i.optional(),tags:o.array(o.string()).optional()}),l=o.object({role:i.optional(),tags:o.array(o.string()).optional()});export const User=o.object({object:o.literal("user"),id:o.string(),primary_email_address_id:o.string(),email_addresses:o.array(o.object({id:o.string(),email_address:o.string()})),first_name:o.string().nullable(),last_name:o.string().nullable(),public_metadata:d,private_metadata:l,locked:o.boolean(),banned:o.boolean(),last_sign_in_at:o.number().nullable(),created_at:o.number()}).transform(e=>{let{created_at:t,email_addresses:r,id:a,last_sign_in_at:o,primary_email_address_id:i,public_metadata:d,private_metadata:l,locked:c,banned:p}=e,g=r.find(e=>e.id===i)?.email_address;if(!g)throw Error("Primary email address not found");let m=n([p,c]).with([!0,s.any],()=>"banned").with([!1,!0],()=>"locked").otherwise(()=>"active");return{id:a,emailAddress:g,fullName:e.first_name||e.last_name?[e.first_name??"",e.last_name??""].join(" "):null,role:l.role??d.role??"user",tags:l.tags??d.tags??[],status:m,createdAt:t,lastSignInAt:o}});export const UserResponse=o.array(User);export const UserUpdate=o.object({id:o.string(),tags:o.array(o.string()),role:i});export const UserDelete=o.object({deleted:o.boolean()});export const UserInvite=o.object({emailAddress:o.string(),role:i,tags:o.array(o.string())});export const InvitationPublicMetadata=o.object({role:i.optional(),tags:o.array(o.string()).optional()});export const Invitation=o.object({object:o.literal("invitation"),id:o.string(),email_address:o.string(),status:o.enum(["pending","accepted","revoked","expired"]),public_metadata:InvitationPublicMetadata,expires_at:o.number(),created_at:o.number(),updated_at:o.number()}).transform(e=>{let t=InvitationPublicMetadata.parse(e.public_metadata);return{id:e.id,emailAddress:e.email_address,status:e.status,role:t.role??"user",tags:t.tags??[],expiresAt:e.expires_at,createdAt:e.created_at,updatedAt:e.updated_at}});export const InvitationsResponse=o.array(Invitation);export const OranizationPrivateMetadata=o.object({userTags:o.array(UserTag).default([])});export const Organization=o.object({object:o.literal("organization"),id:o.string(),name:o.string(),private_metadata:OranizationPrivateMetadata}).transform(e=>{let{id:t,name:r,private_metadata:a}=e;return{id:t,name:r,userTags:a.userTags}});export const OrganizationsResponse=o.object({total_count:o.number(),data:o.array(Organization)});
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ export declare const ClerkSessionTokenClaims: z.ZodObject<{
3
+ sub: z.ZodString;
4
+ sid: z.ZodString;
5
+ } & {
6
+ azp: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ sub: string;
9
+ sid: string;
10
+ azp: string;
11
+ }, {
12
+ sub: string;
13
+ sid: string;
14
+ azp: string;
15
+ }>;
16
+ export type ClerkSessionTokenClaims = z.infer<typeof ClerkSessionTokenClaims>;
17
+ /**
18
+ * Cheap, signature-less check whether a token looks like a Clerk session JWT issued by the
19
+ * given Clerk frontend API. Used for auth flow routing only — never as proof of identity, the
20
+ * routed handler must call {@link verifyClerkSessionToken} before trusting the token.
21
+ */
22
+ export declare const isClerkSessionToken: (token: string, frontendApiBaseUrl: string) => boolean;
23
+ /**
24
+ * Verifies a Clerk session JWT against the JWKS of the given Clerk frontend API (signature,
25
+ * expiration, issuer, and authorized party) and returns its claims. Throws when the token is not
26
+ * a valid, unexpired session token of that Clerk instance or was minted for another frontend.
27
+ */
28
+ export declare const verifyClerkSessionToken: (token: string, frontendApiBaseUrl: string, authorizedParties: readonly string[]) => Promise<ClerkSessionTokenClaims>;
@@ -0,0 +1 @@
1
+ import{createRemoteJWKSet as e,decodeJwt as r,jwtVerify as s}from"jose";import{z as t}from"zod";let n=t.object({sub:t.string(),sid:t.string()});export const ClerkSessionTokenClaims=n.extend({azp:t.string().url()});let o=new Map;export const isClerkSessionToken=(e,s)=>{try{let t=r(e);if(!n.safeParse(t).success)return!1;return"string"==typeof t.iss&&t.iss.replace(/\/$/,"")===s.replace(/\/$/,"")}catch{return!1}};export const verifyClerkSessionToken=async(r,t,n)=>{let i=t.replace(/\/$/,""),{payload:a}=await s(r,(r=>{let s=o.get(r);if(s)return s;let t=e(new URL(`${r}/.well-known/jwks.json`));return o.set(r,t),t})(i),{issuer:i}),l=ClerkSessionTokenClaims.safeParse(a);if(!l.success)throw Error(`Clerk session token verification failed: the token signature is valid but required claims are missing (${l.error.message}). The token is probably not a Clerk session JWT — make sure the client sends the token obtained from Clerk's getToken().`);if(!n.map(e=>new URL(e).origin).includes(new URL(l.data.azp).origin))throw Error("Clerk session token verification failed: the token's authorized party is not allowed for this deployment.");return l.data};
@@ -0,0 +1,15 @@
1
+ import { type ProduceJWT } from 'jose';
2
+ type ExpirationTime = Parameters<ProduceJWT['setExpirationTime']>[0];
3
+ export declare class ClerkTokenService {
4
+ private readonly _jwtSecret;
5
+ constructor(_jwtSecret: string);
6
+ readonly generateRefreshToken: (clerkRefreshToken: string, expirationTime?: ExpirationTime) => Promise<string>;
7
+ readonly parseIdToken: (idToken: string) => {
8
+ exp: number;
9
+ iss: string;
10
+ };
11
+ readonly parseRefreshToken: (refreshToken: string) => {
12
+ clerkRefreshToken: string;
13
+ };
14
+ }
15
+ export {};
@@ -0,0 +1 @@
1
+ import{SignJWT as e,decodeJwt as r}from"jose";import{IdTokenData as t,RefreshTokenData as s}from"./clerk-backend-api-types.js";export class ClerkTokenService{_jwtSecret;constructor(e){this._jwtSecret=e}generateRefreshToken=(r,t="1d")=>new e({clerkRefreshToken:r}).setProtectedHeader({alg:"HS256"}).setIssuedAt().setExpirationTime(t).sign(Buffer.from(this._jwtSecret,"base64"));parseIdToken=e=>{let s=r(e);return t.parse(s)};parseRefreshToken=e=>{let t=r(e);return s.parse(t)}}
@@ -0,0 +1,4 @@
1
+ export { ClerkBackendApiClient } from './clerk-backend-api-client.js';
2
+ export { ClerkError, ClerkInvitationStatus, ClerkRole, ClerkUserStatus, IdTokenData, Invitation, RefreshTokenData, User, UserDelete, UserInvite, UserTag, UserUpdate, } from './clerk-backend-api-types.js';
3
+ export { ClerkSessionTokenClaims, isClerkSessionToken, verifyClerkSessionToken } from './clerk-session-token.js';
4
+ export { ClerkTokenService } from './clerk-token-service.js';
@@ -0,0 +1 @@
1
+ export{ClerkBackendApiClient}from"./clerk-backend-api-client.js";export{ClerkError,ClerkInvitationStatus,ClerkRole,ClerkUserStatus,IdTokenData,Invitation,RefreshTokenData,User,UserDelete,UserInvite,UserTag,UserUpdate}from"./clerk-backend-api-types.js";export{ClerkSessionTokenClaims,isClerkSessionToken,verifyClerkSessionToken}from"./clerk-session-token.js";export{ClerkTokenService}from"./clerk-token-service.js";
@@ -0,0 +1,10 @@
1
+ import { Branded } from '@salsita-ai/common/utils';
2
+ import { type CustomerId } from './customer-domain.js';
3
+ import { type BucketTimestamp } from './session-domain.js';
4
+ export type AiImageCount = Branded<'AiImageCount', number>;
5
+ export declare const AiImageCount: (count: number) => AiImageCount;
6
+ export interface NewAiImageBucket {
7
+ readonly customerId: CustomerId;
8
+ readonly bucketTimestamp: BucketTimestamp;
9
+ readonly imageCount: AiImageCount;
10
+ }
@@ -0,0 +1 @@
1
+ import{Branded as o}from"@salsita-ai/common/utils";export const AiImageCount=t=>{if(t<0)throw Error("AI image count cannot be negative");return o(t)};
@@ -0,0 +1,8 @@
1
+ import { Branded } from '@salsita-ai/common/utils';
2
+ /**
3
+ * Identifies one API token: a long-lived, revocable credential that authenticates calls to the Phoenix API on
4
+ * behalf of the user who approved it. The id names the token in revocation and in the request session; it is
5
+ * never the secret itself.
6
+ */
7
+ export type ApiTokenId = Branded<'ApiTokenId', string>;
8
+ export declare const ApiTokenId: (id: string) => ApiTokenId;
@@ -0,0 +1 @@
1
+ import{validate as o}from"uuid";import{Branded as i}from"@salsita-ai/common/utils";export const ApiTokenId=r=>{if(!o(r))throw Error(`Invalid API token id: ${r}. It must be a valid UUID.`);return i(r)};
@@ -0,0 +1,22 @@
1
+ import { Branded } from '@salsita-ai/common/utils';
2
+ import { type ApplicationType } from './deployment-domain.js';
3
+ import { type EnvironmentId } from './environment-domain.js';
4
+ export type ConfigurationSchemaId = Branded<'ConfigurationSchemaId', string>;
5
+ export declare const ConfigurationSchemaId: (id: string) => ConfigurationSchemaId;
6
+ export type ConfigurationSchemaVersion = Branded<'ConfigurationSchemaVersion', number>;
7
+ export declare const ConfigurationSchemaVersion: (version: number) => ConfigurationSchemaVersion;
8
+ export type ConfigurationSchemaJsonSchema = Branded<'ConfigurationSchemaJsonSchema', Record<string, unknown>>;
9
+ export declare const ConfigurationSchemaJsonSchema: (schema: unknown) => ConfigurationSchemaJsonSchema;
10
+ export interface NewConfigurationSchema {
11
+ id: null;
12
+ environmentId: EnvironmentId;
13
+ schema: ConfigurationSchemaJsonSchema;
14
+ version: ConfigurationSchemaVersion;
15
+ applicationType: ApplicationType;
16
+ }
17
+ export interface ConfigurationSchema {
18
+ id: ConfigurationSchemaId;
19
+ environmentId: EnvironmentId;
20
+ schema: ConfigurationSchemaJsonSchema;
21
+ version: ConfigurationSchemaVersion;
22
+ }
@@ -0,0 +1 @@
1
+ import{validate as o}from"uuid";import{Branded as r}from"@salsita-ai/common/utils";export const ConfigurationSchemaId=i=>{if(!o(i))throw Error(`Invalid configuration schema id: ${i}. It must be a valid UUID.`);return r(i)};export const ConfigurationSchemaVersion=o=>{if(!(o>0&&Number.isSafeInteger(o)))throw Error(`Invalid configuration schema version: ${o}. It must be a positive integer.`);return r(o)};export const ConfigurationSchemaJsonSchema=o=>r(o);
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod';
2
+ import { Branded, type ValueOf } from '@salsita-ai/common/utils';
3
+ export type CustomerId = Branded<'CustomerId', string>;
4
+ export declare const CustomerId: (id: string) => CustomerId;
5
+ export type CustomerName = Branded<'CustomerName', string>;
6
+ export declare const CustomerName: (name: string) => CustomerName;
7
+ export type CustomerSlug = Branded<'CustomerSlug', string>;
8
+ export declare const CustomerSlug: (slug: string) => CustomerSlug;
9
+ declare const customerTypes: {
10
+ readonly Standard: 'standard';
11
+ readonly SdkBuilder: 'sdk_builder';
12
+ };
13
+ /**
14
+ * Kind of a customer, fixed when the customer is created. Standard customers use Studio to manage projects,
15
+ * environments and deployments built from their own repositories. SDK builders build a single application-spec
16
+ * project with the SDK alone and deploy it with the `phoenix` CLI; the server bootstraps their project and
17
+ * `production` environment and gives them a separate Studio experience.
18
+ */
19
+ export type CustomerType = ValueOf<typeof customerTypes>;
20
+ export declare const CustomerTypeSchema: z.ZodNativeEnum<{
21
+ readonly Standard: 'standard';
22
+ readonly SdkBuilder: 'sdk_builder';
23
+ }>;
24
+ export declare const CustomerType: ((value: string) => CustomerType) & {
25
+ readonly Standard: 'standard';
26
+ readonly SdkBuilder: 'sdk_builder';
27
+ };
28
+ export type CustomerClerkSecretKey = Branded<'CustomerClerkSecretKey', string>;
29
+ export declare const CustomerClerkSecretKey: (key: string) => CustomerClerkSecretKey;
30
+ export type CustomerClerkPublishableKey = Branded<'CustomerClerkPublishableKey', string>;
31
+ export declare const CustomerClerkPublishableKey: (key: string) => CustomerClerkPublishableKey;
32
+ export type CustomerClerkOAuthClientId = Branded<'CustomerClerkOAuthClientId', string>;
33
+ export declare const CustomerClerkOAuthClientId: (id: string) => CustomerClerkOAuthClientId;
34
+ export type CustomerClerkOAuthClientSecret = Branded<'CustomerClerkOAuthClientSecret', string>;
35
+ export declare const CustomerClerkOAuthClientSecret: (secret: string) => CustomerClerkOAuthClientSecret;
36
+ export type CustomerClerkOAuthBaseUrl = Branded<'CustomerClerkOAuthBaseUrl', string>;
37
+ export declare const CustomerClerkOAuthBaseUrl: (url: string) => CustomerClerkOAuthBaseUrl;
38
+ export type CustomerClerkJwtSecret = Branded<'CustomerClerkJwtSecret', string>;
39
+ export declare const CustomerClerkJwtSecret: (secret: string) => CustomerClerkJwtSecret;
40
+ export interface CustomerClerkOAuthSettings {
41
+ readonly clientId: CustomerClerkOAuthClientId;
42
+ readonly clientSecret: CustomerClerkOAuthClientSecret;
43
+ readonly baseUrl: CustomerClerkOAuthBaseUrl;
44
+ readonly jwtSecretBase64: CustomerClerkJwtSecret;
45
+ }
46
+ export interface CustomerClerkSettings {
47
+ readonly clerkPublishableKey: CustomerClerkPublishableKey;
48
+ readonly clerkSecretKey: CustomerClerkSecretKey;
49
+ readonly oauthSettings: CustomerClerkOAuthSettings | null;
50
+ }
51
+ export interface Customer {
52
+ readonly id: CustomerId;
53
+ readonly name: CustomerName;
54
+ readonly slug: CustomerSlug | null;
55
+ readonly type: CustomerType;
56
+ readonly clerkSettings: CustomerClerkSettings | null;
57
+ readonly overviewEnabled: boolean;
58
+ readonly activityAnalyticsEnabled: boolean;
59
+ readonly configurationListEnabled: boolean;
60
+ readonly configurationPreviewEnabled: boolean;
61
+ readonly integratedAdminEnabled: boolean;
62
+ readonly releaseToProductionEnabled: boolean;
63
+ readonly connectedProvidersEnabled: boolean;
64
+ readonly aiPreviewEnabled: boolean;
65
+ readonly aiAssistantEnabled: boolean;
66
+ readonly aiImageLimit: number;
67
+ readonly imageRenderLimitEnabled: boolean;
68
+ }
69
+ export {};
@@ -0,0 +1 @@
1
+ import{validate as t}from"uuid";import{z as e}from"zod";import{Branded as r}from"@salsita-ai/common/utils";export const CustomerId=e=>{if(!t(e))throw Error(`Invalid Customer id: ${e}. It must be a valid UUID.`);return r(e)};export const CustomerName=t=>{if(!t||0===t.trim().length)throw Error("Customer name is required and cannot be empty");return r(t.trim())};export const CustomerSlug=t=>r(t);let o={Standard:"standard",SdkBuilder:"sdk_builder"};export const CustomerTypeSchema=e.nativeEnum(o);export const CustomerType=Object.assign(t=>{let e=CustomerTypeSchema.safeParse(t);if(!e.success)throw Error(`Invalid customer type: ${t}. It must be one of ${Object.values(o).join(", ")}.`);return e.data},o);export const CustomerClerkSecretKey=t=>r(t);export const CustomerClerkPublishableKey=t=>r(t);export const CustomerClerkOAuthClientId=t=>r(t);export const CustomerClerkOAuthClientSecret=t=>r(t);export const CustomerClerkOAuthBaseUrl=t=>r(t);export const CustomerClerkJwtSecret=t=>r(t);
@@ -0,0 +1,78 @@
1
+ import { Branded, type ValueOf } from '@salsita-ai/common/utils';
2
+ import type { DeploymentId } from './deployment-domain.js';
3
+ import type { EnvironmentId } from './environment-domain.js';
4
+ export type DeploymentBuildId = Branded<'DeploymentBuildId', string>;
5
+ export declare const DeploymentBuildId: (id: string) => DeploymentBuildId;
6
+ /**
7
+ * Key of the source archive a builder uploaded for an upload build. The server resolves it to the stored object, so
8
+ * only a plain object key is accepted.
9
+ */
10
+ export type DeploymentBuildSourceKey = Branded<'DeploymentBuildSourceKey', string>;
11
+ export declare const DeploymentBuildSourceKey: (key: string) => DeploymentBuildSourceKey;
12
+ declare const deploymentBuildModes: {
13
+ readonly Init: 'init';
14
+ readonly Upload: 'upload';
15
+ };
16
+ /**
17
+ * What a build deploys. An init build deploys the hello-world starter to a new SDK-builder environment and creates
18
+ * its infrastructure on the way; an upload build deploys the project sources the builder uploaded with the CLI.
19
+ */
20
+ export type DeploymentBuildMode = ValueOf<typeof deploymentBuildModes>;
21
+ export declare const DeploymentBuildMode: ((value: string) => DeploymentBuildMode) & {
22
+ readonly Init: 'init';
23
+ readonly Upload: 'upload';
24
+ };
25
+ declare const deploymentBuildStatuses: {
26
+ readonly Queued: 'queued';
27
+ readonly Preparing: 'preparing';
28
+ readonly Building: 'building';
29
+ readonly Deploying: 'deploying';
30
+ readonly Live: 'live';
31
+ readonly Failed: 'failed';
32
+ readonly Cancelled: 'cancelled';
33
+ };
34
+ /**
35
+ * Where a build is in its run. The server sets `queued`; the runner reports every later status in order while it
36
+ * prepares the deployment, builds the project in isolation and deploys it. `cancelled` means the run stopped before
37
+ * deploying, usually because a newer build of the same environment superseded it.
38
+ */
39
+ export type DeploymentBuildStatus = ValueOf<typeof deploymentBuildStatuses>;
40
+ export declare const DeploymentBuildStatus: ((value: string) => DeploymentBuildStatus) & {
41
+ readonly Queued: 'queued';
42
+ readonly Preparing: 'preparing';
43
+ readonly Building: 'building';
44
+ readonly Deploying: 'deploying';
45
+ readonly Live: 'live';
46
+ readonly Failed: 'failed';
47
+ readonly Cancelled: 'cancelled';
48
+ };
49
+ /**
50
+ * One build and deployment of an SDK-builder environment, from queueing to its final status. The build log is
51
+ * stored with the build but kept off this entity, because only the build detail view needs it.
52
+ */
53
+ export interface DeploymentBuild {
54
+ readonly id: DeploymentBuildId;
55
+ readonly environmentId: EnvironmentId;
56
+ readonly mode: DeploymentBuildMode;
57
+ readonly status: DeploymentBuildStatus;
58
+ readonly sourceKey: DeploymentBuildSourceKey | null;
59
+ readonly sdkVersion: string | null;
60
+ readonly createdByUserId: string | null;
61
+ readonly deploymentId: DeploymentId | null;
62
+ readonly error: string | null;
63
+ readonly createdAt: Date;
64
+ readonly updatedAt: Date;
65
+ readonly preparingAt: Date | null;
66
+ readonly buildingAt: Date | null;
67
+ readonly deployingAt: Date | null;
68
+ readonly finishedAt: Date | null;
69
+ }
70
+ declare const isFinished: (status: DeploymentBuildStatus) => boolean;
71
+ /**
72
+ * The rule every client shares about a build: whether its status is final. The server adds the queueing and
73
+ * status-transition behaviour on its side.
74
+ */
75
+ export declare const DeploymentBuild: {
76
+ isFinished: typeof isFinished;
77
+ };
78
+ export {};
@@ -0,0 +1 @@
1
+ import{validate as e}from"uuid";import{z as t}from"zod";import{Branded as i}from"@salsita-ai/common/utils";export const DeploymentBuildId=t=>{if(!e(t))throw Error(`Invalid deployment build id: ${t}. It must be a valid UUID.`);return i(t)};export const DeploymentBuildSourceKey=e=>{if(!(e.length>0&&!e.startsWith("/")&&!/\s/.test(e)&&!e.split("/").includes("..")))throw Error(`Invalid deployment build source key: "${e}". It must be a non-empty S3 object key without a leading slash, whitespace or ".." segments.`);return i(e)};let l={Init:"init",Upload:"upload"},o=t.nativeEnum(l);export const DeploymentBuildMode=Object.assign(e=>{let t=o.safeParse(e);if(!t.success)throw Error(`Invalid deployment build mode: ${e}. It must be one of ${Object.values(l).join(", ")}.`);return t.data},l);let n={Queued:"queued",Preparing:"preparing",Building:"building",Deploying:"deploying",Live:"live",Failed:"failed",Cancelled:"cancelled"},s=t.nativeEnum(n);export const DeploymentBuildStatus=Object.assign(e=>{let t=s.safeParse(e);if(!t.success)throw Error(`Invalid deployment build status: ${e}. It must be one of ${Object.values(n).join(", ")}.`);return t.data},n);export const DeploymentBuild={isFinished:e=>e===DeploymentBuildStatus.Live||e===DeploymentBuildStatus.Failed||e===DeploymentBuildStatus.Cancelled};
@@ -0,0 +1,126 @@
1
+ import { z } from 'zod';
2
+ import { Branded, type ValueOf } from '@salsita-ai/common/utils';
3
+ import { type ConfigurationSchemaId } from './configuration-schema-domain.js';
4
+ import { type EnvironmentId } from './environment-domain.js';
5
+ import { type OAuthProviderId } from './oauth-provider-domain.js';
6
+ export declare const ApplicationType: {
7
+ readonly Configurator: 'configurator';
8
+ readonly Admin: 'admin';
9
+ };
10
+ export type ApplicationType = ValueOf<typeof ApplicationType>;
11
+ export type DeploymentId = Branded<'DeploymentId', string>;
12
+ export declare const DeploymentId: (id: string) => DeploymentId;
13
+ export type DeploymentApplicationId = Branded<'DeploymentApplicationId', string>;
14
+ export declare const DeploymentApplicationId: (id: string) => DeploymentApplicationId;
15
+ export type AllowedOrigin = Branded<'AllowedOrigin', string>;
16
+ export declare const AllowedOrigin: (origin: string) => AllowedOrigin;
17
+ export type ResourceUrl = Branded<'DeploymentResourceUrl', string>;
18
+ export declare const ResourceUrl: (url: string) => ResourceUrl;
19
+ export type PrivateS3Bucket = Branded<'PrivateS3Bucket', string>;
20
+ export declare const PrivateS3Bucket: (bucket: string) => PrivateS3Bucket;
21
+ export type PrivateDeploymentResourcesPath = Branded<'PrivateDeploymentResourcesPath', string>;
22
+ export declare const PrivateDeploymentResourcesPath: (path: string) => PrivateDeploymentResourcesPath;
23
+ export type PublicS3Bucket = Branded<'PublicS3Bucket', string>;
24
+ export declare const PublicS3Bucket: (bucket: string) => PublicS3Bucket;
25
+ export type PublicDeploymentResourcesPath = Branded<'PublicDeploymentResourcesPath', string>;
26
+ export declare const PublicDeploymentResourcesPath: (path: string) => PublicDeploymentResourcesPath;
27
+ export type LambdaWebhookUrl = Branded<'LambdaWebhookUrl', string>;
28
+ export declare const LambdaWebhookUrl: (url: string) => LambdaWebhookUrl;
29
+ export declare const OAuthProviderRegistration: z.ZodObject<{
30
+ name: z.ZodString;
31
+ clientId: z.ZodString;
32
+ clientSecret: z.ZodString;
33
+ baseUrl: z.ZodString;
34
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ name: string;
37
+ clientId: string;
38
+ clientSecret: string;
39
+ baseUrl: string;
40
+ scopes?: string[] | undefined;
41
+ }, {
42
+ name: string;
43
+ clientId: string;
44
+ clientSecret: string;
45
+ baseUrl: string;
46
+ scopes?: string[] | undefined;
47
+ }>;
48
+ export type OAuthProviderRegistration = z.infer<typeof OAuthProviderRegistration>;
49
+ interface ChatPromptDefinition {
50
+ name: string;
51
+ model: string;
52
+ prompt: string;
53
+ }
54
+ export interface ChatAugmentation extends ChatPromptDefinition {
55
+ parameters?: Record<string, unknown>;
56
+ }
57
+ export interface ChatAgent extends ChatPromptDefinition {
58
+ functions?: string[] | undefined;
59
+ augmentations?: string[] | undefined;
60
+ }
61
+ export interface ChatFunction {
62
+ name: string;
63
+ description: string;
64
+ parameters?: Record<string, unknown>;
65
+ }
66
+ export interface ChatEmbedding {
67
+ chunk: string;
68
+ embedding: number[];
69
+ }
70
+ export interface ChatConfigurationData {
71
+ functions?: ChatFunction[] | undefined;
72
+ augmentations?: ChatAugmentation[] | undefined;
73
+ agents: ChatAgent[];
74
+ }
75
+ export type ChatConfiguration = Branded<'ChatConfiguration', ChatConfigurationData>;
76
+ export declare const ChatConfiguration: (configuration: ChatConfigurationData) => ChatConfiguration;
77
+ export interface DeploymentApplication {
78
+ readonly id: DeploymentApplicationId;
79
+ readonly type: ApplicationType;
80
+ readonly configurationSchemaId: ConfigurationSchemaId;
81
+ readonly collectFinalizeData: boolean;
82
+ readonly chatConfiguration: ChatConfiguration | null;
83
+ }
84
+ export interface Deployment {
85
+ readonly new: false;
86
+ readonly id: DeploymentId;
87
+ readonly environmentId: EnvironmentId;
88
+ readonly isActive: boolean;
89
+ readonly resourcesUrl: ResourceUrl;
90
+ readonly useAuthHook: boolean;
91
+ readonly lambdaWebhookUrl: LambdaWebhookUrl | null;
92
+ readonly privateS3Bucket: PrivateS3Bucket;
93
+ readonly privateDeploymentResourcesPath: PrivateDeploymentResourcesPath;
94
+ readonly publicS3Bucket: PublicS3Bucket;
95
+ readonly publicDeploymentResourcesPath: PublicDeploymentResourcesPath;
96
+ readonly applications: readonly DeploymentApplication[];
97
+ readonly oauthProviderId: OAuthProviderId | null;
98
+ readonly aclCanCreate: readonly string[] | null;
99
+ readonly applicationVersion: string | null;
100
+ readonly projectRef: string | null;
101
+ readonly projectSha: string | null;
102
+ readonly sdkVersion: string | null;
103
+ readonly publishedDataHash: string | null;
104
+ }
105
+ export interface NewDeployment {
106
+ readonly new: true;
107
+ readonly id: DeploymentId;
108
+ readonly environmentId: EnvironmentId;
109
+ readonly isActive: boolean;
110
+ readonly resourcesUrl: ResourceUrl;
111
+ readonly useAuthHook: boolean;
112
+ readonly lambdaWebhookUrl: LambdaWebhookUrl | null;
113
+ readonly privateS3Bucket: PrivateS3Bucket;
114
+ readonly privateDeploymentResourcesPath: PrivateDeploymentResourcesPath;
115
+ readonly publicS3Bucket: PublicS3Bucket;
116
+ readonly publicDeploymentResourcesPath: PublicDeploymentResourcesPath;
117
+ readonly applications: readonly DeploymentApplication[];
118
+ readonly oauthProviderId: OAuthProviderId | null;
119
+ readonly aclCanCreate: readonly string[] | null;
120
+ readonly applicationVersion: string | null;
121
+ readonly projectRef: string | null;
122
+ readonly projectSha: string | null;
123
+ readonly sdkVersion: string | null;
124
+ readonly publishedDataHash: string | null;
125
+ }
126
+ export {};
@@ -0,0 +1 @@
1
+ import{validate as t}from"uuid";import{isUri as r}from"valid-url";import{z as o}from"zod";import{Branded as e}from"@salsita-ai/common/utils";export const ApplicationType={Configurator:"configurator",Admin:"admin"};export const DeploymentId=r=>{if(!t(r))throw Error(`Invalid deployment id: ${r}. It must be a valid UUID.`);return e(r)};export const DeploymentApplicationId=r=>{if(!t(r))throw Error(`Invalid DeploymentApplication id: ${r}. It must be a valid UUID.`);return e(r)};export const AllowedOrigin=t=>{if(!r(t))throw Error(`Invalid allowed origin: ${t}. It must be a valid URI.`);return e(t)};export const ResourceUrl=t=>{if(!r(t))throw Error(`Invalid resource url: ${t}. It must be a valid URI.`);return e(t)};export const PrivateS3Bucket=t=>e(t);export const PrivateDeploymentResourcesPath=t=>e(t);export const PublicS3Bucket=t=>e(t);export const PublicDeploymentResourcesPath=t=>e(t);export const LambdaWebhookUrl=t=>e(t);export const OAuthProviderRegistration=o.object({name:o.string(),clientId:o.string(),clientSecret:o.string(),baseUrl:o.string().url(),scopes:o.array(o.string()).optional()});export const ChatConfiguration=t=>{let r=t.functions??[],o=t.augmentations??[];if(!t.agents.every(t=>(t.functions??[]).every(t=>r.some(r=>r.name===t))&&(t.augmentations??[]).every(t=>o.some(r=>r.name===t))))throw Error("Invalid chat configuration.");return e(t)};
@@ -0,0 +1,9 @@
1
+ import { type DeploymentApplicationId } from './deployment-domain.js';
2
+ export interface ChatEmbedding {
3
+ chunk: string;
4
+ embedding: number[];
5
+ }
6
+ export interface Embeddings {
7
+ deployedApplicationId: DeploymentApplicationId;
8
+ embeddings: ChatEmbedding[] | null;
9
+ }
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,107 @@
1
+ import { Branded, type ValueOf } from '@salsita-ai/common/utils';
2
+ import { type CustomerClerkSettings } from './customer-domain.js';
3
+ import type { AllowedOrigin, DeploymentId, PrivateS3Bucket, PublicS3Bucket } from './deployment-domain.js';
4
+ import type { ImageRenderLimit } from './image-render-domain.js';
5
+ import type { ParamStorePath, ProjectCustomDomain, ProjectId, ProjectSlug } from './project-domain.js';
6
+ export type SessionLimit = Branded<'SessionLimit', number>;
7
+ export declare const SessionLimit: (limit: number) => SessionLimit;
8
+ export type EnvironmentId = Branded<'EnvironmentId', string>;
9
+ export declare const EnvironmentId: (id: string) => EnvironmentId;
10
+ export type EnvironmentName = Branded<'EnvironmentName', string>;
11
+ export declare const EnvironmentName: (name: string) => EnvironmentName;
12
+ export type EnvironmentSlug = Branded<'EnvironmentSlug', string>;
13
+ export declare const EnvironmentSlug: (slug: string) => EnvironmentSlug;
14
+ export type FrontendUrl = Branded<'FrontendUrl', string>;
15
+ export declare const FrontendUrl: (url: string) => FrontendUrl;
16
+ export type ServerKey = Branded<'ServerKey', string>;
17
+ export declare const ServerKey: (key: string) => ServerKey;
18
+ export type BaseDomain = Branded<'BaseDomain', string>;
19
+ export declare const BaseDomain: (domain: string) => BaseDomain;
20
+ export type ServiceName = Branded<'ServiceName', string>;
21
+ export declare const ServiceName: (name: string) => ServiceName;
22
+ export type FrontendBucketName = Branded<'FrontendBucketName', string>;
23
+ export declare const FrontendBucketName: (name: string) => FrontendBucketName;
24
+ export declare const DEFAULT_SESSION_LIMIT: SessionLimit;
25
+ export declare const PRODUCTION_ENVIRONMENT_SLUG: EnvironmentSlug;
26
+ declare const environmentTypes: {
27
+ readonly Normal: 'normal';
28
+ readonly Transient: 'transient';
29
+ readonly Development: 'development';
30
+ };
31
+ /**
32
+ * Explicit kind of an environment. Normal environments are provisioned deployment targets, transient
33
+ * environments are short-lived CI targets that the cleanup endpoint may delete, and development environments
34
+ * are never provisioned: they run locally against a localhost frontend with a stored bucket pair.
35
+ */
36
+ export type EnvironmentType = ValueOf<typeof environmentTypes>;
37
+ export declare const EnvironmentType: ((value: string) => EnvironmentType) & {
38
+ readonly Normal: 'normal';
39
+ readonly Transient: 'transient';
40
+ readonly Development: 'development';
41
+ };
42
+ /**
43
+ * Plaintext secret that authenticates one development environment on the server. It is returned exactly
44
+ * once when the environment is created or the key is regenerated, only its hash is persisted, and every
45
+ * request carrying it also names the project and environment slugs so the key can be verified against the
46
+ * stored hash of that one environment.
47
+ */
48
+ export type DevelopmentKey = Branded<'DevelopmentKey', string>;
49
+ export declare const DevelopmentKey: (key: string) => DevelopmentKey;
50
+ export interface Environment {
51
+ readonly id: EnvironmentId;
52
+ readonly name: EnvironmentName;
53
+ readonly slug: EnvironmentSlug;
54
+ readonly projectId: ProjectId;
55
+ readonly projectSlug: ProjectSlug;
56
+ readonly paramStorePath: ParamStorePath;
57
+ readonly projectCustomDomain: ProjectCustomDomain | null;
58
+ readonly customerClerkSettings: CustomerClerkSettings | null;
59
+ readonly activeDeployment: {
60
+ readonly id: DeploymentId;
61
+ } | null;
62
+ readonly type: EnvironmentType;
63
+ readonly transient: boolean;
64
+ readonly frontendUrl: FrontendUrl | null;
65
+ readonly allowedOrigins: readonly AllowedOrigin[];
66
+ readonly sessionLimit: SessionLimit;
67
+ readonly imageRenderLimit: ImageRenderLimit;
68
+ readonly publicS3Bucket: PublicS3Bucket;
69
+ readonly privateS3Bucket: PrivateS3Bucket;
70
+ readonly serviceName: ServiceName;
71
+ readonly frontendBucketName: FrontendBucketName;
72
+ readonly lambdaFunctionName: LambdaFunctionName;
73
+ readonly tfStateKeyPrefix: TfStateKeyPrefix;
74
+ readonly ddServiceName: DdServiceName;
75
+ readonly editorEnabled: boolean;
76
+ readonly overrideSchema: boolean;
77
+ }
78
+ export interface NewEnvironment {
79
+ readonly id: EnvironmentId;
80
+ readonly name: EnvironmentName;
81
+ readonly slug: EnvironmentSlug;
82
+ readonly projectId: ProjectId;
83
+ readonly activeDeployment: null;
84
+ readonly new: true;
85
+ readonly type: EnvironmentType;
86
+ readonly transient: boolean;
87
+ readonly frontendUrl: FrontendUrl | null;
88
+ readonly allowedOrigins: readonly AllowedOrigin[];
89
+ readonly sessionLimit: SessionLimit;
90
+ readonly imageRenderLimit: ImageRenderLimit;
91
+ readonly publicS3Bucket: PublicS3Bucket;
92
+ readonly privateS3Bucket: PrivateS3Bucket;
93
+ readonly serviceName: ServiceName;
94
+ readonly frontendBucketName: FrontendBucketName;
95
+ readonly lambdaFunctionName: LambdaFunctionName;
96
+ readonly tfStateKeyPrefix: TfStateKeyPrefix;
97
+ readonly ddServiceName: DdServiceName;
98
+ readonly editorEnabled: boolean;
99
+ readonly overrideSchema: boolean;
100
+ }
101
+ export type LambdaFunctionName = Branded<'LambdaFunctionName', string>;
102
+ export declare const LambdaFunctionName: (name: string) => LambdaFunctionName;
103
+ export type TfStateKeyPrefix = Branded<'TfStateKeyPrefix', string>;
104
+ export declare const TfStateKeyPrefix: (prefix: string) => TfStateKeyPrefix;
105
+ export type DdServiceName = Branded<'DdServiceName', string>;
106
+ export declare const DdServiceName: (name: string) => DdServiceName;
107
+ export {};
@@ -0,0 +1 @@
1
+ import{validate as e}from"uuid";import{isUri as t}from"valid-url";import{z as r}from"zod";import{Branded as n}from"@salsita-ai/common/utils";export const SessionLimit=e=>{if(e<0)throw Error("Session limit cannot be negative");return n(e)};export const EnvironmentId=t=>{if(!e(t))throw Error(`Invalid environment id: ${t}. It must be a valid UUID.`);return n(t)};export const EnvironmentName=e=>n(e);export const EnvironmentSlug=e=>{let t=e.trim();if(0===t.length)throw Error("Environment slug cannot be empty, environment slug is required for repository and domain creation, please provide a valid slug.");if(t.length<3)throw Error("Environment slug is too short, environment slug must be at least 3 characters long, please provide a longer slug.");if(!/^[a-z0-9-]+$/.test(t))throw Error("Environment slug format is invalid, environment slug must contain only lowercase letters, numbers, and hyphens, please provide a valid slug.");return n(t)};export const FrontendUrl=e=>{if(!t(e))throw Error(`Invalid frontend url: ${e}. It must be a valid URI.`);return n(e)};export const ServerKey=e=>n(e);export const BaseDomain=e=>n(e);export const ServiceName=e=>n(e);export const FrontendBucketName=e=>n(e);export const DEFAULT_SESSION_LIMIT=SessionLimit(3e3);export const PRODUCTION_ENVIRONMENT_SLUG=EnvironmentSlug("production");let o={Normal:"normal",Transient:"transient",Development:"development"},i=r.nativeEnum(o);export const EnvironmentType=Object.assign(e=>{let t=i.safeParse(e);if(!t.success)throw Error(`Invalid environment type: ${e}. It must be one of ${Object.values(o).join(", ")}.`);return t.data},o);let s=/^dev_[a-z0-9-]+_[a-z0-9-]+_[A-Za-z0-9_-]+$/;export const DevelopmentKey=e=>{if(!s.test(e))throw Error("Development key format is invalid, a development key must look like dev_<project-slug>_<environment-slug>_<random>, use the key the server issued when the development environment was created or regenerated.");return n(e)};export const LambdaFunctionName=e=>n(e);export const TfStateKeyPrefix=e=>n(e);export const DdServiceName=e=>n(e);
@@ -0,0 +1,22 @@
1
+ import { Branded } from '@salsita-ai/common/utils';
2
+ import { type DeploymentId } from './deployment-domain.js';
3
+ import { type EnvironmentId } from './environment-domain.js';
4
+ import type { BucketTimestamp } from './session-domain.js';
5
+ export type ImageRenderCount = Branded<'ImageRenderCount', number>;
6
+ export declare const ImageRenderCount: (count: number) => ImageRenderCount;
7
+ export type ImageRenderLimit = Branded<'ImageRenderLimit', number>;
8
+ export declare const ImageRenderLimit: (limit: number) => ImageRenderLimit;
9
+ export declare const DEFAULT_IMAGE_RENDER_LIMIT: ImageRenderLimit;
10
+ export interface ImageRenderBucket {
11
+ readonly environmentId: EnvironmentId;
12
+ readonly deploymentId: DeploymentId;
13
+ readonly bucketTimestamp: BucketTimestamp;
14
+ readonly imageCount: ImageRenderCount;
15
+ }
16
+ export interface NewImageRenderBucket {
17
+ readonly environmentId: EnvironmentId;
18
+ readonly deploymentId: DeploymentId;
19
+ readonly bucketTimestamp: BucketTimestamp;
20
+ readonly imageCount: ImageRenderCount;
21
+ readonly new: true;
22
+ }
@@ -0,0 +1 @@
1
+ import{Branded as e}from"@salsita-ai/common/utils";export const ImageRenderCount=r=>{if(r<0)throw Error("Image render count cannot be negative");return e(r)};export const ImageRenderLimit=r=>{if(r<0)throw Error("Image render limit cannot be negative");return e(r)};export const DEFAULT_IMAGE_RENDER_LIMIT=ImageRenderLimit(1e3);
@@ -0,0 +1,14 @@
1
+ export { type Environment, type NewEnvironment, EnvironmentId, EnvironmentName, EnvironmentSlug, EnvironmentType, FrontendUrl, DevelopmentKey, DEFAULT_SESSION_LIMIT, PRODUCTION_ENVIRONMENT_SLUG, SessionLimit, ServerKey, BaseDomain, ServiceName, FrontendBucketName, LambdaFunctionName, TfStateKeyPrefix, DdServiceName, } from './environment-domain.js';
2
+ export { type ConfigurationSchema, type NewConfigurationSchema, ConfigurationSchemaId, ConfigurationSchemaJsonSchema, ConfigurationSchemaVersion, } from './configuration-schema-domain.js';
3
+ export { ApplicationType, AllowedOrigin, ChatConfiguration, type Deployment, type NewDeployment, DeploymentId, ResourceUrl, LambdaWebhookUrl, PrivateS3Bucket, PrivateDeploymentResourcesPath, PublicS3Bucket, PublicDeploymentResourcesPath, DeploymentApplicationId, type DeploymentApplication, OAuthProviderRegistration, type ChatAgent, type ChatAugmentation, type ChatFunction, type ChatEmbedding, } from './deployment-domain.js';
4
+ export { DEFAULT_PROJECT_ALIAS, ProjectId, ProjectName, ProjectSlug, ProjectCustomDomain, ParamStorePath, type Project, } from './project-domain.js';
5
+ export { OAuthProviderId, OAuthClientId, OAuthClientSecret, OAuthBaseUrl, type OAuthProvider, OAuthProviderName, OAuthScopes, } from './oauth-provider-domain.js';
6
+ export { DeploymentBuild, DeploymentBuildId, DeploymentBuildMode, DeploymentBuildSourceKey, DeploymentBuildStatus, } from './deployment-build-domain.js';
7
+ export { SdkBuilderSetupState } from './sdk-builder-setup-domain.js';
8
+ export { ApiTokenId } from './api-token-domain.js';
9
+ export { CustomerId, CustomerName, type Customer, CustomerClerkPublishableKey, CustomerClerkSecretKey, CustomerClerkJwtSecret, CustomerClerkOAuthBaseUrl, CustomerClerkOAuthClientId, CustomerClerkOAuthClientSecret, type CustomerClerkSettings, CustomerSlug, CustomerType, CustomerTypeSchema, } from './customer-domain.js';
10
+ export { OAuthConnectionId, type OAuthConnectionProvider, OAuthRefreshToken, OAuthGrantedScopes, SHAREPOINT_MISSING_TENANT_DOMAIN, SharePointTenantDomainInvalidError, SharePointTenantDomainSchema, type NewOAuthConnection, type OAuthConnection, type SharePointProjectSite, OAUTH_STALE_CONNECTION_CODE, parseRequiredSharePointTenantDomain, parseSharePointTenantDomain, } from './oauth-connection-domain.js';
11
+ export { type Embeddings } from './embedding-domain.js';
12
+ export { BucketTimestamp, SessionCount, type SessionBucket, type NewSessionBucket } from './session-domain.js';
13
+ export { AiImageCount, type NewAiImageBucket } from './ai-image-domain.js';
14
+ export { ImageRenderCount, ImageRenderLimit, DEFAULT_IMAGE_RENDER_LIMIT, type ImageRenderBucket, type NewImageRenderBucket, } from './image-render-domain.js';
@@ -0,0 +1 @@
1
+ export{EnvironmentId,EnvironmentName,EnvironmentSlug,EnvironmentType,FrontendUrl,DevelopmentKey,DEFAULT_SESSION_LIMIT,PRODUCTION_ENVIRONMENT_SLUG,SessionLimit,ServerKey,BaseDomain,ServiceName,FrontendBucketName,LambdaFunctionName,TfStateKeyPrefix,DdServiceName}from"./environment-domain.js";export{ConfigurationSchemaId,ConfigurationSchemaJsonSchema,ConfigurationSchemaVersion}from"./configuration-schema-domain.js";export{ApplicationType,AllowedOrigin,ChatConfiguration,DeploymentId,ResourceUrl,LambdaWebhookUrl,PrivateS3Bucket,PrivateDeploymentResourcesPath,PublicS3Bucket,PublicDeploymentResourcesPath,DeploymentApplicationId,OAuthProviderRegistration}from"./deployment-domain.js";export{DEFAULT_PROJECT_ALIAS,ProjectId,ProjectName,ProjectSlug,ProjectCustomDomain,ParamStorePath}from"./project-domain.js";export{OAuthProviderId,OAuthClientId,OAuthClientSecret,OAuthBaseUrl,OAuthProviderName,OAuthScopes}from"./oauth-provider-domain.js";export{DeploymentBuild,DeploymentBuildId,DeploymentBuildMode,DeploymentBuildSourceKey,DeploymentBuildStatus}from"./deployment-build-domain.js";export{SdkBuilderSetupState}from"./sdk-builder-setup-domain.js";export{ApiTokenId}from"./api-token-domain.js";export{CustomerId,CustomerName,CustomerClerkPublishableKey,CustomerClerkSecretKey,CustomerClerkJwtSecret,CustomerClerkOAuthBaseUrl,CustomerClerkOAuthClientId,CustomerClerkOAuthClientSecret,CustomerSlug,CustomerType,CustomerTypeSchema}from"./customer-domain.js";export{OAuthConnectionId,OAuthRefreshToken,OAuthGrantedScopes,SHAREPOINT_MISSING_TENANT_DOMAIN,SharePointTenantDomainInvalidError,SharePointTenantDomainSchema,OAUTH_STALE_CONNECTION_CODE,parseRequiredSharePointTenantDomain,parseSharePointTenantDomain}from"./oauth-connection-domain.js";export{BucketTimestamp,SessionCount}from"./session-domain.js";export{AiImageCount}from"./ai-image-domain.js";export{ImageRenderCount,ImageRenderLimit,DEFAULT_IMAGE_RENDER_LIMIT}from"./image-render-domain.js";