@salsita-ai/contracts 0.0.0-stage → 0.49.0-develop.cbee856178
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/CHANGELOG.md +419 -0
- package/LICENSE +61 -0
- package/README.md +28 -2
- package/dist/api/access-level.d.ts +7 -0
- package/dist/api/access-level.js +1 -0
- package/dist/api/access-token.d.ts +6 -0
- package/dist/api/access-token.js +1 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.js +1 -0
- package/dist/api/session-role.d.ts +8 -0
- package/dist/api/session-role.js +1 -0
- package/dist/api/session-token.d.ts +22 -0
- package/dist/api/session-token.js +1 -0
- package/dist/assistant/browser-details-tool.d.ts +16 -0
- package/dist/assistant/browser-details-tool.js +1 -0
- package/dist/assistant/deployment-assistant.d.ts +84 -0
- package/dist/assistant/deployment-assistant.js +1 -0
- package/dist/assistant/graphql-tools.d.ts +120 -0
- package/dist/assistant/graphql-tools.js +1 -0
- package/dist/assistant/index.d.ts +6 -0
- package/dist/assistant/index.js +1 -0
- package/dist/assistant/message-metadata.d.ts +17 -0
- package/dist/assistant/message-metadata.js +1 -0
- package/dist/chat/api.d.ts +52 -0
- package/dist/chat/api.js +1 -0
- package/dist/chat/completions/messages.d.ts +3 -0
- package/dist/chat/completions/messages.js +1 -0
- package/dist/chat/completions/types.d.ts +28 -0
- package/dist/chat/completions/types.js +1 -0
- package/dist/chat/functions/augmentations.d.ts +3 -0
- package/dist/chat/functions/augmentations.js +1 -0
- package/dist/chat/functions/create.d.ts +5 -0
- package/dist/chat/functions/create.js +1 -0
- package/dist/chat/functions/process.d.ts +14 -0
- package/dist/chat/functions/process.js +1 -0
- package/dist/chat/functions/types.d.ts +21 -0
- package/dist/chat/functions/types.js +1 -0
- package/dist/chat/functions/validate.d.ts +1 -0
- package/dist/chat/functions/validate.js +2 -0
- package/dist/chat/index.d.ts +10 -0
- package/dist/chat/index.js +1 -0
- package/dist/chat/utils/types.d.ts +1 -0
- package/dist/chat/utils/types.js +1 -0
- package/dist/clerk/clerk-backend-api-client.d.ts +129 -0
- package/dist/clerk/clerk-backend-api-client.js +1 -0
- package/dist/clerk/clerk-backend-api-types.d.ts +740 -0
- package/dist/clerk/clerk-backend-api-types.js +1 -0
- package/dist/clerk/clerk-session-token.d.ts +28 -0
- package/dist/clerk/clerk-session-token.js +1 -0
- package/dist/clerk/clerk-token-service.d.ts +15 -0
- package/dist/clerk/clerk-token-service.js +1 -0
- package/dist/clerk/index.d.ts +4 -0
- package/dist/clerk/index.js +1 -0
- package/dist/domain/deployments/ai-image-domain.d.ts +10 -0
- package/dist/domain/deployments/ai-image-domain.js +1 -0
- package/dist/domain/deployments/api-token-domain.d.ts +8 -0
- package/dist/domain/deployments/api-token-domain.js +1 -0
- package/dist/domain/deployments/configuration-schema-domain.d.ts +22 -0
- package/dist/domain/deployments/configuration-schema-domain.js +1 -0
- package/dist/domain/deployments/customer-domain.d.ts +69 -0
- package/dist/domain/deployments/customer-domain.js +1 -0
- package/dist/domain/deployments/deployment-build-domain.d.ts +78 -0
- package/dist/domain/deployments/deployment-build-domain.js +1 -0
- package/dist/domain/deployments/deployment-domain.d.ts +126 -0
- package/dist/domain/deployments/deployment-domain.js +1 -0
- package/dist/domain/deployments/embedding-domain.d.ts +9 -0
- package/dist/domain/deployments/embedding-domain.js +1 -0
- package/dist/domain/deployments/environment-domain.d.ts +107 -0
- package/dist/domain/deployments/environment-domain.js +1 -0
- package/dist/domain/deployments/image-render-domain.d.ts +22 -0
- package/dist/domain/deployments/image-render-domain.js +1 -0
- package/dist/domain/deployments/index.d.ts +14 -0
- package/dist/domain/deployments/index.js +1 -0
- package/dist/domain/deployments/oauth-connection-domain.d.ts +62 -0
- package/dist/domain/deployments/oauth-connection-domain.js +1 -0
- package/dist/domain/deployments/oauth-provider-domain.d.ts +23 -0
- package/dist/domain/deployments/oauth-provider-domain.js +1 -0
- package/dist/domain/deployments/project-domain.d.ts +26 -0
- package/dist/domain/deployments/project-domain.js +1 -0
- package/dist/domain/deployments/sdk-builder-setup-domain.d.ts +13 -0
- package/dist/domain/deployments/sdk-builder-setup-domain.js +1 -0
- package/dist/domain/deployments/session-domain.d.ts +20 -0
- package/dist/domain/deployments/session-domain.js +1 -0
- package/dist/domain/feedback/feedback-domain.d.ts +55 -0
- package/dist/domain/feedback/feedback-domain.js +1 -0
- package/dist/domain/feedback/index.d.ts +1 -0
- package/dist/domain/feedback/index.js +1 -0
- package/dist/domain/index.d.ts +3 -0
- package/dist/domain/index.js +1 -0
- package/dist/domain/product-configurations/configurations-domain.d.ts +113 -0
- package/dist/domain/product-configurations/configurations-domain.js +1 -0
- package/dist/domain/product-configurations/index.d.ts +1 -0
- package/dist/domain/product-configurations/index.js +1 -0
- package/dist/webhook/core/index.d.ts +3 -0
- package/dist/webhook/core/index.js +1 -0
- package/dist/webhook/core/task-resource.d.ts +80 -0
- package/dist/webhook/core/task-resource.js +1 -0
- package/dist/webhook/core/task-type.d.ts +18 -0
- package/dist/webhook/core/task-type.js +1 -0
- package/dist/webhook/core/template.d.ts +65 -0
- package/dist/webhook/core/template.js +1 -0
- package/dist/webhook/empty-xlsx.d.ts +10 -0
- package/dist/webhook/empty-xlsx.js +1 -0
- package/dist/webhook/excel-workbook-client.d.ts +78 -0
- package/dist/webhook/excel-workbook-client.js +1 -0
- package/dist/webhook/google-sheets-client.d.ts +23 -0
- package/dist/webhook/google-sheets-client.js +1 -0
- package/dist/webhook/implementation/index.d.ts +4 -0
- package/dist/webhook/implementation/index.js +1 -0
- package/dist/webhook/implementation/webhook-api-types.d.ts +302 -0
- package/dist/webhook/implementation/webhook-api-types.js +1 -0
- package/dist/webhook/implementation/webhook-client.d.ts +85 -0
- package/dist/webhook/implementation/webhook-client.js +1 -0
- package/dist/webhook/implementation/webhook-routing.d.ts +30 -0
- package/dist/webhook/implementation/webhook-routing.js +1 -0
- package/dist/webhook/implementation/webhook-tunnel-types.d.ts +114 -0
- package/dist/webhook/implementation/webhook-tunnel-types.js +1 -0
- package/dist/webhook/index.d.ts +7 -0
- package/dist/webhook/index.js +1 -0
- package/dist/webhook/spreadsheet-adapter-factory.d.ts +10 -0
- package/dist/webhook/spreadsheet-adapter-factory.js +1 -0
- package/dist/webhook/spreadsheet-adapter.d.ts +94 -0
- package/dist/webhook/spreadsheet-adapter.js +1 -0
- package/dist/webhook/tasks/call-lambda-back-task.d.ts +22 -0
- package/dist/webhook/tasks/call-lambda-back-task.js +1 -0
- package/dist/webhook/tasks/edit-google-spreadsheet-task.d.ts +48 -0
- package/dist/webhook/tasks/edit-google-spreadsheet-task.js +1 -0
- package/dist/webhook/tasks/finalize-task.d.ts +184 -0
- package/dist/webhook/tasks/finalize-task.js +1 -0
- package/dist/webhook/tasks/generate-configuration-link-task.d.ts +56 -0
- package/dist/webhook/tasks/generate-configuration-link-task.js +1 -0
- package/dist/webhook/tasks/generate-csv-task.d.ts +30 -0
- package/dist/webhook/tasks/generate-csv-task.js +1 -0
- package/dist/webhook/tasks/generate-images-task.d.ts +404 -0
- package/dist/webhook/tasks/generate-images-task.js +1 -0
- package/dist/webhook/tasks/generate-pdf-task.d.ts +188 -0
- package/dist/webhook/tasks/generate-pdf-task.js +1 -0
- package/dist/webhook/tasks/index.d.ts +13 -0
- package/dist/webhook/tasks/index.js +1 -0
- package/dist/webhook/tasks/publish-revision-chunks-staged-task.d.ts +73 -0
- package/dist/webhook/tasks/publish-revision-chunks-staged-task.js +1 -0
- package/dist/webhook/tasks/publish-revision-chunks-task.d.ts +76 -0
- package/dist/webhook/tasks/publish-revision-chunks-task.js +1 -0
- package/dist/webhook/tasks/publish-revision-task.d.ts +38 -0
- package/dist/webhook/tasks/publish-revision-task.js +1 -0
- package/dist/webhook/tasks/send-email-task.d.ts +129 -0
- package/dist/webhook/tasks/send-email-task.js +1 -0
- package/dist/webhook/tasks/send-http-task.d.ts +27 -0
- package/dist/webhook/tasks/send-http-task.js +1 -0
- package/dist/webhook/tasks/woocommerce-add-to-cart-task.d.ts +91 -0
- package/dist/webhook/tasks/woocommerce-add-to-cart-task.js +1 -0
- package/dist/webhook/webhook-payload.d.ts +56 -0
- package/dist/webhook/webhook-payload.js +1 -0
- package/package.json +84 -3
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Branded } from '@salsita-ai/common/utils';
|
|
3
|
+
import { type ProjectId } from './project-domain.js';
|
|
4
|
+
export type OAuthConnectionId = Branded<'OAuthConnectionId', string>;
|
|
5
|
+
export declare const OAuthConnectionId: (id: string) => OAuthConnectionId;
|
|
6
|
+
/**
|
|
7
|
+
* Providers that use a per-user OAuth connection (refresh token persisted
|
|
8
|
+
* server-side). Microsoft is NOT here — Microsoft uses app-only auth
|
|
9
|
+
* (client_credentials) and is bound per project instead, see
|
|
10
|
+
* `SharePointProjectSite`.
|
|
11
|
+
*/
|
|
12
|
+
export type OAuthConnectionProvider = 'google';
|
|
13
|
+
export type OAuthRefreshToken = Branded<'OAuthRefreshToken', string>;
|
|
14
|
+
export declare const OAuthRefreshToken: (token: string) => OAuthRefreshToken;
|
|
15
|
+
export type OAuthGrantedScopes = Branded<'OAuthGrantedScopes', readonly string[]>;
|
|
16
|
+
export declare const OAuthGrantedScopes: (scopes: readonly string[]) => OAuthGrantedScopes;
|
|
17
|
+
export declare const OAUTH_STALE_CONNECTION_CODE: 'STALE_CONNECTION';
|
|
18
|
+
export declare const SHAREPOINT_MISSING_TENANT_DOMAIN: 'fill-in-tenant-domain.invalid';
|
|
19
|
+
export declare class SharePointTenantDomainInvalidError extends Error {
|
|
20
|
+
readonly code: 'tenant_domain_invalid';
|
|
21
|
+
constructor(tenantDomain: string, reason: string);
|
|
22
|
+
}
|
|
23
|
+
export declare const parseSharePointTenantDomain: (rawDomain: string) => string | null;
|
|
24
|
+
export declare const parseRequiredSharePointTenantDomain: (rawDomain: string) => string;
|
|
25
|
+
export declare const SharePointTenantDomainSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
26
|
+
/**
|
|
27
|
+
* Per-project SharePoint site binding, independent of the user OAuth
|
|
28
|
+
* connection model used by Google — Microsoft uses app-only auth
|
|
29
|
+
* (client_credentials) and needs no per-user refresh token.
|
|
30
|
+
*
|
|
31
|
+
* `tenantId` is required because Microsoft's token endpoint can't use
|
|
32
|
+
* `/common/` for client_credentials — a specific tenant is needed in the
|
|
33
|
+
* URL. Resolved per-project by the studio wizard from a tenant domain (e.g.
|
|
34
|
+
* `contoso.onmicrosoft.com`) via OpenID discovery.
|
|
35
|
+
*/
|
|
36
|
+
export interface SharePointProjectSite {
|
|
37
|
+
readonly projectId: ProjectId;
|
|
38
|
+
readonly tenantId: string;
|
|
39
|
+
readonly tenantDomain: string;
|
|
40
|
+
readonly siteUrl: string;
|
|
41
|
+
readonly siteId: string;
|
|
42
|
+
readonly displayName: string | null;
|
|
43
|
+
}
|
|
44
|
+
export interface NewOAuthConnection {
|
|
45
|
+
readonly projectId: ProjectId;
|
|
46
|
+
readonly provider: OAuthConnectionProvider;
|
|
47
|
+
readonly refreshToken: string;
|
|
48
|
+
readonly grantedScopes: readonly string[];
|
|
49
|
+
readonly connectedEmail: string | null;
|
|
50
|
+
readonly isStale: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface OAuthConnection {
|
|
53
|
+
readonly id: OAuthConnectionId;
|
|
54
|
+
readonly projectId: ProjectId;
|
|
55
|
+
readonly provider: OAuthConnectionProvider;
|
|
56
|
+
readonly refreshToken: OAuthRefreshToken;
|
|
57
|
+
readonly grantedScopes: OAuthGrantedScopes;
|
|
58
|
+
readonly connectedEmail: string | null;
|
|
59
|
+
readonly isStale: boolean;
|
|
60
|
+
readonly createdAt: Date;
|
|
61
|
+
readonly updatedAt: Date;
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{validate as n}from"uuid";import{z as o}from"zod";import{Branded as t}from"@salsita-ai/common/utils";export const OAuthConnectionId=o=>{if(!n(o))throw Error(`Invalid OAuthConnection id: ${o}. It must be a valid UUID.`);return t(o)};export const OAuthRefreshToken=n=>t(n);export const OAuthGrantedScopes=n=>t(n);export const OAUTH_STALE_CONNECTION_CODE="STALE_CONNECTION";export const SHAREPOINT_MISSING_TENANT_DOMAIN="fill-in-tenant-domain.invalid";let e=/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$/i;export class SharePointTenantDomainInvalidError extends Error{code="tenant_domain_invalid";constructor(n,o){super(`SharePoint tenant domain '${n}' is invalid. ${o}. Use a verified Azure AD tenant domain, e.g. 'contoso.onmicrosoft.com'.`),this.name="SharePointTenantDomainInvalidError"}}export const parseSharePointTenantDomain=n=>{let o=n.trim().toLowerCase();return o&&e.test(o)?o:null};export const parseRequiredSharePointTenantDomain=n=>{let o=parseSharePointTenantDomain(n);if(null===o)throw new SharePointTenantDomainInvalidError(n,"Expected a domain name");if("fill-in-tenant-domain.invalid"===o)throw new SharePointTenantDomainInvalidError(n,"This value is a migration placeholder");return o};export const SharePointTenantDomainSchema=o.string().transform((n,t)=>{try{return parseRequiredSharePointTenantDomain(n)}catch(n){if(n instanceof SharePointTenantDomainInvalidError)return t.addIssue({code:o.ZodIssueCode.custom,message:"Expected a verified Azure AD tenant domain, e.g. contoso.onmicrosoft.com."}),o.NEVER;throw n}});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
+
import { type CustomerId } from './customer-domain.js';
|
|
3
|
+
export type OAuthProviderId = Branded<'OAuthProviderId', string>;
|
|
4
|
+
export declare const OAuthProviderId: (id: string) => OAuthProviderId;
|
|
5
|
+
export type OAuthProviderName = Branded<'OAuthProviderName', string>;
|
|
6
|
+
export declare const OAuthProviderName: (name: string) => OAuthProviderName;
|
|
7
|
+
export type OAuthBaseUrl = Branded<'OAuthBaseUrl', string>;
|
|
8
|
+
export declare const OAuthBaseUrl: (url: string) => OAuthBaseUrl;
|
|
9
|
+
export type OAuthClientId = Branded<'OAuthClientId', string>;
|
|
10
|
+
export declare const OAuthClientId: (id: string) => OAuthClientId;
|
|
11
|
+
export type OAuthClientSecret = Branded<'OAuthClientSecret', string>;
|
|
12
|
+
export declare const OAuthClientSecret: (secret: string) => OAuthClientSecret;
|
|
13
|
+
export type OAuthScopes = Branded<'OAuthScopes', string[]>;
|
|
14
|
+
export declare const OAuthScopes: (scopes: string[]) => OAuthScopes;
|
|
15
|
+
export interface OAuthProvider {
|
|
16
|
+
id: OAuthProviderId;
|
|
17
|
+
customerId: CustomerId;
|
|
18
|
+
name: OAuthProviderName;
|
|
19
|
+
baseUrl: OAuthBaseUrl;
|
|
20
|
+
clientId: OAuthClientId;
|
|
21
|
+
clientSecret: OAuthClientSecret;
|
|
22
|
+
scopes: OAuthScopes;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{validate as t}from"uuid";import{Branded as o}from"@salsita-ai/common/utils";export const OAuthProviderId=r=>{if(!t(r))throw Error(`Invalid Project id: ${r}. It must be a valid UUID.`);return o(r)};export const OAuthProviderName=t=>o(t);export const OAuthBaseUrl=t=>o(t);export const OAuthClientId=t=>o(t);export const OAuthClientSecret=t=>o(t);export const OAuthScopes=t=>o(t);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
+
import { type CustomerId } from './customer-domain.js';
|
|
3
|
+
export type ProjectId = Branded<'ProjectId', string>;
|
|
4
|
+
export declare const ProjectId: (id: string) => ProjectId;
|
|
5
|
+
export type ProjectName = Branded<'ProjectName', string>;
|
|
6
|
+
export declare const ProjectName: (name: string) => ProjectName;
|
|
7
|
+
/**
|
|
8
|
+
* What a project's application spec writes as `project` to mean "the default project of the customer I am signed in
|
|
9
|
+
* to". The server resolves it for an API token's customer, so a starter project runs in any workspace without naming
|
|
10
|
+
* a real project. It is not a project slug: no project may be created with it.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFAULT_PROJECT_ALIAS = "default";
|
|
13
|
+
export type ProjectSlug = Branded<'ProjectSlug', string>;
|
|
14
|
+
export declare const ProjectSlug: (slug: string) => ProjectSlug;
|
|
15
|
+
export type ParamStorePath = Branded<'ParamStorePath', string>;
|
|
16
|
+
export declare const ParamStorePath: (path: string) => ParamStorePath;
|
|
17
|
+
export type ProjectCustomDomain = Branded<'ProjectCustomDomain', string>;
|
|
18
|
+
export declare const ProjectCustomDomain: (url: string) => ProjectCustomDomain;
|
|
19
|
+
export interface Project {
|
|
20
|
+
readonly id: ProjectId;
|
|
21
|
+
readonly customerId: CustomerId;
|
|
22
|
+
readonly name: ProjectName;
|
|
23
|
+
readonly slug: ProjectSlug;
|
|
24
|
+
readonly paramStorePath: ParamStorePath;
|
|
25
|
+
readonly customDomain: ProjectCustomDomain | null;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{validate as r}from"uuid";import{isWebUri as o}from"valid-url";import{Branded as t}from"@salsita-ai/common/utils";export const ProjectId=o=>{if(!r(o))throw Error(`Invalid Project id: ${o}. It must be a valid UUID.`);return t(o)};export const ProjectName=r=>t(r);export const DEFAULT_PROJECT_ALIAS="default";export const ProjectSlug=r=>{let o=r.trim();if(0===o.length)throw Error("Project slug cannot be empty, project slug is required for repository and domain creation, please provide a valid slug.");if(o.length<3)throw Error("Project slug is too short, project slug must be at least 3 characters long, please provide a longer slug.");if(!/^[a-z0-9-]+$/.test(o))throw Error("Project slug format is invalid, project slug must contain only lowercase letters, numbers, and hyphens, please provide a valid slug.");return t(o)};export const ParamStorePath=r=>t(r);export const ProjectCustomDomain=r=>{let e=r.trim();if(0===e.length)throw Error("Custom domain cannot be empty, please provide a valid URL or leave it unset.");if(!o(e))throw Error("Custom domain format is invalid, could not parse as valid web URI, please provide a valid URL format.");return t(e)};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ValueOf } from '@salsita-ai/common/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Where the setup of an SDK builder's workspace is. Setup is the init build that deploys the hello-world starter to
|
|
4
|
+
* the workspace's one environment: it is still running (`pending`), it made the environment live (`ready`), or it
|
|
5
|
+
* ended or timed out without a live deployment and can be retried (`failed`). The server derives it for the builder
|
|
6
|
+
* Studio's overview and to decide whether a setup retry is allowed.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SdkBuilderSetupState: {
|
|
9
|
+
readonly Pending: 'pending';
|
|
10
|
+
readonly Ready: 'ready';
|
|
11
|
+
readonly Failed: 'failed';
|
|
12
|
+
};
|
|
13
|
+
export type SdkBuilderSetupState = ValueOf<typeof SdkBuilderSetupState>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SdkBuilderSetupState={Pending:"pending",Ready:"ready",Failed:"failed"};
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
export type BucketTimestamp = Branded<'BucketTimestamp', Date>;
|
|
5
|
+
export declare const BucketTimestamp: (date: Date) => BucketTimestamp;
|
|
6
|
+
export type SessionCount = Branded<'SessionCount', number>;
|
|
7
|
+
export declare const SessionCount: (count: number) => SessionCount;
|
|
8
|
+
export interface SessionBucket {
|
|
9
|
+
readonly environmentId: EnvironmentId;
|
|
10
|
+
readonly deploymentId: DeploymentId;
|
|
11
|
+
readonly bucketTimestamp: BucketTimestamp;
|
|
12
|
+
readonly sessionCount: SessionCount;
|
|
13
|
+
}
|
|
14
|
+
export interface NewSessionBucket {
|
|
15
|
+
readonly environmentId: EnvironmentId;
|
|
16
|
+
readonly deploymentId: DeploymentId;
|
|
17
|
+
readonly bucketTimestamp: BucketTimestamp;
|
|
18
|
+
readonly sessionCount: SessionCount;
|
|
19
|
+
readonly new: true;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Branded as t}from"@salsita-ai/common/utils";export const BucketTimestamp=e=>{let o=new Date(e);return o.setMinutes(0,0,0),t(o)};export const SessionCount=e=>{if(e<0)throw Error("Session count cannot be negative");return t(e)};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Branded, type ValueOf } from '@salsita-ai/common/utils';
|
|
3
|
+
/**
|
|
4
|
+
* Identifies one piece of feedback: a message an SDK builder, or a coding agent working in their project, sent to
|
|
5
|
+
* the Phoenix team from Studio or the phoenix CLI.
|
|
6
|
+
*/
|
|
7
|
+
export type FeedbackId = Branded<'FeedbackId', string>;
|
|
8
|
+
export declare const FeedbackId: (id: string) => FeedbackId;
|
|
9
|
+
declare const feedbackTypes: {
|
|
10
|
+
readonly Bug: 'bug';
|
|
11
|
+
readonly Idea: 'idea';
|
|
12
|
+
readonly Other: 'other';
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* What the sender says the feedback is about: something that is broken, something that is missing or could be
|
|
16
|
+
* better, or anything else. The sender picks it; the server never infers it.
|
|
17
|
+
*/
|
|
18
|
+
export type FeedbackType = ValueOf<typeof feedbackTypes>;
|
|
19
|
+
export declare const FeedbackTypeSchema: z.ZodNativeEnum<{
|
|
20
|
+
readonly Bug: 'bug';
|
|
21
|
+
readonly Idea: 'idea';
|
|
22
|
+
readonly Other: 'other';
|
|
23
|
+
}>;
|
|
24
|
+
export declare const FeedbackType: ((value: string) => FeedbackType) & {
|
|
25
|
+
readonly Bug: 'bug';
|
|
26
|
+
readonly Idea: 'idea';
|
|
27
|
+
readonly Other: 'other';
|
|
28
|
+
};
|
|
29
|
+
declare const feedbackSources: {
|
|
30
|
+
readonly Studio: 'studio';
|
|
31
|
+
readonly Cli: 'cli';
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Where feedback was sent from. Studio feedback comes from a signed-in user's browser session; CLI feedback comes
|
|
35
|
+
* from `phoenix feedback`, authenticated with an API token, and may be written by a coding agent.
|
|
36
|
+
*/
|
|
37
|
+
export type FeedbackSource = ValueOf<typeof feedbackSources>;
|
|
38
|
+
export declare const FeedbackSourceSchema: z.ZodNativeEnum<{
|
|
39
|
+
readonly Studio: 'studio';
|
|
40
|
+
readonly Cli: 'cli';
|
|
41
|
+
}>;
|
|
42
|
+
export declare const FeedbackSource: ((value: string) => FeedbackSource) & {
|
|
43
|
+
readonly Studio: 'studio';
|
|
44
|
+
readonly Cli: 'cli';
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Longest feedback message the server stores. Studio and the CLI check it before sending, so a sender learns about
|
|
48
|
+
* the limit without a round trip.
|
|
49
|
+
*/
|
|
50
|
+
export declare const FEEDBACK_MESSAGE_MAX_LENGTH = 5000;
|
|
51
|
+
/**
|
|
52
|
+
* Longest contact detail a sender may leave with CLI feedback when they want a reply.
|
|
53
|
+
*/
|
|
54
|
+
export declare const FEEDBACK_CONTACT_MAX_LENGTH = 200;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{validate as e}from"uuid";import{z as t}from"zod";import{Branded as o}from"@salsita-ai/common/utils";export const FeedbackId=t=>{if(!e(t))throw Error(`Invalid feedback id: ${t}. It must be a valid UUID.`);return o(t)};let r={Bug:"bug",Idea:"idea",Other:"other"};export const FeedbackTypeSchema=t.nativeEnum(r);export const FeedbackType=Object.assign(e=>{let t=FeedbackTypeSchema.safeParse(e);if(!t.success)throw Error(`Invalid feedback type: ${e}. It must be one of ${Object.values(r).join(", ")}.`);return t.data},r);let a={Studio:"studio",Cli:"cli"};export const FeedbackSourceSchema=t.nativeEnum(a);export const FeedbackSource=Object.assign(e=>{let t=FeedbackSourceSchema.safeParse(e);if(!t.success)throw Error(`Invalid feedback source: ${e}. It must be one of ${Object.values(a).join(", ")}.`);return t.data},a);export const FEEDBACK_MESSAGE_MAX_LENGTH=5e3;export const FEEDBACK_CONTACT_MAX_LENGTH=200;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FEEDBACK_CONTACT_MAX_LENGTH, FEEDBACK_MESSAGE_MAX_LENGTH, FeedbackId, FeedbackSource, FeedbackSourceSchema, FeedbackType, FeedbackTypeSchema, } from './feedback-domain.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{FEEDBACK_CONTACT_MAX_LENGTH,FEEDBACK_MESSAGE_MAX_LENGTH,FeedbackId,FeedbackSource,FeedbackSourceSchema,FeedbackType,FeedbackTypeSchema}from"./feedback-domain.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./deployments/index.js";export*from"./feedback/index.js";export*from"./product-configurations/index.js";
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
+
import type { AccessLevel } from '../../api/access-level.js';
|
|
3
|
+
import type { ApplicationType, ConfigurationSchemaId, EnvironmentId } from '../deployments/index.js';
|
|
4
|
+
export type ConfigurationId = Branded<'ConfigurationId', string>;
|
|
5
|
+
export declare const ConfigurationId: (id: string) => ConfigurationId;
|
|
6
|
+
export type ConfigurationRootEntityType = Branded<'ConfigurationRootEntityType', string>;
|
|
7
|
+
export declare const ConfigurationRootEntityType: (entityType: string) => ConfigurationRootEntityType;
|
|
8
|
+
export type RevisionId = Branded<'RevisionId', string>;
|
|
9
|
+
export declare const RevisionId: (id: string) => RevisionId;
|
|
10
|
+
export type FinalizationUuid = Branded<'FinalizationUuid', string>;
|
|
11
|
+
export declare const FinalizationUuid: (id: string) => FinalizationUuid;
|
|
12
|
+
export type PublishedDataRevisionId = Branded<'PublishedDataRevisionId', string>;
|
|
13
|
+
export declare const PublishedDataRevisionId: (uuid: string) => PublishedDataRevisionId;
|
|
14
|
+
export type PublishedDataRevisionUploadPath = Branded<'PublishedDataRevisionUploadPath', string>;
|
|
15
|
+
export declare const PublishedDataRevisionUploadPath: (path: string) => PublishedDataRevisionUploadPath;
|
|
16
|
+
export type PublishedDataRevisionVersion = Branded<'PublishedDataRevisionVersion', number>;
|
|
17
|
+
export declare const PublishedDataRevisionVersion: (version: number) => PublishedDataRevisionVersion;
|
|
18
|
+
export type PublishedDataChunkId = Branded<'PublishedDataChunkId', string>;
|
|
19
|
+
export declare const PublishedDataChunkId: (uuid: string) => PublishedDataChunkId;
|
|
20
|
+
export type ChunkScope = Branded<'ChunkScope', string>;
|
|
21
|
+
export declare const ChunkScope: (scope: string) => ChunkScope;
|
|
22
|
+
export type ChunkKey = Branded<'ChunkKey', string>;
|
|
23
|
+
export declare const ChunkKey: (key: string) => ChunkKey;
|
|
24
|
+
export interface PublishedDataChunk {
|
|
25
|
+
readonly id: PublishedDataChunkId;
|
|
26
|
+
readonly publishedRevisionId: PublishedDataRevisionId;
|
|
27
|
+
readonly key: ChunkKey;
|
|
28
|
+
readonly scope: ChunkScope;
|
|
29
|
+
readonly uploadPath: string;
|
|
30
|
+
readonly s3Key: string;
|
|
31
|
+
}
|
|
32
|
+
export type FinalizationJobId = Branded<'FinalizationJobId', string>;
|
|
33
|
+
export declare const FinalizationJobId: (id: string) => FinalizationJobId;
|
|
34
|
+
export type ShareId = Branded<'ShareId', string>;
|
|
35
|
+
export declare const ShareId: (uuid: string) => ShareId;
|
|
36
|
+
export interface Entity extends Record<string, unknown> {
|
|
37
|
+
id: string;
|
|
38
|
+
type: string;
|
|
39
|
+
}
|
|
40
|
+
export interface NewRevision {
|
|
41
|
+
data: Entity[];
|
|
42
|
+
rootEntityType: ConfigurationRootEntityType;
|
|
43
|
+
configurationSchemaId: ConfigurationSchemaId;
|
|
44
|
+
}
|
|
45
|
+
export interface Revision {
|
|
46
|
+
id: RevisionId;
|
|
47
|
+
rootEntityType: ConfigurationRootEntityType;
|
|
48
|
+
data: Entity[];
|
|
49
|
+
createdAt: Date;
|
|
50
|
+
configurationId: ConfigurationId;
|
|
51
|
+
configurationSchemaId: ConfigurationSchemaId;
|
|
52
|
+
}
|
|
53
|
+
export declare const PublishedDataRevisionKind: {
|
|
54
|
+
readonly Regular: 'regular';
|
|
55
|
+
readonly Chunked: 'chunked';
|
|
56
|
+
};
|
|
57
|
+
export type PublishedDataRevisionKind = (typeof PublishedDataRevisionKind)[keyof typeof PublishedDataRevisionKind];
|
|
58
|
+
export interface PublishedDataRevision {
|
|
59
|
+
readonly kind: typeof PublishedDataRevisionKind.Regular;
|
|
60
|
+
readonly id: PublishedDataRevisionId;
|
|
61
|
+
readonly finalizationUuid: FinalizationUuid;
|
|
62
|
+
readonly uploadPath: PublishedDataRevisionUploadPath;
|
|
63
|
+
readonly version: PublishedDataRevisionVersion;
|
|
64
|
+
readonly data: unknown;
|
|
65
|
+
}
|
|
66
|
+
export interface ChunkedPublishedDataRevision {
|
|
67
|
+
readonly kind: typeof PublishedDataRevisionKind.Chunked;
|
|
68
|
+
readonly id: PublishedDataRevisionId;
|
|
69
|
+
readonly finalizationUuid: FinalizationUuid;
|
|
70
|
+
readonly publishedDataHash: string;
|
|
71
|
+
}
|
|
72
|
+
export type AnyPublishedDataRevision = PublishedDataRevision | ChunkedPublishedDataRevision;
|
|
73
|
+
export interface NewConfiguration {
|
|
74
|
+
id: null;
|
|
75
|
+
environmentId: EnvironmentId;
|
|
76
|
+
type: ApplicationType;
|
|
77
|
+
revisions: NewRevision[];
|
|
78
|
+
}
|
|
79
|
+
export interface Configuration {
|
|
80
|
+
id: ConfigurationId;
|
|
81
|
+
environmentId: EnvironmentId;
|
|
82
|
+
type: ApplicationType;
|
|
83
|
+
revisions: Revision[];
|
|
84
|
+
}
|
|
85
|
+
export interface NewFinalization {
|
|
86
|
+
uuid: FinalizationUuid;
|
|
87
|
+
revisionId: RevisionId;
|
|
88
|
+
formData: Record<string, unknown> | null;
|
|
89
|
+
jobId: FinalizationJobId;
|
|
90
|
+
}
|
|
91
|
+
export interface Finalization {
|
|
92
|
+
uuid: FinalizationUuid;
|
|
93
|
+
createdAt: Date;
|
|
94
|
+
revisionId: RevisionId;
|
|
95
|
+
formData: Record<string, unknown> | null;
|
|
96
|
+
jobId: FinalizationJobId;
|
|
97
|
+
}
|
|
98
|
+
export interface NewShare {
|
|
99
|
+
configurationId: ConfigurationId;
|
|
100
|
+
revisionId: RevisionId | null;
|
|
101
|
+
accessLevel: AccessLevel;
|
|
102
|
+
expiration: number | null;
|
|
103
|
+
link: string;
|
|
104
|
+
}
|
|
105
|
+
export interface Share {
|
|
106
|
+
id: ShareId;
|
|
107
|
+
configurationId: ConfigurationId;
|
|
108
|
+
revisionId: RevisionId | null;
|
|
109
|
+
accessLevel: AccessLevel;
|
|
110
|
+
createdAt: Date;
|
|
111
|
+
expiredAt: Date | null;
|
|
112
|
+
link: string;
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{validate as t}from"uuid";import{Branded as i}from"@salsita-ai/common/utils";export const ConfigurationId=r=>{if(!t(r))throw Error(`Invalid configuration id: ${r}. It must be a valid UUID.`);return i(r)};export const ConfigurationRootEntityType=t=>i(t);export const RevisionId=r=>{if(!t(r))throw Error(`Invalid revision id: ${r}. It must be a valid UUID.`);return i(r)};export const FinalizationUuid=r=>{if(!t(r))throw Error(`Invalid finalization id: ${r}. It must be a valid UUID.`);return i(r)};export const PublishedDataRevisionId=r=>{if(!t(r))throw Error(`Invalid published data revision id: ${r}. It must be a valid UUID.`);return i(r)};export const PublishedDataRevisionUploadPath=t=>i(t);export const PublishedDataRevisionVersion=t=>i(t);export const PublishedDataChunkId=r=>{if(!t(r))throw Error(`Invalid published data chunk id: ${r}. It must be a valid UUID.`);return i(r)};export const ChunkScope=t=>i(t);let r=/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;export const ChunkKey=t=>{if(!r.test(t))throw Error(`Invalid chunk key '${t}'. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens.`);return i(t)};export const FinalizationJobId=t=>i(t);export const ShareId=r=>{if(!t(r))throw Error(`Invalid share id: ${r}. It must be a valid UUID.`);return i(r)};export const PublishedDataRevisionKind={Regular:"regular",Chunked:"chunked"};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConfigurationId, ConfigurationRootEntityType, RevisionId, type Revision, type NewRevision, PublishedDataRevisionKind, type PublishedDataRevision, type ChunkedPublishedDataRevision, type AnyPublishedDataRevision, type Configuration, type NewConfiguration, type Entity, FinalizationUuid, type Finalization, type NewFinalization, FinalizationJobId, PublishedDataRevisionId, PublishedDataRevisionUploadPath, PublishedDataRevisionVersion, PublishedDataChunkId, ChunkScope, ChunkKey, type PublishedDataChunk, type NewShare, type Share, ShareId, } from './configurations-domain.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ConfigurationId,ConfigurationRootEntityType,RevisionId,PublishedDataRevisionKind,FinalizationUuid,FinalizationJobId,PublishedDataRevisionId,PublishedDataRevisionUploadPath,PublishedDataRevisionVersion,PublishedDataChunkId,ChunkScope,ChunkKey,ShareId}from"./configurations-domain.js";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { TaskResourceType, FinalizeTaskResource, type ClientGeneratedImageResource, type ExistingImageResource, type LinkResource, type PdfResource, type CsvResource, type GeneratedImageResource, } from './task-resource.js';
|
|
2
|
+
export { TaskType } from './task-type.js';
|
|
3
|
+
export { TemplateResourceType, ImageTemplateResource, LinkTemplateResource, TemplateResource, StoredTemplate, isStoredTemplate, Template, isTemplate, validateTemplate, } from './template.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{TaskResourceType,FinalizeTaskResource}from"./task-resource.js";export{TaskType}from"./task-type.js";export{TemplateResourceType,ImageTemplateResource,LinkTemplateResource,TemplateResource,StoredTemplate,isStoredTemplate,Template,isTemplate,validateTemplate}from"./template.js";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ValueOf } from '@salsita-ai/common/utils';
|
|
3
|
+
export declare const TaskResourceType: {
|
|
4
|
+
readonly Image: 'Image';
|
|
5
|
+
readonly Pdf: 'Pdf';
|
|
6
|
+
readonly Csv: 'Csv';
|
|
7
|
+
readonly ConfigurationLink: 'ConfigurationLink';
|
|
8
|
+
};
|
|
9
|
+
export type TaskResourceType = ValueOf<typeof TaskResourceType>;
|
|
10
|
+
export interface ClientGeneratedImageResource<RESOURCE extends string = string> {
|
|
11
|
+
type: typeof TaskResourceType.Image;
|
|
12
|
+
/**
|
|
13
|
+
* Unique identifier of the resource, validation will check that the given resource exists as part of the overall FinalizeTask definition
|
|
14
|
+
*/
|
|
15
|
+
name: RESOURCE;
|
|
16
|
+
/**
|
|
17
|
+
* If the resource already exists and is not generated as part of the finalize task, set to true and the validation will not check for the resource definition
|
|
18
|
+
* This may be useful for static third party resources / deployed static files or pre-generated client side images
|
|
19
|
+
*/
|
|
20
|
+
clientGenerated: true;
|
|
21
|
+
/**
|
|
22
|
+
* URL where the resource is stored
|
|
23
|
+
*/
|
|
24
|
+
s3Key: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ExistingImageResource<RESOURCE extends string = string> {
|
|
27
|
+
type: typeof TaskResourceType.Image;
|
|
28
|
+
/**
|
|
29
|
+
* Unique identifier of the resource, validation will check that the given resource exists as part of the overall FinalizeTask definition
|
|
30
|
+
*/
|
|
31
|
+
name: RESOURCE;
|
|
32
|
+
/**
|
|
33
|
+
* If the resource already exists and is not generated as part of the finalize task, set to true and the validation will not check for the resource definition
|
|
34
|
+
* This may be useful for static third party resources / deployed static files or pre-generated client side images
|
|
35
|
+
*/
|
|
36
|
+
exists: true;
|
|
37
|
+
/**
|
|
38
|
+
* URL where the resource is stored
|
|
39
|
+
*/
|
|
40
|
+
url: string;
|
|
41
|
+
}
|
|
42
|
+
export interface LinkResource<RESOURCE extends string = string> {
|
|
43
|
+
type: typeof TaskResourceType.ConfigurationLink;
|
|
44
|
+
name: RESOURCE;
|
|
45
|
+
}
|
|
46
|
+
export interface CsvResource<RESOURCE extends string = string> {
|
|
47
|
+
type: typeof TaskResourceType.Csv;
|
|
48
|
+
/**
|
|
49
|
+
* Unique identifier of the resource, validation will check that the given resource exists as part of the overall FinalizeTask definition
|
|
50
|
+
*/
|
|
51
|
+
name: RESOURCE;
|
|
52
|
+
/**
|
|
53
|
+
* S3 key to this resource. CSV resources are uploaded to this key during finalization.
|
|
54
|
+
*/
|
|
55
|
+
s3Key?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface PdfResource<RESOURCE extends string = string> {
|
|
58
|
+
type: typeof TaskResourceType.Pdf;
|
|
59
|
+
/**
|
|
60
|
+
* Unique identifier of the resource, validation will check that the given resource exists as part of the overall FinalizeTask definition
|
|
61
|
+
*/
|
|
62
|
+
name: RESOURCE;
|
|
63
|
+
/**
|
|
64
|
+
* S3 key to this resource. PDF resources are uploaded to this key during finalization.
|
|
65
|
+
*/
|
|
66
|
+
s3Key?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface GeneratedImageResource<RESOURCE extends string = string> {
|
|
69
|
+
type: typeof TaskResourceType.Image;
|
|
70
|
+
/**
|
|
71
|
+
* Unique identifier of the resource, validation will check that the given resource exists as part of the overall FinalizeTask definition
|
|
72
|
+
*/
|
|
73
|
+
name: RESOURCE;
|
|
74
|
+
/**
|
|
75
|
+
* URL where the image will be stored
|
|
76
|
+
*/
|
|
77
|
+
s3Key: string;
|
|
78
|
+
}
|
|
79
|
+
export type FinalizeTaskResource<RESOURCE extends string = string> = LinkResource<RESOURCE> | CsvResource<RESOURCE> | PdfResource<RESOURCE> | GeneratedImageResource<RESOURCE> | ExistingImageResource<RESOURCE> | ClientGeneratedImageResource<RESOURCE>;
|
|
80
|
+
export declare const FinalizeTaskResource: z.ZodType<FinalizeTaskResource>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";export const TaskResourceType={Image:"Image",Pdf:"Pdf",Csv:"Csv",ConfigurationLink:"ConfigurationLink"};export const FinalizeTaskResource=e.union([e.object({type:e.literal(TaskResourceType.ConfigurationLink),name:e.string()}),e.object({type:e.union([e.literal(TaskResourceType.Csv),e.literal(TaskResourceType.Pdf)]),name:e.string(),s3Key:e.string().optional()}),e.object({type:e.literal(TaskResourceType.Image),name:e.string(),exists:e.literal(!0),url:e.string()}),e.object({type:e.literal(TaskResourceType.Image),name:e.string(),clientGenerated:e.literal(!0),s3Key:e.string()}),e.object({type:e.literal(TaskResourceType.Image),name:e.string(),s3Key:e.string()})]);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ValueOf } from '@salsita-ai/common/utils';
|
|
2
|
+
export declare const TaskType: {
|
|
3
|
+
readonly GenerateConfigurationLink: 'GenerateConfigurationLink';
|
|
4
|
+
readonly GenerateImages: 'GenerateImages';
|
|
5
|
+
readonly GeneratePdf: 'GeneratePdf';
|
|
6
|
+
readonly GenerateStaticPdf: 'GenerateStaticPdf';
|
|
7
|
+
readonly GenerateCsv: 'GenerateCsv';
|
|
8
|
+
readonly SendEmail: 'SendEmail';
|
|
9
|
+
readonly SendStaticEmail: 'SendStaticEmail';
|
|
10
|
+
readonly SendHttpRequest: 'SendHttpRequest';
|
|
11
|
+
readonly PublishRevision: 'PublishRevision';
|
|
12
|
+
readonly PublishRevisionChunks: 'PublishRevisionChunks';
|
|
13
|
+
readonly PublishRevisionChunksStaged: 'PublishRevisionChunksStaged';
|
|
14
|
+
readonly CallLambdaBack: 'CallLambdaBack';
|
|
15
|
+
readonly WooCommerceAddToCart: 'WooCommerceAddToCart';
|
|
16
|
+
readonly EditGoogleSpreadsheet: 'EditGoogleSpreadsheet';
|
|
17
|
+
};
|
|
18
|
+
export type TaskType = ValueOf<typeof TaskType>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const TaskType={GenerateConfigurationLink:"GenerateConfigurationLink",GenerateImages:"GenerateImages",GeneratePdf:"GeneratePdf",GenerateStaticPdf:"GenerateStaticPdf",GenerateCsv:"GenerateCsv",SendEmail:"SendEmail",SendStaticEmail:"SendStaticEmail",SendHttpRequest:"SendHttpRequest",PublishRevision:"PublishRevision",PublishRevisionChunks:"PublishRevisionChunks",PublishRevisionChunksStaged:"PublishRevisionChunksStaged",CallLambdaBack:"CallLambdaBack",WooCommerceAddToCart:"WooCommerceAddToCart",EditGoogleSpreadsheet:"EditGoogleSpreadsheet"};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ValueOf } from '@salsita-ai/common/utils';
|
|
3
|
+
import { type FinalizeTaskResource, TaskResourceType } from './task-resource.js';
|
|
4
|
+
export declare const TemplateResourceType: {
|
|
5
|
+
readonly Embedded: 'Embedded';
|
|
6
|
+
readonly Link: 'Link';
|
|
7
|
+
};
|
|
8
|
+
export type TemplateResourceType = ValueOf<typeof TemplateResourceType>;
|
|
9
|
+
export interface ImageTemplateResource {
|
|
10
|
+
type: typeof TaskResourceType.Image;
|
|
11
|
+
/**
|
|
12
|
+
* Unique identifier of the resource, validation will check that the given resource exists as part of the overall FinalizeTask definition
|
|
13
|
+
*/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* The type of the resource, can be either embedded or attachment.
|
|
17
|
+
*
|
|
18
|
+
* Embedded attachments will be converted to base64 string and can be included in the template as a data url.
|
|
19
|
+
*
|
|
20
|
+
* Link attachments will be included as a link to the attachment (This makes sense only for external resources or Templates used for PDF generation as generated images can be shared only via signed links and would expire in a while).
|
|
21
|
+
*/
|
|
22
|
+
embeddingType: TemplateResourceType;
|
|
23
|
+
}
|
|
24
|
+
export declare const ImageTemplateResource: z.ZodType<ImageTemplateResource>;
|
|
25
|
+
export interface LinkTemplateResource {
|
|
26
|
+
type: typeof TaskResourceType.ConfigurationLink;
|
|
27
|
+
/**
|
|
28
|
+
* Unique identifier of the resource, validation will check that the given resource exists as part of the overall FinalizeTask definition
|
|
29
|
+
*/
|
|
30
|
+
name: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const LinkTemplateResource: z.ZodType<LinkTemplateResource>;
|
|
33
|
+
export type TemplateResource = ImageTemplateResource | LinkTemplateResource;
|
|
34
|
+
export declare const TemplateResource: z.ZodType<TemplateResource>;
|
|
35
|
+
/**
|
|
36
|
+
* Template that is stored and can be referenced by it's unique name. This template will be retrieved and compiled when used in the finalization task.
|
|
37
|
+
*/
|
|
38
|
+
export interface StoredTemplate {
|
|
39
|
+
/**
|
|
40
|
+
* Name of the Handlebars template to be used to compile the template
|
|
41
|
+
*/
|
|
42
|
+
templateName: string;
|
|
43
|
+
/**
|
|
44
|
+
* The data to be used to compile the template
|
|
45
|
+
*/
|
|
46
|
+
data: Record<string, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* The resources to be included in the template from FinalizeTask resources - only images are supported and are included as links to the pdf generation
|
|
49
|
+
* These will be included into the template's data so they can be used in the template in format "resource-{name}"
|
|
50
|
+
*/
|
|
51
|
+
includeResources: TemplateResource[];
|
|
52
|
+
}
|
|
53
|
+
export declare const StoredTemplate: z.ZodType<StoredTemplate>;
|
|
54
|
+
export declare function isStoredTemplate(template: StoredTemplate | Template): template is StoredTemplate;
|
|
55
|
+
/**
|
|
56
|
+
* Inline template that will be compiled with resources will be resolved.
|
|
57
|
+
*/
|
|
58
|
+
export interface Template {
|
|
59
|
+
template: string;
|
|
60
|
+
data: Record<string, unknown>;
|
|
61
|
+
includeResources: TemplateResource[];
|
|
62
|
+
}
|
|
63
|
+
export declare const Template: z.ZodType<Template>;
|
|
64
|
+
export declare function isTemplate(template: StoredTemplate | Template): template is Template;
|
|
65
|
+
export declare const validateTemplate: (template: StoredTemplate | Template, resources: FinalizeTaskResource[]) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";import{TaskResourceType as t}from"./task-resource.js";export const TemplateResourceType={Embedded:"Embedded",Link:"Link"};export const ImageTemplateResource=e.object({name:e.string(),type:e.literal(t.Image),embeddingType:e.union([e.literal(TemplateResourceType.Embedded),e.literal(TemplateResourceType.Link)])});export const LinkTemplateResource=e.object({name:e.string(),type:e.literal(t.ConfigurationLink)});export const TemplateResource=e.union([ImageTemplateResource,LinkTemplateResource]);export const StoredTemplate=e.object({templateName:e.string(),data:e.record(e.unknown()),includeResources:e.array(TemplateResource)});export function isStoredTemplate(e){return"templateName"in e}export const Template=e.object({template:e.string(),data:e.record(e.unknown()),includeResources:e.array(TemplateResource)});export function isTemplate(e){return"template"in e}export const validateTemplate=(e,o)=>{e.includeResources.forEach(e=>{let r=o.find(t=>t.name===e.name);if(null==r)throw Error(`The provided FinalizeTask configuration is invalid! Resource ${e.name} is not declared in the resources. Provide a resource with the name ${e.name}.`);if(r.type!==t.Image&&r.type!==t.ConfigurationLink)throw Error(`The provided FinalizeTask configuration is invalid! Resource ${e.name} is not an image or configuration link. Only images or configuration links can be provided for TemplateResource.`)})};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedded minimal blank `.xlsx` (Office Open XML) workbook. Used by the
|
|
3
|
+
* Microsoft adapter's `createWorkbook` — `PUT .../content` requires real xlsx
|
|
4
|
+
* bytes; Graph cannot synthesize a workbook from a 0-byte file.
|
|
5
|
+
*
|
|
6
|
+
* Contains: `[Content_Types].xml`, `_rels/.rels`, `xl/workbook.xml`,
|
|
7
|
+
* `xl/_rels/workbook.xml.rels`, `xl/worksheets/sheet1.xml`, `xl/styles.xml`.
|
|
8
|
+
* Single empty worksheet named `Sheet1`. ~1.7KB.
|
|
9
|
+
*/
|
|
10
|
+
export declare const EMPTY_XLSX_BYTES: Uint8Array<ArrayBuffer>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const EMPTY_XLSX_BYTES=Uint8Array.from(atob("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"),A=>A.charCodeAt(0));
|