@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,73 @@
1
+ import { z } from 'zod';
2
+ import { RevisionId } from '../../domain/index.js';
3
+ import { TaskType } from '../core/index.js';
4
+ import { ChunkDefinition } from './publish-revision-chunks-task.js';
5
+ /**
6
+ * Shape of the object a current SDK webhook uploads to the server-provided finalization staging URL.
7
+ *
8
+ * Connected-data chunks are staged in S3 instead of being returned inline because the project webhook runs in a
9
+ * Lambda whose synchronous response is capped at 6 MiB, and a large connected dataset exceeds that on its own. The
10
+ * `version` literal guards future format changes: the server rejects a staged object it cannot parse instead of
11
+ * publishing something it misread.
12
+ */
13
+ export interface PublishRevisionChunksStagedData {
14
+ readonly version: 1;
15
+ readonly chunks: readonly ChunkDefinition[];
16
+ }
17
+ export declare const PublishRevisionChunksStagedData: z.ZodObject<{
18
+ version: z.ZodLiteral<1>;
19
+ chunks: z.ZodArray<z.ZodObject<{
20
+ key: z.ZodEffects<z.ZodString, import("../../domain/index.js").ChunkKey, string>;
21
+ scope: z.ZodEffects<z.ZodString, import("../../domain/index.js").ChunkScope, string>;
22
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ key: string & import("@salsita-ai/common/utils").Brand<"ChunkKey">;
25
+ scope: string & import("@salsita-ai/common/utils").Brand<"ChunkScope">;
26
+ data: Record<string, unknown>;
27
+ }, {
28
+ key: string;
29
+ scope: string;
30
+ data: Record<string, unknown>;
31
+ }>, "many">;
32
+ }, "strip", z.ZodTypeAny, {
33
+ version: 1;
34
+ chunks: {
35
+ key: string & import("@salsita-ai/common/utils").Brand<"ChunkKey">;
36
+ scope: string & import("@salsita-ai/common/utils").Brand<"ChunkScope">;
37
+ data: Record<string, unknown>;
38
+ }[];
39
+ }, {
40
+ version: 1;
41
+ chunks: {
42
+ key: string;
43
+ scope: string;
44
+ data: Record<string, unknown>;
45
+ }[];
46
+ }>;
47
+ /**
48
+ * Lightweight publish task a current SDK webhook returns after it staged the chunks; the server publishes them from
49
+ * the staging object.
50
+ *
51
+ * Compatibility holds in both directions. An older SDK ignores the staging URL and returns the inline
52
+ * `PublishRevisionChunks` task, which servers keep accepting. A current SDK called by an older server receives no
53
+ * staging URL and falls back to that same inline task.
54
+ */
55
+ export interface PublishRevisionChunksStagedTask {
56
+ readonly type: typeof TaskType.PublishRevisionChunksStaged;
57
+ readonly revisionId: RevisionId;
58
+ readonly publishedDataHash: string;
59
+ }
60
+ export declare const PublishRevisionChunksStagedTask: z.ZodObject<{
61
+ type: z.ZodLiteral<"PublishRevisionChunksStaged">;
62
+ revisionId: z.ZodEffects<z.ZodString, RevisionId, string>;
63
+ publishedDataHash: z.ZodString;
64
+ }, "strip", z.ZodTypeAny, {
65
+ type: "PublishRevisionChunksStaged";
66
+ revisionId: string & import("@salsita-ai/common/utils").Brand<"RevisionId">;
67
+ publishedDataHash: string;
68
+ }, {
69
+ type: "PublishRevisionChunksStaged";
70
+ revisionId: string;
71
+ publishedDataHash: string;
72
+ }>;
73
+ export declare const createPublishRevisionChunksStagedTask: (task: PublishRevisionChunksStagedTask) => PublishRevisionChunksStagedTask;
@@ -0,0 +1 @@
1
+ import{z as s}from"zod";import{usingType as i}from"@salsita-ai/common/utils";import{RevisionId as o}from"../../domain/index.js";import{TaskType as t}from"../core/index.js";import{ChunkDefinition as r}from"./publish-revision-chunks-task.js";export const PublishRevisionChunksStagedData=s.object({version:s.literal(1),chunks:s.array(r)});export const PublishRevisionChunksStagedTask=s.object({type:s.literal(t.PublishRevisionChunksStaged),revisionId:s.string().transform(i(o)),publishedDataHash:s.string()});export const createPublishRevisionChunksStagedTask=s=>s;
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ import { ChunkKey, ChunkScope, RevisionId } from '../../domain/index.js';
3
+ import { TaskType } from '../core/index.js';
4
+ /**
5
+ * Definition of a single chunk to be published
6
+ */
7
+ export interface ChunkDefinition {
8
+ readonly key: ChunkKey;
9
+ readonly scope: ChunkScope;
10
+ readonly data: Record<string, unknown>;
11
+ }
12
+ export declare const ChunkDefinition: z.ZodObject<{
13
+ key: z.ZodEffects<z.ZodString, ChunkKey, string>;
14
+ scope: z.ZodEffects<z.ZodString, ChunkScope, string>;
15
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ key: string & import("@salsita-ai/common/utils").Brand<"ChunkKey">;
18
+ scope: string & import("@salsita-ai/common/utils").Brand<"ChunkScope">;
19
+ data: Record<string, unknown>;
20
+ }, {
21
+ key: string;
22
+ scope: string;
23
+ data: Record<string, unknown>;
24
+ }>;
25
+ /**
26
+ * Publishes revision with chunked data to private S3 with scope-based access control
27
+ */
28
+ export interface PublishRevisionChunksTask {
29
+ readonly type: typeof TaskType.PublishRevisionChunks;
30
+ /**
31
+ * The unique identifier of the revision to be published
32
+ */
33
+ readonly revisionId: RevisionId;
34
+ /**
35
+ * Chunks of data to be published, each with its own scope
36
+ */
37
+ readonly chunks: readonly ChunkDefinition[];
38
+ readonly publishedDataHash: string;
39
+ }
40
+ export declare const PublishRevisionChunksTask: z.ZodObject<{
41
+ type: z.ZodLiteral<"PublishRevisionChunks">;
42
+ revisionId: z.ZodEffects<z.ZodString, RevisionId, string>;
43
+ chunks: z.ZodArray<z.ZodObject<{
44
+ key: z.ZodEffects<z.ZodString, ChunkKey, string>;
45
+ scope: z.ZodEffects<z.ZodString, ChunkScope, string>;
46
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
47
+ }, "strip", z.ZodTypeAny, {
48
+ key: string & import("@salsita-ai/common/utils").Brand<"ChunkKey">;
49
+ scope: string & import("@salsita-ai/common/utils").Brand<"ChunkScope">;
50
+ data: Record<string, unknown>;
51
+ }, {
52
+ key: string;
53
+ scope: string;
54
+ data: Record<string, unknown>;
55
+ }>, "many">;
56
+ publishedDataHash: z.ZodString;
57
+ }, "strip", z.ZodTypeAny, {
58
+ type: "PublishRevisionChunks";
59
+ revisionId: string & import("@salsita-ai/common/utils").Brand<"RevisionId">;
60
+ chunks: {
61
+ key: string & import("@salsita-ai/common/utils").Brand<"ChunkKey">;
62
+ scope: string & import("@salsita-ai/common/utils").Brand<"ChunkScope">;
63
+ data: Record<string, unknown>;
64
+ }[];
65
+ publishedDataHash: string;
66
+ }, {
67
+ type: "PublishRevisionChunks";
68
+ revisionId: string;
69
+ chunks: {
70
+ key: string;
71
+ scope: string;
72
+ data: Record<string, unknown>;
73
+ }[];
74
+ publishedDataHash: string;
75
+ }>;
76
+ export declare const createPublishRevisionChunksTask: (task: PublishRevisionChunksTask) => PublishRevisionChunksTask;
@@ -0,0 +1 @@
1
+ import{z as i}from"zod";import{usingType as o}from"@salsita-ai/common/utils";import{ChunkKey as n,ChunkScope as s,RevisionId as r}from"../../domain/index.js";import{TaskType as t}from"../core/index.js";export const ChunkDefinition=i.object({key:i.string().transform(o(n)),scope:i.string().transform(o(s)),data:i.record(i.unknown())});export const PublishRevisionChunksTask=i.object({type:i.literal(t.PublishRevisionChunks),revisionId:i.string().transform(o(r)),chunks:i.array(ChunkDefinition),publishedDataHash:i.string()});export const createPublishRevisionChunksTask=i=>i;
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod';
2
+ import { PublishedDataRevisionVersion, RevisionId } from '../../domain/index.js';
3
+ import { TaskType } from '../core/index.js';
4
+ /**
5
+ * Publishes a revision that may be publicly accessible by applications
6
+ */
7
+ export interface PublishRevisionTask {
8
+ readonly type: typeof TaskType.PublishRevision;
9
+ /**
10
+ * Version of the data used to check compatibility of the server and deployed workers, BUMP IT UP WHEN introducing breaking CHANGING THE SCHEMA!!!!
11
+ */
12
+ readonly version: PublishedDataRevisionVersion;
13
+ /**
14
+ * The unique identifier of the revision to be published
15
+ */
16
+ readonly revisionId: RevisionId;
17
+ /**
18
+ * Data that will be published with the revision, these may be public, so be careful with sensitive data!
19
+ */
20
+ readonly data: object;
21
+ }
22
+ export declare const PublishRevisionTask: z.ZodObject<{
23
+ type: z.ZodLiteral<"PublishRevision">;
24
+ version: z.ZodEffects<z.ZodNumber, PublishedDataRevisionVersion, number>;
25
+ revisionId: z.ZodEffects<z.ZodString, RevisionId, string>;
26
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ type: "PublishRevision";
29
+ version: number & import("@salsita-ai/common/utils").Brand<"PublishedDataRevisionVersion">;
30
+ revisionId: string & import("@salsita-ai/common/utils").Brand<"RevisionId">;
31
+ data: Record<string, unknown>;
32
+ }, {
33
+ type: "PublishRevision";
34
+ version: number;
35
+ revisionId: string;
36
+ data: Record<string, unknown>;
37
+ }>;
38
+ export declare const createPublishRevisionTask: (task: PublishRevisionTask) => PublishRevisionTask;
@@ -0,0 +1 @@
1
+ import{z as o}from"zod";import{usingType as i}from"@salsita-ai/common/utils";import{PublishedDataRevisionVersion as r,RevisionId as s}from"../../domain/index.js";import{TaskType as n}from"../core/index.js";export const PublishRevisionTask=o.object({type:o.literal(n.PublishRevision),version:o.number().transform(i(r)),revisionId:o.string().transform(i(s)),data:o.record(o.unknown())});export const createPublishRevisionTask=o=>o;
@@ -0,0 +1,129 @@
1
+ import { z } from 'zod';
2
+ import { type FinalizeTaskResource, StoredTemplate, TaskType, Template, TemplateResource } from '../core/index.js';
3
+ export interface ResourceEmailAttachment {
4
+ /**
5
+ * Type of the attachment.
6
+ * "resource" attachments are refenrencing a pre-defined resource, which is usually generated by some other task, like a PDF or CSV.
7
+ */
8
+ type?: 'resource';
9
+ /** filename to be reported as the name of the attached file */
10
+ filename: string;
11
+ /**
12
+ * Name of the resource (from the FinalTasks's definition) to be included in the email as a content of the attachment
13
+ * This can be either image, pdf or csv
14
+ */
15
+ resource: string;
16
+ }
17
+ export declare const ResourceEmailAttachment: z.ZodType<ResourceEmailAttachment>;
18
+ export interface Base64EmailAttachment {
19
+ /**
20
+ * Type of the attachment.
21
+ * "base64" attachments can be created dynamically in the email task. Source of the data can for example be data from prefetch task.
22
+ */
23
+ type: 'base64';
24
+ /** filename to be reported as the name of the attached file */
25
+ filename: string;
26
+ /**
27
+ * Base64 encoded data of the attachment
28
+ */
29
+ data: string;
30
+ }
31
+ export declare const Base64EmailAttachment: z.ZodType<Base64EmailAttachment>;
32
+ export type EmailAttachment = ResourceEmailAttachment | Base64EmailAttachment;
33
+ export declare const EmailAttachment: z.ZodType<EmailAttachment>;
34
+ export interface SendEmailTask {
35
+ type: typeof TaskType.SendEmail;
36
+ /**
37
+ * The email address of the sender. All email addresses can be plain ‘sender@server.com’ or formatted '“Sender Name” sender@server.com'
38
+ */
39
+ from: string;
40
+ /**
41
+ * Comma separated list or an array of recipients email addresses that will appear on the To: field
42
+ */
43
+ to: string;
44
+ /**
45
+ * Comma separated list or an array of recipients email addresses that will appear on the Cc: field
46
+ */
47
+ cc: string;
48
+ /**
49
+ * Comma separated list or an array of recipients email addresses that will appear on the Bcc: field
50
+ */
51
+ bcc: string;
52
+ /**
53
+ * Optional address that recipients see in the Reply-To header. When unset, replies go to `from`.
54
+ * Useful when emails are sent from an authorized no-reply / generic sender but replies should land elsewhere
55
+ * (e.g. customer enquiries replying back to the customer, or a tenant-specific support address behind a shared sender).
56
+ */
57
+ replyTo?: string;
58
+ /**
59
+ * The subject of the email
60
+ */
61
+ subject: string;
62
+ /**
63
+ * The plaintext version of the message
64
+ */
65
+ text: string;
66
+ /**
67
+ * Html version of the email to be compiled using Handlebars template
68
+ */
69
+ html: StoredTemplate | Template;
70
+ /**
71
+ * An array of attachments to add to the email
72
+ */
73
+ attachments: EmailAttachment[];
74
+ }
75
+ export declare const SendEmailTask: z.ZodType<SendEmailTask>;
76
+ export interface SendStaticEmailTask {
77
+ type: typeof TaskType.SendStaticEmail;
78
+ /**
79
+ * The email address of the sender. All email addresses can be plain ‘sender@server.com’ or formatted '“Sender Name” sender@server.com'
80
+ */
81
+ from: string;
82
+ /**
83
+ * Comma separated list or an array of recipients email addresses that will appear on the To: field
84
+ */
85
+ to: string;
86
+ /**
87
+ * Comma separated list or an array of recipients email addresses that will appear on the Cc: field
88
+ */
89
+ cc: string | null;
90
+ /**
91
+ * Comma separated list or an array of recipients email addresses that will appear on the Bcc: field
92
+ */
93
+ bcc: string | null;
94
+ /**
95
+ * Optional address that recipients see in the Reply-To header. When unset, replies go to `from`.
96
+ * Useful when emails are sent from an authorized no-reply / generic sender but replies should land elsewhere
97
+ * (e.g. customer enquiries replying back to the customer, or a tenant-specific support address behind a shared sender).
98
+ */
99
+ replyTo: string | null;
100
+ /**
101
+ * The subject of the email
102
+ */
103
+ subject: string;
104
+ /**
105
+ * The plaintext version of the message
106
+ *
107
+ * `configuration-resource://{name}` occurrences will be replaced with the content of the resource with the given name.
108
+ * The referenced resource must be listed in the `includeResources` array.
109
+ */
110
+ text: string;
111
+ /**
112
+ * Html version of the email as a string
113
+ *
114
+ * `configuration-resource://{name}` occurrences will be replaced with the content of the resource with the given name.
115
+ * The referenced resource must be listed in the `includeResources` array.
116
+ */
117
+ html: string;
118
+ /**
119
+ * An array of attachments to add to the email
120
+ */
121
+ attachments: readonly EmailAttachment[];
122
+ /**
123
+ * The resources ready to be included in the email either as a link, image source or a standalone attachment.
124
+ */
125
+ includeResources: readonly TemplateResource[];
126
+ }
127
+ export declare const SendStaticEmailTask: z.ZodType<SendStaticEmailTask>;
128
+ export declare const validateSendEmailTask: (task: SendEmailTask, resources: FinalizeTaskResource[]) => void;
129
+ export declare const validateSendStaticEmailTask: (task: SendStaticEmailTask, resources: FinalizeTaskResource[]) => void;
@@ -0,0 +1 @@
1
+ import{z as e}from"zod";import{StoredTemplate as t,TaskType as r,Template as i,TemplateResource as a,validateTemplate as n}from"../core/index.js";export const ResourceEmailAttachment=e.object({type:e.literal("resource").optional(),filename:e.string(),resource:e.string()});export const Base64EmailAttachment=e.object({type:e.literal("base64"),filename:e.string(),data:e.string()});export const EmailAttachment=e.union([ResourceEmailAttachment,Base64EmailAttachment]);export const SendEmailTask=e.object({type:e.literal(r.SendEmail),from:e.string(),to:e.string(),cc:e.string(),bcc:e.string(),replyTo:e.string().optional(),subject:e.string(),text:e.string(),html:e.union([t,i]),attachments:e.array(EmailAttachment)});export const SendStaticEmailTask=e.object({type:e.literal(r.SendStaticEmail),from:e.string(),to:e.string(),cc:e.string().nullable(),bcc:e.string().nullable(),replyTo:e.string().nullable(),subject:e.string(),text:e.string(),html:e.string(),attachments:e.array(EmailAttachment),includeResources:e.array(a)});let o=(e,t)=>{if("resource"===e.type||void 0===e.type){if(null==t.find(t=>t.name===e.resource))throw Error(`The provided FinalizeTask configuration is invalid! Resource ${e.resource} is not declared in the resources. Provide a resource with the name ${e.resource}.`)}else if("base64"===e.type&&"string"!=typeof e.data)throw Error("The provided FinalizeTask configuration is invalid! Base64 attachment data is not a string.")};export const validateSendEmailTask=(e,t)=>{n(e.html,t),e.attachments.forEach(e=>{o(e,t)})};export const validateSendStaticEmailTask=(e,t)=>{e.includeResources.forEach(e=>{if(null==t.find(t=>t.name===e.name))throw Error(`The provided FinalizeTask configuration is invalid! Static email includeResources references "${e.name}" which is not declared in the resources. Declare it or remove the reference.`)}),e.attachments.forEach(e=>{o(e,t)})};
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ import { TaskType, Template } from '../core/index.js';
3
+ /**
4
+ * The SendHttpRequest is used to send an HTTP request to a given URL with the given method, headers and body.
5
+ * For now it does not support use of generated resources as part of the request.
6
+ * The task is run as the last task in the finalize configuration flow.
7
+ */
8
+ export interface SendHttpRequestTask {
9
+ type: typeof TaskType.SendHttpRequest;
10
+ /**
11
+ * The URL to send the request to
12
+ */
13
+ url: string;
14
+ /**
15
+ * The HTTP method to use, defaults to GET
16
+ */
17
+ method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH' | undefined;
18
+ /**
19
+ * The headers to send with the request
20
+ */
21
+ headers?: Record<string, string> | undefined;
22
+ /**
23
+ * The body of the request, (stringified JSON, template or raw text)
24
+ */
25
+ body?: string | undefined | Template;
26
+ }
27
+ export declare const SendHttpRequestTask: z.ZodType<SendHttpRequestTask>;
@@ -0,0 +1 @@
1
+ import{z as t}from"zod";import{TaskType as e,Template as l}from"../core/index.js";export const SendHttpRequestTask=t.object({type:t.literal(e.SendHttpRequest),url:t.string(),method:t.union([t.literal("GET"),t.literal("HEAD"),t.literal("POST"),t.literal("PUT"),t.literal("DELETE"),t.literal("CONNECT"),t.literal("OPTIONS"),t.literal("TRACE"),t.literal("PATCH")]).optional(),headers:t.record(t.string()).optional(),body:t.union([t.string(),l]).optional()});
@@ -0,0 +1,91 @@
1
+ import { z } from 'zod';
2
+ import { type ValueOf } from '@salsita-ai/common/utils';
3
+ import { TaskResourceType, TaskType } from '../core/index.js';
4
+ export interface WooCommerceAddToCartResource {
5
+ /**
6
+ * Type of the resource
7
+ */
8
+ type: TaskResourceType;
9
+ /**
10
+ * Name slug of the resource
11
+ */
12
+ name: string;
13
+ /**
14
+ * Label to show in the order and email
15
+ */
16
+ label: string;
17
+ }
18
+ export declare const WooCommerceAddToCartResource: z.ZodType<WooCommerceAddToCartResource>;
19
+ export interface WooCommerceAddToCartItem {
20
+ /**
21
+ * The product to add to the cart
22
+ */
23
+ product: string;
24
+ /**
25
+ * The name of the product
26
+ */
27
+ productName?: string;
28
+ /**
29
+ * The product description
30
+ */
31
+ productDescription?: string;
32
+ /**
33
+ * The price of the product
34
+ */
35
+ price?: number;
36
+ /**
37
+ * The quantity of the product to add to the cart
38
+ */
39
+ quantity?: number;
40
+ /**
41
+ * Optional URL of product image
42
+ */
43
+ image?: string;
44
+ /**
45
+ * Optional custom data object (e.g., shipping info, dimensions, etc.)
46
+ * This will be stored as cart item data with 'salsita_' prefix and accessible in WooCommerce.
47
+ */
48
+ customData?: Record<string, unknown>;
49
+ /**
50
+ * Optional resources to add to the cart
51
+ */
52
+ resources?: WooCommerceAddToCartResource[];
53
+ }
54
+ export declare const WooCommerceAddToCartItem: z.ZodType<WooCommerceAddToCartItem>;
55
+ export declare const WooCommerceAddToCartFeeType: {
56
+ readonly Flat: 'Flat';
57
+ readonly Percentage: 'Percentage';
58
+ };
59
+ export type WooCommerceAddToCartFeeType = ValueOf<typeof WooCommerceAddToCartFeeType>;
60
+ export interface WooCommerceAddToCartFee {
61
+ type: WooCommerceAddToCartFeeType;
62
+ name: string;
63
+ amount: number;
64
+ taxable?: boolean;
65
+ taxClass?: string;
66
+ }
67
+ export declare const WooCommerceAddToCartFee: z.ZodType<WooCommerceAddToCartFee>;
68
+ export interface WooCommerceAddToCartTask {
69
+ type: typeof TaskType.WooCommerceAddToCart;
70
+ /**
71
+ * The items to add to the cart
72
+ */
73
+ items: WooCommerceAddToCartItem[];
74
+ /**
75
+ * Optional fees to add to the cart
76
+ */
77
+ fees?: WooCommerceAddToCartFee[];
78
+ /**
79
+ * Session data
80
+ */
81
+ session: string;
82
+ /**
83
+ * Add to Cart URL
84
+ */
85
+ addToCartUrl: string;
86
+ /**
87
+ * API key
88
+ */
89
+ apiKey: string;
90
+ }
91
+ export declare const WooCommerceAddToCartTask: z.ZodType<WooCommerceAddToCartTask>;
@@ -0,0 +1 @@
1
+ import{z as o}from"zod";import{TaskResourceType as e,TaskType as t}from"../core/index.js";export const WooCommerceAddToCartResource=o.object({type:o.union([o.literal(e.Image),o.literal(e.Pdf),o.literal(e.Csv),o.literal(e.ConfigurationLink)]),name:o.string(),label:o.string()});export const WooCommerceAddToCartItem=o.object({product:o.string(),productName:o.string().optional(),productDescription:o.string().optional(),price:o.number().optional(),quantity:o.number().optional(),image:o.string().optional(),customData:o.record(o.string(),o.unknown()).optional(),resources:o.array(WooCommerceAddToCartResource).optional()});export const WooCommerceAddToCartFeeType={Flat:"Flat",Percentage:"Percentage"};export const WooCommerceAddToCartFee=o.object({type:o.nativeEnum(WooCommerceAddToCartFeeType),name:o.string(),amount:o.number(),taxable:o.boolean().optional(),taxClass:o.string().optional()});export const WooCommerceAddToCartTask=o.object({type:o.literal(t.WooCommerceAddToCart),items:o.array(WooCommerceAddToCartItem),fees:o.array(WooCommerceAddToCartFee).optional(),session:o.string(),addToCartUrl:o.string(),apiKey:o.string()});
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ import type { Entity } from '../domain/index.js';
3
+ import { ConfigurationId, DeploymentId, FrontendUrl, RevisionId } from '../domain/index.js';
4
+ export interface FinalizeWebhookPayload<FINALIZE_DATA, ENTITIES> {
5
+ configurationId: ConfigurationId;
6
+ revisionId: RevisionId;
7
+ deploymentId: DeploymentId;
8
+ frontendUrl: FrontendUrl;
9
+ rootEntityType: Entity['type'];
10
+ entities: ENTITIES[];
11
+ modelVersion: number;
12
+ data: FINALIZE_DATA;
13
+ }
14
+ export declare const FinalizeWebhookPayload: z.ZodObject<{
15
+ configurationId: z.ZodEffects<z.ZodString, ConfigurationId, string>;
16
+ revisionId: z.ZodEffects<z.ZodString, RevisionId, string>;
17
+ deploymentId: z.ZodEffects<z.ZodString, DeploymentId, string>;
18
+ frontendUrl: z.ZodEffects<z.ZodString, FrontendUrl, string>;
19
+ rootEntityType: z.ZodString;
20
+ entities: z.ZodArray<z.ZodObject<{
21
+ type: z.ZodString;
22
+ id: z.ZodString;
23
+ }, "strip", z.ZodTypeAny, {
24
+ type: string;
25
+ id: string;
26
+ }, {
27
+ type: string;
28
+ id: string;
29
+ }>, "many">;
30
+ modelVersion: z.ZodNumber;
31
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ configurationId: string & import("@salsita-ai/common/utils").Brand<"ConfigurationId">;
34
+ revisionId: string & import("@salsita-ai/common/utils").Brand<"RevisionId">;
35
+ deploymentId: string & import("@salsita-ai/common/utils").Brand<"DeploymentId">;
36
+ frontendUrl: string & import("@salsita-ai/common/utils").Brand<"FrontendUrl">;
37
+ rootEntityType: string;
38
+ entities: {
39
+ type: string;
40
+ id: string;
41
+ }[];
42
+ modelVersion: number;
43
+ data: Record<string, unknown>;
44
+ }, {
45
+ configurationId: string;
46
+ revisionId: string;
47
+ deploymentId: string;
48
+ frontendUrl: string;
49
+ rootEntityType: string;
50
+ entities: {
51
+ type: string;
52
+ id: string;
53
+ }[];
54
+ modelVersion: number;
55
+ data: Record<string, unknown>;
56
+ }>;
@@ -0,0 +1 @@
1
+ import{z as o}from"zod";import{usingType as r}from"@salsita-ai/common/utils";import{ConfigurationId as t,DeploymentId as n,FrontendUrl as i,RevisionId as s}from"../domain/index.js";export const FinalizeWebhookPayload=o.object({configurationId:o.string().transform(r(t)),revisionId:o.string().transform(r(s)),deploymentId:o.string().transform(r(n)),frontendUrl:o.string().transform(r(i)),rootEntityType:o.string(),entities:o.array(o.object({type:o.string(),id:o.string()})),modelVersion:o.number().positive(),data:o.record(o.unknown())});
package/package.json CHANGED
@@ -1,6 +1,87 @@
1
1
  {
2
2
  "name": "@salsita-ai/contracts",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.49.0-develop.2a2e8d75e7",
4
+ "description": "Shared API, authentication, domain, chat, and webhook contracts for Phoenix.",
5
+ "keywords": [
6
+ "salsita",
7
+ "3d",
8
+ "configurator",
9
+ "phoenix",
10
+ "platform"
11
+ ],
12
+ "license": "SEE LICENSE IN LICENSE",
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "type": "module",
17
+ "exports": {
18
+ "./api": {
19
+ "import": "./dist/api/index.js",
20
+ "types": "./dist/api/index.d.ts"
21
+ },
22
+ "./clerk": {
23
+ "import": "./dist/clerk/index.js",
24
+ "types": "./dist/clerk/index.d.ts"
25
+ },
26
+ "./domain": {
27
+ "import": "./dist/domain/index.js",
28
+ "types": "./dist/domain/index.d.ts"
29
+ },
30
+ "./chat": {
31
+ "import": "./dist/chat/index.js",
32
+ "types": "./dist/chat/index.d.ts"
33
+ },
34
+ "./assistant": {
35
+ "import": "./dist/assistant/index.js",
36
+ "types": "./dist/assistant/index.d.ts"
37
+ },
38
+ "./webhook": {
39
+ "import": "./dist/webhook/index.js",
40
+ "types": "./dist/webhook/index.d.ts"
41
+ }
42
+ },
43
+ "files": [
44
+ "dist",
45
+ "CHANGELOG.md"
46
+ ],
47
+ "dependencies": {
48
+ "@tanstack/ai": "0.64.0",
49
+ "@types/aws-lambda": "8.10.133",
50
+ "ajv": "8.20.0",
51
+ "http-errors": "2.0.1",
52
+ "jose": "6.2.3",
53
+ "lodash-es": "4.18.1",
54
+ "openai": "7.23.0",
55
+ "ts-pattern": "5.9.0",
56
+ "uuid": "14.0.0",
57
+ "valid-url": "1.0.9",
58
+ "zod": "3.25.76",
59
+ "@salsita-ai/common": "0.49.0-develop.2a2e8d75e7"
60
+ },
61
+ "devDependencies": {
62
+ "@lingui/core": "5.9.5",
63
+ "@swc/cli": "0.8.1",
64
+ "@swc/core": "1.15.40",
65
+ "@types/http-errors": "2.0.5",
66
+ "@types/json-schema": "7.0.15",
67
+ "@types/lodash-es": "4.17.12",
68
+ "@types/valid-url": "1.0.7",
69
+ "eslint": "9.39.4",
70
+ "prettier": "3.8.3",
71
+ "typescript": "npm:@typescript/typescript6@6.0.2",
72
+ "vite": "6.4.3",
73
+ "vitest": "4.1.11"
74
+ },
75
+ "scripts": {
76
+ "build": "rm -rf dist && tsc --project ./tsconfig.build.json --emitDeclarationOnly --checkers 1 && swc src --out-dir dist --strip-leading-paths",
77
+ "clean": "rm -rf dist && rm -rf node_modules",
78
+ "dev": "swc src --out-dir dist --watch --strip-leading-paths & tsc --project ./tsconfig.build.json --emitDeclarationOnly --watch --checkers 1",
79
+ "transpile": "swc src --out-dir dist --strip-leading-paths",
80
+ "lint:check": "eslint src",
81
+ "lint:fix": "eslint src --fix",
82
+ "prettify:check": "prettier --check .",
83
+ "prettify:fix": "prettier --write .",
84
+ "test": "vitest run",
85
+ "ts:check": "tsc --project ./tsconfig.build.json --noEmit --checkers 1"
86
+ }
6
87
  }