@superblocksteam/shared 0.9565.5 → 0.9566.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/org-features/index.d.ts +2 -1
  2. package/dist/org-features/index.d.ts.map +1 -1
  3. package/dist/org-features/index.js +2 -0
  4. package/dist/org-features/index.js.map +1 -1
  5. package/dist/org-features/index.test.js +1 -1
  6. package/dist/org-features/index.test.js.map +1 -1
  7. package/dist/plugins/index.d.ts.map +1 -1
  8. package/dist/plugins/index.js +3 -0
  9. package/dist/plugins/index.js.map +1 -1
  10. package/dist/plugins/registry.d.ts.map +1 -1
  11. package/dist/plugins/registry.js +2 -0
  12. package/dist/plugins/registry.js.map +1 -1
  13. package/dist/plugins/templates/index.d.ts +2 -0
  14. package/dist/plugins/templates/index.d.ts.map +1 -1
  15. package/dist/plugins/templates/index.js +2 -0
  16. package/dist/plugins/templates/index.js.map +1 -1
  17. package/dist/plugins/templates/snowflake.js +1 -1
  18. package/dist/plugins/templates/snowflake.js.map +1 -1
  19. package/dist/plugins/templates/snowflakecortex.d.ts +3 -0
  20. package/dist/plugins/templates/snowflakecortex.d.ts.map +1 -0
  21. package/dist/plugins/templates/snowflakecortex.js +18 -0
  22. package/dist/plugins/templates/snowflakecortex.js.map +1 -0
  23. package/dist/plugins/templates/snowflakepostgres.d.ts +6 -0
  24. package/dist/plugins/templates/snowflakepostgres.d.ts.map +1 -0
  25. package/dist/plugins/templates/snowflakepostgres.js +277 -0
  26. package/dist/plugins/templates/snowflakepostgres.js.map +1 -0
  27. package/dist/types/ai/credit-pricing.d.ts +47 -0
  28. package/dist/types/ai/credit-pricing.d.ts.map +1 -0
  29. package/dist/types/ai/credit-pricing.js +66 -0
  30. package/dist/types/ai/credit-pricing.js.map +1 -0
  31. package/dist/types/ai/index.d.ts +3 -0
  32. package/dist/types/ai/index.d.ts.map +1 -1
  33. package/dist/types/ai/index.js +17 -0
  34. package/dist/types/ai/index.js.map +1 -1
  35. package/dist/types/ai/quota-paywall.d.ts +14 -0
  36. package/dist/types/ai/quota-paywall.d.ts.map +1 -0
  37. package/dist/types/ai/quota-paywall.js +52 -0
  38. package/dist/types/ai/quota-paywall.js.map +1 -0
  39. package/dist/types/application/index.d.ts +2 -0
  40. package/dist/types/application/index.d.ts.map +1 -1
  41. package/dist/types/application/index.js.map +1 -1
  42. package/dist/types/billing/billing.d.ts +3 -1
  43. package/dist/types/billing/billing.d.ts.map +1 -1
  44. package/dist/types/billing/billing.js +2 -0
  45. package/dist/types/billing/billing.js.map +1 -1
  46. package/dist/types/datasource/index.d.ts +19 -1
  47. package/dist/types/datasource/index.d.ts.map +1 -1
  48. package/dist/types/datasource/index.js.map +1 -1
  49. package/dist/types/plugin/integration.d.ts +1 -0
  50. package/dist/types/plugin/integration.d.ts.map +1 -1
  51. package/dist/types/plugin/integration.js +3 -1
  52. package/dist/types/plugin/integration.js.map +1 -1
  53. package/dist/types/user/survey.d.ts +3 -0
  54. package/dist/types/user/survey.d.ts.map +1 -1
  55. package/dist/types/user/survey.js +3 -0
  56. package/dist/types/user/survey.js.map +1 -1
  57. package/dist-esm/org-features/index.d.ts +2 -1
  58. package/dist-esm/org-features/index.d.ts.map +1 -1
  59. package/dist-esm/org-features/index.js +2 -0
  60. package/dist-esm/org-features/index.js.map +1 -1
  61. package/dist-esm/org-features/index.test.js +1 -1
  62. package/dist-esm/org-features/index.test.js.map +1 -1
  63. package/dist-esm/plugins/index.d.ts.map +1 -1
  64. package/dist-esm/plugins/index.js +4 -1
  65. package/dist-esm/plugins/index.js.map +1 -1
  66. package/dist-esm/plugins/registry.d.ts.map +1 -1
  67. package/dist-esm/plugins/registry.js +3 -1
  68. package/dist-esm/plugins/registry.js.map +1 -1
  69. package/dist-esm/plugins/templates/index.d.ts +2 -0
  70. package/dist-esm/plugins/templates/index.d.ts.map +1 -1
  71. package/dist-esm/plugins/templates/index.js +2 -0
  72. package/dist-esm/plugins/templates/index.js.map +1 -1
  73. package/dist-esm/plugins/templates/snowflake.js +1 -1
  74. package/dist-esm/plugins/templates/snowflake.js.map +1 -1
  75. package/dist-esm/plugins/templates/snowflakecortex.d.ts +3 -0
  76. package/dist-esm/plugins/templates/snowflakecortex.d.ts.map +1 -0
  77. package/dist-esm/plugins/templates/snowflakecortex.js +15 -0
  78. package/dist-esm/plugins/templates/snowflakecortex.js.map +1 -0
  79. package/dist-esm/plugins/templates/snowflakepostgres.d.ts +6 -0
  80. package/dist-esm/plugins/templates/snowflakepostgres.d.ts.map +1 -0
  81. package/dist-esm/plugins/templates/snowflakepostgres.js +274 -0
  82. package/dist-esm/plugins/templates/snowflakepostgres.js.map +1 -0
  83. package/dist-esm/types/ai/credit-pricing.d.ts +47 -0
  84. package/dist-esm/types/ai/credit-pricing.d.ts.map +1 -0
  85. package/dist-esm/types/ai/credit-pricing.js +61 -0
  86. package/dist-esm/types/ai/credit-pricing.js.map +1 -0
  87. package/dist-esm/types/ai/index.d.ts +3 -0
  88. package/dist-esm/types/ai/index.d.ts.map +1 -1
  89. package/dist-esm/types/ai/index.js +3 -0
  90. package/dist-esm/types/ai/index.js.map +1 -1
  91. package/dist-esm/types/ai/quota-paywall.d.ts +14 -0
  92. package/dist-esm/types/ai/quota-paywall.d.ts.map +1 -0
  93. package/dist-esm/types/ai/quota-paywall.js +48 -0
  94. package/dist-esm/types/ai/quota-paywall.js.map +1 -0
  95. package/dist-esm/types/application/index.d.ts +2 -0
  96. package/dist-esm/types/application/index.d.ts.map +1 -1
  97. package/dist-esm/types/application/index.js.map +1 -1
  98. package/dist-esm/types/billing/billing.d.ts +3 -1
  99. package/dist-esm/types/billing/billing.d.ts.map +1 -1
  100. package/dist-esm/types/billing/billing.js +2 -0
  101. package/dist-esm/types/billing/billing.js.map +1 -1
  102. package/dist-esm/types/datasource/index.d.ts +19 -1
  103. package/dist-esm/types/datasource/index.d.ts.map +1 -1
  104. package/dist-esm/types/datasource/index.js.map +1 -1
  105. package/dist-esm/types/plugin/integration.d.ts +1 -0
  106. package/dist-esm/types/plugin/integration.d.ts.map +1 -1
  107. package/dist-esm/types/plugin/integration.js +3 -1
  108. package/dist-esm/types/plugin/integration.js.map +1 -1
  109. package/dist-esm/types/user/survey.d.ts +3 -0
  110. package/dist-esm/types/user/survey.d.ts.map +1 -1
  111. package/dist-esm/types/user/survey.js +3 -0
  112. package/dist-esm/types/user/survey.js.map +1 -1
  113. package/package.json +2 -2
  114. package/src/org-features/index.test.ts +1 -1
  115. package/src/org-features/index.ts +3 -1
  116. package/src/plugins/index.ts +5 -0
  117. package/src/plugins/registry.ts +4 -0
  118. package/src/plugins/templates/index.ts +2 -0
  119. package/src/plugins/templates/snowflake.ts +1 -1
  120. package/src/plugins/templates/snowflakecortex.ts +15 -0
  121. package/src/plugins/templates/snowflakepostgres.ts +299 -0
  122. package/src/types/ai/credit-pricing.ts +87 -0
  123. package/src/types/ai/index.ts +4 -0
  124. package/src/types/ai/quota-paywall.ts +62 -0
  125. package/src/types/application/index.ts +2 -0
  126. package/src/types/billing/billing.ts +3 -1
  127. package/src/types/datasource/index.ts +21 -0
  128. package/src/types/plugin/integration.ts +3 -1
  129. package/src/types/user/survey.ts +3 -0
@@ -35,7 +35,8 @@ export enum OrgFeature {
35
35
  ScheduledJobs = 'ScheduledJobs',
36
36
  LegacyApps = 'LegacyApps',
37
37
  PublicApps = 'PublicApps',
38
- ReactApps = 'ReactApps'
38
+ ReactApps = 'ReactApps',
39
+ Knowledge = 'Knowledge'
39
40
  }
40
41
 
41
42
  /**
@@ -68,6 +69,7 @@ export function orgHasFeature(orgVersion: OrgVersionType | undefined, feature: O
68
69
  // V1 orgs can also access React apps, but that's controlled by feature flags
69
70
  // checked separately - this function only handles org-version gating.
70
71
  case OrgFeature.ReactApps:
72
+ case OrgFeature.Knowledge:
71
73
  return orgVersion === OrgVersion.V2;
72
74
 
73
75
  default:
@@ -64,6 +64,8 @@ import {
64
64
  SlackPlugin,
65
65
  SmtpPlugin,
66
66
  SnowflakePlugin,
67
+ SnowflakeCortexPlugin,
68
+ SnowflakePostgresPlugin,
67
69
  StabilityAiPlugin,
68
70
  StripePlugin,
69
71
  SuperblocksOcrPlugin,
@@ -144,6 +146,8 @@ export const CLOUD_PLUGIN_VERSIONS_LATEST: PluginExecutionVersions = {
144
146
  [SlackPlugin.id]: MAX_VERSION,
145
147
  [SmtpPlugin.id]: MAX_VERSION,
146
148
  [SnowflakePlugin.id]: MAX_VERSION,
149
+ [SnowflakeCortexPlugin.id]: MAX_VERSION,
150
+ [SnowflakePostgresPlugin.id]: MAX_VERSION,
147
151
  [StabilityAiPlugin.id]: MAX_VERSION,
148
152
  [StripePlugin.id]: MAX_VERSION,
149
153
  [SuperblocksOcrPlugin.id]: MAX_VERSION,
@@ -200,6 +204,7 @@ export const ORCHESTRATOR_PLUGIN_VERSIONS: SupportedPluginVersions = {
200
204
  [SalesforcePlugin.id]: ['0.0.2'],
201
205
  [SmtpPlugin.id]: ['0.0.1'],
202
206
  [SnowflakePlugin.id]: ['0.0.10'],
207
+ [SnowflakePostgresPlugin.id]: ['0.0.1'],
203
208
  [SuperblocksOcrPlugin.id]: ['0.0.1'],
204
209
  [WorkflowPlugin.id]: ['0.0.4']
205
210
  };
@@ -66,6 +66,8 @@ import {
66
66
  SlackPlugin,
67
67
  SmtpPlugin,
68
68
  SnowflakePlugin,
69
+ SnowflakeCortexPlugin,
70
+ SnowflakePostgresPlugin,
69
71
  StabilityAiPlugin,
70
72
  StripePlugin,
71
73
  SuperblocksOcrPlugin,
@@ -181,6 +183,8 @@ export const RegisteredPlugins = (googleSheetsClientId: string): PluginRegistry
181
183
  [SlackPlugin.id]: SlackPlugin,
182
184
  [SmtpPlugin.id]: SmtpPlugin,
183
185
  [SnowflakePlugin.id]: SnowflakePlugin,
186
+ [SnowflakeCortexPlugin.id]: SnowflakeCortexPlugin,
187
+ [SnowflakePostgresPlugin.id]: SnowflakePostgresPlugin,
184
188
  [StripePlugin.id]: StripePlugin,
185
189
  [SuperblocksOcrPlugin.id]: SuperblocksOcrPlugin,
186
190
  [TwilioPlugin.id]: TwilioPlugin,
@@ -63,6 +63,8 @@ export * from './shared/index.js';
63
63
  export * from './slack.js';
64
64
  export * from './smtp.js';
65
65
  export * from './snowflake.js';
66
+ export * from './snowflakecortex.js';
67
+ export * from './snowflakepostgres.js';
66
68
  export * from './stabilityai.js';
67
69
  export * from './stripe.js';
68
70
  export * from './superblocks-ocr.js';
@@ -120,7 +120,7 @@ const BASE_CONNECTION_METHOD = {
120
120
 
121
121
  export const SnowflakePlugin: Plugin = {
122
122
  id: 'snowflake',
123
- name: 'Snowflake',
123
+ name: 'Snowflake Warehouse',
124
124
  moduleName: 'SnowflakePlugin',
125
125
  modulePath: 'plugins/snowflake/SnowflakePlugin',
126
126
  iconLocation: `${PUBLIC_INTEGRATIONS_LOGO_URL}/snowflake.png`,
@@ -0,0 +1,15 @@
1
+ import { ExtendedIntegrationPluginId, Plugin } from '../../types/index.js';
2
+ import { PUBLIC_INTEGRATIONS_CDN_URL, PUBLIC_INTEGRATIONS_LOGO_URL } from './constants.js';
3
+ import { getNativeOpenApiPlugin } from './shared/index.js';
4
+
5
+ export const SnowflakeCortexPlugin: Plugin = getNativeOpenApiPlugin({
6
+ name: 'Snowflake Cortex',
7
+ id: ExtendedIntegrationPluginId.SNOWFLAKE_CORTEX,
8
+ openApiSpecURL: `${PUBLIC_INTEGRATIONS_CDN_URL}/openapi/snowflake-cortex.yaml`,
9
+ logoURL: `${PUBLIC_INTEGRATIONS_LOGO_URL}/snowflake.png`,
10
+ authMethods: {
11
+ apiKeyForm: [{ label: 'API key', header: 'Authorization', key: 'api-key', required: true, valuePrefix: 'Bearer ' }]
12
+ },
13
+ isStreamable: true,
14
+ serverURL: 'https://{SUPERBLOCKS_OPENAPI_TENANT_NAME}.snowflakecomputing.com'
15
+ });
@@ -0,0 +1,299 @@
1
+ import {
2
+ DB_SQL_INITIAL_TEXT,
3
+ EditorLanguage,
4
+ FormComponentType,
5
+ FormItem,
6
+ InputDataType,
7
+ Plugin,
8
+ PluginResponseType,
9
+ PluginType
10
+ } from '../../types/index.js';
11
+ import { PARAMETERIZED_SQL_DESCRIPTION, PUBLIC_INTEGRATIONS_LOGO_URL, DOCS_BASE_URL } from './constants.js';
12
+ import { CONNECTION_METHODS_AND_DISPLAY_NAMES, makeDropdownItem } from './shared/db.js';
13
+
14
+ export const SnowflakePostgresPluginVersions = {
15
+ V1: '0.0.1'
16
+ };
17
+
18
+ const BASE_HOST = {
19
+ label: 'Host',
20
+ name: 'connection.host',
21
+ componentType: FormComponentType.INPUT_TEXT,
22
+ placeholder: 'xxxx.us-west-2.aws.postgres.snowflake.app',
23
+ rules: [{ required: true, message: 'Host is required' }]
24
+ };
25
+
26
+ const BASE_PORT = {
27
+ label: 'Port',
28
+ name: 'connection.port',
29
+ componentType: FormComponentType.INPUT_TEXT,
30
+ dataType: InputDataType.NUMBER,
31
+ initialValue: 5432,
32
+ rules: [{ required: true, message: 'Port is required' }]
33
+ };
34
+
35
+ const BASE_DATABASE_NAME = {
36
+ label: 'Database name',
37
+ name: 'connection.databaseName',
38
+ componentType: FormComponentType.INPUT_TEXT,
39
+ rules: [{ required: true, message: 'Database name is required' }]
40
+ };
41
+
42
+ const BASE_DATABASE_USERNAME = {
43
+ label: 'Database username',
44
+ name: 'connection.username',
45
+ componentType: FormComponentType.INPUT_TEXT
46
+ };
47
+
48
+ const BASE_DATABASE_PASSWORD = {
49
+ label: 'Database password',
50
+ name: 'connection.password',
51
+ componentType: FormComponentType.INPUT_TEXT,
52
+ dataType: InputDataType.PASSWORD
53
+ };
54
+
55
+ const BASE_SELFSIGNED_SSL = {
56
+ label: 'Use a self-signed SSL certificate',
57
+ name: 'connection.useSelfSignedSsl',
58
+ componentType: FormComponentType.CHECKBOX,
59
+ tooltip: {
60
+ markdownText: 'Use a self-signed SSL certificate'
61
+ }
62
+ };
63
+
64
+ const BASE_SERVER_CA = {
65
+ label: 'Server CA',
66
+ name: 'connection.ca',
67
+ componentType: FormComponentType.CODE_EDITOR,
68
+ language: EditorLanguage.TEXT,
69
+ placeholder:
70
+ '-----BEGIN CERTIFICATE-----\n' +
71
+ 'MIIC/jCCAeYCCQDLwS4pIwJC3zANBgkqhkiG9w0BAQsFADBBMQswCQYDVQQGEwJV\n' +
72
+ '...\n' +
73
+ '-----END CERTIFICATE-----'
74
+ };
75
+
76
+ const BASE_CLIENT_KEY = {
77
+ label: 'Client key',
78
+ name: 'connection.key',
79
+ componentType: FormComponentType.CODE_EDITOR,
80
+ language: EditorLanguage.TEXT,
81
+ placeholder:
82
+ '-----BEGIN RSA PRIVATE KEY-----\n' +
83
+ 'BAoMBFRlc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpvozN05Ou\n' +
84
+ '...\n' +
85
+ '-----END RSA PRIVATE KEY-----'
86
+ };
87
+
88
+ const BASE_CLIENT_CERT = {
89
+ label: 'Client cert',
90
+ name: 'connection.cert',
91
+ componentType: FormComponentType.CODE_EDITOR,
92
+ language: EditorLanguage.TEXT,
93
+ placeholder:
94
+ '-----BEGIN CERTIFICATE-----\n' +
95
+ 'Ur2LYWdrVjqlS/wJyVIze15FMf7sgl+RINsLbQDLwS4pIwJC3zANBgkqhkiG9w0B\n' +
96
+ '...\n' +
97
+ '-----END CERTIFICATE-----'
98
+ };
99
+
100
+ export const SnowflakePostgresPlugin: Plugin = {
101
+ id: 'snowflakepostgres',
102
+ name: 'Snowflake Postgres',
103
+ moduleName: 'SnowflakePostgresPlugin',
104
+ modulePath: 'plugins/snowflakepostgres/SnowflakePostgresPlugin',
105
+ iconLocation: `${PUBLIC_INTEGRATIONS_LOGO_URL}/snowflake.png`,
106
+ docsUrl: `${DOCS_BASE_URL}/snowflakepostgres`,
107
+ type: PluginType.DB,
108
+ responseType: PluginResponseType.TABLE,
109
+ hasRawRequest: true,
110
+ hasMetadata: true,
111
+ rawRequestName: 'Executed SQL',
112
+ datasourceTemplate: {
113
+ sections: [
114
+ {
115
+ name: 'main',
116
+ items: [
117
+ {
118
+ label: 'Display name',
119
+ name: 'name',
120
+ startVersion: SnowflakePostgresPluginVersions.V1,
121
+ componentType: FormComponentType.INPUT_TEXT,
122
+ placeholder: 'Snowflake Postgres Production',
123
+ rules: [{ required: true, message: 'Display name is required' }]
124
+ },
125
+ {
126
+ label: 'Connection method',
127
+ name: 'connectionType',
128
+ startVersion: SnowflakePostgresPluginVersions.V1,
129
+ componentType: FormComponentType.DROPDOWN,
130
+ initialValue: 'fields',
131
+ rules: [{ required: true }],
132
+ options: Object.entries(CONNECTION_METHODS_AND_DISPLAY_NAMES).map(([value, displayName]) =>
133
+ makeDropdownItem(value, displayName)
134
+ )
135
+ },
136
+ {
137
+ label: 'URI',
138
+ name: 'connectionUrl',
139
+ startVersion: SnowflakePostgresPluginVersions.V1,
140
+ componentType: FormComponentType.DYNAMIC_INPUT_TEXT,
141
+ placeholder: `postgres://[:user]:[:password]@[:host]:[:port]/[:database]`,
142
+ tooltip: {
143
+ markdownText: 'PostgreSQL-compatible connection URI for your Snowflake Postgres instance'
144
+ },
145
+ rules: [{ required: true, message: 'URI is required' }],
146
+ display: {
147
+ show: {
148
+ connectionType: ['url']
149
+ }
150
+ }
151
+ },
152
+ // HOST
153
+ {
154
+ ...BASE_HOST,
155
+ startVersion: SnowflakePostgresPluginVersions.V1,
156
+ display: {
157
+ show: {
158
+ connectionType: ['fields']
159
+ }
160
+ }
161
+ } as FormItem,
162
+ // PORT
163
+ {
164
+ ...BASE_PORT,
165
+ startVersion: SnowflakePostgresPluginVersions.V1,
166
+ display: {
167
+ show: {
168
+ connectionType: ['fields']
169
+ }
170
+ }
171
+ } as FormItem,
172
+ // DATABASE NAME
173
+ {
174
+ ...BASE_DATABASE_NAME,
175
+ startVersion: SnowflakePostgresPluginVersions.V1,
176
+ display: {
177
+ show: {
178
+ connectionType: ['fields']
179
+ }
180
+ }
181
+ } as FormItem,
182
+ // DATABASE USERNAME
183
+ {
184
+ ...BASE_DATABASE_USERNAME,
185
+ startVersion: SnowflakePostgresPluginVersions.V1,
186
+ display: {
187
+ show: {
188
+ connectionType: ['fields']
189
+ }
190
+ }
191
+ } as FormItem,
192
+ // DATABASE PASSWORD
193
+ {
194
+ ...BASE_DATABASE_PASSWORD,
195
+ startVersion: SnowflakePostgresPluginVersions.V1,
196
+ display: {
197
+ show: {
198
+ connectionType: ['fields']
199
+ }
200
+ }
201
+ } as FormItem,
202
+ // SSL is always enabled for Snowflake - no checkbox shown.
203
+ // Self-signed SSL certificate option
204
+ {
205
+ ...BASE_SELFSIGNED_SSL,
206
+ startVersion: SnowflakePostgresPluginVersions.V1,
207
+ display: {
208
+ show: {
209
+ connectionType: ['fields']
210
+ }
211
+ }
212
+ } as FormItem,
213
+ // SERVER CA
214
+ {
215
+ ...BASE_SERVER_CA,
216
+ startVersion: SnowflakePostgresPluginVersions.V1,
217
+ display: {
218
+ show: {
219
+ 'connection.useSelfSignedSsl': ['true'],
220
+ connectionType: ['fields']
221
+ }
222
+ }
223
+ } as FormItem,
224
+ // CLIENT KEY
225
+ {
226
+ ...BASE_CLIENT_KEY,
227
+ startVersion: SnowflakePostgresPluginVersions.V1,
228
+ display: {
229
+ show: {
230
+ 'connection.useSelfSignedSsl': ['true'],
231
+ connectionType: ['fields']
232
+ }
233
+ }
234
+ } as FormItem,
235
+ // CLIENT CERT
236
+ {
237
+ ...BASE_CLIENT_CERT,
238
+ startVersion: SnowflakePostgresPluginVersions.V1,
239
+ display: {
240
+ show: {
241
+ 'connection.useSelfSignedSsl': ['true'],
242
+ connectionType: ['fields']
243
+ }
244
+ }
245
+ } as FormItem
246
+ ]
247
+ }
248
+ ]
249
+ },
250
+ actionTemplate: {
251
+ sections: [
252
+ {
253
+ name: 'main',
254
+ items: [
255
+ {
256
+ label: 'Parameters ($1, $2, ...)',
257
+ name: 'parameters',
258
+ startVersion: SnowflakePostgresPluginVersions.V1,
259
+ ldFlag: 'clark.parameterized-apis.v2.enabled',
260
+ componentType: FormComponentType.DYNAMIC_INPUT_TEXT,
261
+ placeholder: '[param1, param2, ...]',
262
+ tooltip: {
263
+ markdownText:
264
+ 'JavaScript expression that evaluates to an array of parameter values. Use `$1`, `$2`, etc. in your SQL query to reference these parameters.'
265
+ }
266
+ },
267
+ {
268
+ label: '', // Query
269
+ name: 'body',
270
+ startVersion: SnowflakePostgresPluginVersions.V1,
271
+ componentType: FormComponentType.CODE_EDITOR,
272
+ language: EditorLanguage.SQL,
273
+ initialValue: DB_SQL_INITIAL_TEXT
274
+ }
275
+ ]
276
+ },
277
+ {
278
+ name: 'advanced:main',
279
+ items: [
280
+ {
281
+ label: 'Use parameterized SQL',
282
+ name: 'usePreparedSql',
283
+ startVersion: SnowflakePostgresPluginVersions.V1,
284
+ componentType: FormComponentType.SWITCH,
285
+ initialValue: true,
286
+ tooltip: {
287
+ markdownText: PARAMETERIZED_SQL_DESCRIPTION
288
+ },
289
+ display: {
290
+ show: {
291
+ parameters: ['undefined']
292
+ }
293
+ }
294
+ }
295
+ ]
296
+ }
297
+ ]
298
+ }
299
+ };
@@ -0,0 +1,87 @@
1
+ export type AiCreditTokenRates = {
2
+ inputTokenCost: number;
3
+ outputTokenCost: number;
4
+ cacheReadTokenCost: number;
5
+ cacheWriteTokenCost: number;
6
+ };
7
+
8
+ export const AI_CREDIT_COST_MULTIPLIER = 2;
9
+
10
+ export const AI_MODEL_CREDIT_RATES = {
11
+ 'claude-haiku-4-5': {
12
+ inputTokenCost: 0.000001,
13
+ outputTokenCost: 0.000005,
14
+ cacheReadTokenCost: 0.0000001,
15
+ cacheWriteTokenCost: 0.00000125
16
+ },
17
+ 'claude-opus-4-5': {
18
+ inputTokenCost: 0.000005,
19
+ outputTokenCost: 0.000025,
20
+ cacheReadTokenCost: 0.0000005,
21
+ cacheWriteTokenCost: 0.00000625
22
+ },
23
+ 'claude-opus-4-6': {
24
+ inputTokenCost: 0.000005,
25
+ outputTokenCost: 0.000025,
26
+ cacheReadTokenCost: 0.0000005,
27
+ cacheWriteTokenCost: 0.00000625
28
+ },
29
+ 'claude-sonnet-4-5': {
30
+ inputTokenCost: 0.000003,
31
+ outputTokenCost: 0.000015,
32
+ cacheReadTokenCost: 0.0000003,
33
+ cacheWriteTokenCost: 0.00000375
34
+ }
35
+ } as const satisfies Record<string, AiCreditTokenRates>;
36
+
37
+ export const AI_FALLBACK_CREDIT_RATES: AiCreditTokenRates = AI_MODEL_CREDIT_RATES['claude-sonnet-4-5'];
38
+
39
+ const MODEL_MATCH_ORDER = ['claude-opus-4-6', 'claude-opus-4-5', 'claude-sonnet-4-5', 'claude-haiku-4-5'] as const;
40
+
41
+ const normalizeModelForPricing = (rawModel: string): string | undefined => {
42
+ const normalized = rawModel.toLowerCase();
43
+ for (const modelKey of MODEL_MATCH_ORDER) {
44
+ if (normalized.includes(modelKey)) {
45
+ return modelKey;
46
+ }
47
+ }
48
+ return undefined;
49
+ };
50
+
51
+ export const resolveAiCreditRates = (
52
+ model: string
53
+ ): {
54
+ modelKey: string;
55
+ rates: AiCreditTokenRates;
56
+ usedFallback: boolean;
57
+ } => {
58
+ const modelKey = normalizeModelForPricing(model);
59
+ if (!modelKey) {
60
+ return {
61
+ modelKey: 'fallback',
62
+ rates: AI_FALLBACK_CREDIT_RATES,
63
+ usedFallback: true
64
+ };
65
+ }
66
+
67
+ return {
68
+ modelKey,
69
+ rates: AI_MODEL_CREDIT_RATES[modelKey],
70
+ usedFallback: false
71
+ };
72
+ };
73
+
74
+ export const computeAiCreditUsage = (params: {
75
+ inputTokens: number;
76
+ outputTokens: number;
77
+ cachedReadTokens: number;
78
+ cachedWriteTokens: number;
79
+ rates: AiCreditTokenRates;
80
+ }): number => {
81
+ const usdCost =
82
+ params.inputTokens * params.rates.inputTokenCost +
83
+ params.outputTokens * params.rates.outputTokenCost +
84
+ params.cachedReadTokens * params.rates.cacheReadTokenCost +
85
+ params.cachedWriteTokens * params.rates.cacheWriteTokenCost;
86
+ return usdCost * AI_CREDIT_COST_MULTIPLIER;
87
+ };
@@ -12,6 +12,7 @@ export type AiChatMessageDto = {
12
12
  * System event trigger types for AI operations without prompt_id
13
13
  */
14
14
  export enum AiSystemTriggerType {
15
+ APP_NAME = 'app_name',
15
16
  COMMIT_MESSAGE = 'commit_message',
16
17
  FACT_METADATA = 'fact_metadata'
17
18
  }
@@ -44,3 +45,6 @@ export interface AiWorkflowEvent {
44
45
  promptId: string;
45
46
  attributes: AiWorkflowAttributes;
46
47
  }
48
+
49
+ export * from './credit-pricing.js';
50
+ export * from './quota-paywall.js';
@@ -0,0 +1,62 @@
1
+ export type AiQuotaPaywallReason = 'token_limit_exceeded' | 'trial_expired';
2
+
3
+ export const getAiQuotaPaywallReasonFromMessage = (message: string): AiQuotaPaywallReason | undefined => {
4
+ const normalizedMessage = message.toLowerCase();
5
+
6
+ if (
7
+ normalizedMessage.includes('trial_expired') ||
8
+ normalizedMessage.includes('ai trial period has ended') ||
9
+ normalizedMessage.includes('free trial has ended')
10
+ ) {
11
+ return 'trial_expired';
12
+ }
13
+
14
+ if (normalizedMessage.includes('token_limit_exceeded') || normalizedMessage.includes('ai usage limit')) {
15
+ return 'token_limit_exceeded';
16
+ }
17
+
18
+ return undefined;
19
+ };
20
+
21
+ export const AI_QUOTA_PAYWALL_STRIPE_CHECKOUT_URL = 'https://buy.stripe.com/7sYeVc8XNfl3fZ40FT8EM02';
22
+
23
+ export const AI_QUOTA_PAYWALL_CONTACT_SALES_EMAIL = 'sales@superblockshq.com';
24
+
25
+ export const AI_QUOTA_PAYWALL_CONTACT_SALES_MAILTO = 'mailto:sales@superblockshq.com?subject=Enterprise%20inquiry';
26
+
27
+ export const AI_QUOTA_PAYWALL_REASON_CONFIG: Record<AiQuotaPaywallReason, { title: string; subtitle: string }> = {
28
+ token_limit_exceeded: {
29
+ title: 'Your free trial has ended',
30
+ subtitle: 'Upgrade your plan to continue using Clark AI and other AI-powered features.'
31
+ },
32
+ trial_expired: {
33
+ title: 'Your free trial has ended',
34
+ subtitle: 'Upgrade to keep building with AI.'
35
+ }
36
+ };
37
+
38
+ export const AI_QUOTA_PAYWALL_TEAMS_FEATURES = [
39
+ '200 AI Credits per AI Builder / month',
40
+ 'Clark AI agent for app building',
41
+ 'Clark User Memory',
42
+ 'AI Credit Packs add-on available'
43
+ ];
44
+
45
+ export const AI_QUOTA_PAYWALL_ENTERPRISE_FEATURES = [
46
+ '200 AI Credits per AI Builder / month',
47
+ 'Org-level credit top-ups, shared across team',
48
+ 'Clark AI agent for app building',
49
+ 'Clark Integration and Organization Memory'
50
+ ];
51
+
52
+ export const AI_QUOTA_PAYWALL_TEAMS_PLATFORM_FEATURES = ['Staging and production environments', '50+ integrations'];
53
+
54
+ export const AI_QUOTA_PAYWALL_ENTERPRISE_PLATFORM_FEATURES = [
55
+ 'Source Control via GitHub, GitLab, BitBucket, Azure DevOps',
56
+ 'Custom app hosting with volume pricing',
57
+ 'SSO / SAML / OIDC',
58
+ 'VPC Deployment',
59
+ 'Audit Logs',
60
+ 'Dedicated support',
61
+ '99.9% SLA'
62
+ ];
@@ -506,6 +506,8 @@ export type PostApplicationCreateRequestBody = {
506
506
  createUsingReact?: boolean;
507
507
  /** which template to use when creating a React/code-mode application (e.g. 'shadcn-demo-app', 'blank-app') */
508
508
  templateName?: string;
509
+ /** When provided, server generates an AI app name from this prompt */
510
+ initialPrompt?: string;
509
511
  };
510
512
  export interface ApplicationPageClonePayload {
511
513
  applicationId: string;
@@ -3,7 +3,9 @@ export enum BillingPlan {
3
3
  FREE = 'FREE',
4
4
  STARTER = 'STARTER',
5
5
  PRO = 'PRO',
6
- ENTERPRISE = 'ENTERPRISE'
6
+ ENTERPRISE = 'ENTERPRISE',
7
+ TEAMS = 'TEAMS',
8
+ POC = 'POC'
7
9
  }
8
10
 
9
11
  export type Billing = {
@@ -453,6 +453,24 @@ export type LakebaseDatasourceConfiguration = {
453
453
  oauthType?: IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE;
454
454
  };
455
455
 
456
+ // Snowflake Postgres is Snowflake's Postgres-compatible database endpoint
457
+ export type SnowflakePostgresDatasourceConfiguration = {
458
+ name?: string;
459
+ connection?: {
460
+ host?: string;
461
+ port?: number;
462
+ databaseName?: string;
463
+ username?: string;
464
+ password?: string;
465
+ useSelfSignedSsl?: boolean;
466
+ ca?: string;
467
+ key?: string;
468
+ cert?: string;
469
+ };
470
+ connectionType?: 'fields' | 'url';
471
+ connectionUrl?: string;
472
+ };
473
+
456
474
  export type OracleDbDatasourceConfiguration = Pick<OracleDbPlugin.Plugin, 'name' | 'connection' | 'dynamicWorkflowConfiguration'> & {
457
475
  connectionType?: 'fields' | 'url';
458
476
  connectionUrl?: string;
@@ -501,6 +519,7 @@ export type DatasourceConfiguration = (
501
519
  | OracleDbDatasourceConfiguration
502
520
  | DatabricksDatasourceConfiguration
503
521
  | LakebaseDatasourceConfiguration
522
+ | SnowflakePostgresDatasourceConfiguration
504
523
  | CouchbaseDatasourceConfiguration
505
524
  | SecretStore
506
525
  ) &
@@ -537,6 +556,8 @@ export type DatasourceConfigurationByType = {
537
556
  s3?: S3DatasourceConfiguration & TemporaryFields;
538
557
  smtp?: SmtpDatasourceConfiguration & TemporaryFields;
539
558
  snowflake?: SnowflakeDatasourceConfiguration & TemporaryFields;
559
+ snowflakecortex?: RestApiIntegrationDatasourceConfiguration & TemporaryFields;
560
+ snowflakepostgres?: SnowflakePostgresDatasourceConfiguration & TemporaryFields;
540
561
  salesforce?: SalesforceDatasourceConfiguration & TemporaryFields;
541
562
  'superblocks-ocr'?: SuperblocksOcrDatasourceConfiguration & TemporaryFields;
542
563
  workflow?: WorkflowDatasourceConfiguration & TemporaryFields;
@@ -43,6 +43,7 @@ export enum ExtendedIntegrationPluginId {
43
43
  COHERE = 'cohere',
44
44
  GEMINI = 'gemini',
45
45
  OPENAI_V2 = 'openai_v2',
46
+ SNOWFLAKE_CORTEX = 'snowflakecortex',
46
47
  // Not native OpenAPI-backed integrations, but leveraging the same auth system
47
48
  GOOGLE_SHEETS_PLUGIN_ID = 'gsheets',
48
49
  SNOWFLAKE = 'snowflake',
@@ -91,7 +92,8 @@ export const ExtendedIntegrationPluginMap: Record<string, string> = {
91
92
  [ExtendedIntegrationPluginId.STABILITYAI]: ExtendedIntegrationPluginId.REST_API,
92
93
  [ExtendedIntegrationPluginId.COHERE]: ExtendedIntegrationPluginId.REST_API,
93
94
  [ExtendedIntegrationPluginId.GEMINI]: ExtendedIntegrationPluginId.REST_API,
94
- [ExtendedIntegrationPluginId.OPENAI_V2]: ExtendedIntegrationPluginId.REST_API
95
+ [ExtendedIntegrationPluginId.OPENAI_V2]: ExtendedIntegrationPluginId.REST_API,
96
+ [ExtendedIntegrationPluginId.SNOWFLAKE_CORTEX]: ExtendedIntegrationPluginId.REST_API
95
97
  };
96
98
 
97
99
  export const EXTENDED_INTEGRATION_PLUGIN_IDS = Object.values(ExtendedIntegrationPluginId).map((val) => val as string);
@@ -1,5 +1,8 @@
1
1
  export enum SurveyToShow {
2
2
  NO_SURVEY = 'NO_SURVEY',
3
+ SURVEY_FOR_NEW_USER = 'SURVEY_FOR_NEW_USER',
4
+ /** @deprecated Use SURVEY_FOR_NEW_USER instead */
3
5
  SURVEY_FOR_NEW_USER_NEW_ORG = 'SURVEY_FOR_NEW_USER_NEW_ORG',
6
+ /** @deprecated Use SURVEY_FOR_NEW_USER instead */
4
7
  SURVEY_FOR_NEW_USER_EXISTING_ORG = 'SURVEY_FOR_NEW_USER_EXISTING_ORG'
5
8
  }