@ganju/utils 0.0.18 → 0.0.21

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 (72) hide show
  1. package/dist/constants.d.ts +18 -0
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.js +50 -3
  4. package/dist/crypto.d.ts +2 -2
  5. package/dist/crypto.d.ts.map +1 -1
  6. package/dist/crypto.js +1 -0
  7. package/dist/data.d.ts +6 -4
  8. package/dist/data.d.ts.map +1 -1
  9. package/dist/data.js +13 -3
  10. package/dist/dataApi.d.ts +54 -8
  11. package/dist/dataApi.d.ts.map +1 -1
  12. package/dist/dataApi.js +40 -7
  13. package/dist/dataAttachment.d.ts +8 -0
  14. package/dist/dataAttachment.d.ts.map +1 -0
  15. package/dist/dataAttachment.js +19 -0
  16. package/dist/dataCompiler.d.ts +3 -0
  17. package/dist/dataCompiler.d.ts.map +1 -1
  18. package/dist/dataCompiler.js +25 -1
  19. package/dist/dataDdl.d.ts.map +1 -1
  20. package/dist/dataDdl.js +5 -0
  21. package/dist/dataEngine.d.ts +9 -3
  22. package/dist/dataEngine.d.ts.map +1 -1
  23. package/dist/dataEngine.js +141 -5
  24. package/dist/dataIndexAdvice.d.ts +36 -0
  25. package/dist/dataIndexAdvice.d.ts.map +1 -0
  26. package/dist/dataIndexAdvice.js +89 -0
  27. package/dist/dataRpc.d.ts +12 -1
  28. package/dist/dataRpc.d.ts.map +1 -1
  29. package/dist/dataTools.js +3 -3
  30. package/dist/dataTriggers.d.ts +23 -0
  31. package/dist/dataTriggers.d.ts.map +1 -1
  32. package/dist/dataTriggers.js +46 -2
  33. package/dist/dataTypes.d.ts +46 -0
  34. package/dist/dataTypes.d.ts.map +1 -1
  35. package/dist/dataTypes.js +7 -1
  36. package/dist/index.d.ts +138 -4
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +31 -0
  39. package/dist/localizeDataError.d.ts.map +1 -1
  40. package/dist/localizeDataError.js +64 -2
  41. package/dist/schema.d.ts +85 -2
  42. package/dist/schema.d.ts.map +1 -1
  43. package/dist/schema.js +94 -1
  44. package/dist/sdkConstants.d.ts +1 -0
  45. package/dist/sdkConstants.d.ts.map +1 -1
  46. package/dist/sdkConstants.js +2 -1
  47. package/dist/whatsappTemplates.d.ts +77 -0
  48. package/dist/whatsappTemplates.d.ts.map +1 -0
  49. package/dist/whatsappTemplates.js +402 -0
  50. package/dist/whatsappWebhook.d.ts +28 -0
  51. package/dist/whatsappWebhook.d.ts.map +1 -0
  52. package/dist/whatsappWebhook.js +30 -0
  53. package/package.json +1 -1
  54. package/src/constants.ts +57 -3
  55. package/src/crypto.ts +3 -2
  56. package/src/data.ts +14 -0
  57. package/src/dataApi.ts +44 -6
  58. package/src/dataAttachment.ts +23 -0
  59. package/src/dataCompiler.ts +37 -0
  60. package/src/dataDdl.ts +7 -0
  61. package/src/dataEngine.ts +195 -5
  62. package/src/dataIndexAdvice.ts +127 -0
  63. package/src/dataRpc.ts +17 -1
  64. package/src/dataTools.ts +3 -3
  65. package/src/dataTriggers.ts +71 -1
  66. package/src/dataTypes.ts +62 -0
  67. package/src/index.ts +74 -1
  68. package/src/localizeDataError.ts +101 -3
  69. package/src/schema.ts +115 -1
  70. package/src/sdkConstants.ts +1 -0
  71. package/src/whatsappTemplates.ts +465 -0
  72. package/src/whatsappWebhook.ts +55 -0
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ const containmentToken_1 = require("./containmentToken");
24
24
  const oauthProviders_1 = require("./oauthProviders");
25
25
  const attachment_1 = require("./attachment");
26
26
  const exposedResource_1 = require("./exposedResource");
27
+ const dataAttachment_1 = require("./dataAttachment");
27
28
  const syncableResource_1 = require("./syncableResource");
28
29
  const vendorError_1 = require("./vendorError");
29
30
  const deadline_1 = require("./deadline");
@@ -59,9 +60,37 @@ const sources_1 = require("./sources");
59
60
  const citations_1 = require("./citations");
60
61
  const oauth_1 = require("./oauth");
61
62
  const vendorTimeZone_1 = require("./vendorTimeZone");
63
+ const whatsappTemplates_1 = require("./whatsappTemplates");
64
+ const whatsappWebhook_1 = require("./whatsappWebhook");
62
65
  const planLimitError_1 = require("./planLimitError");
63
66
  exports.utils = {
64
67
  Schema: schema_1.Schema,
68
+ WHATSAPP_TEMPLATE_CATEGORIES: whatsappTemplates_1.WHATSAPP_TEMPLATE_CATEGORIES,
69
+ WHATSAPP_TEMPLATE_STATUS_APPROVED: whatsappTemplates_1.WHATSAPP_TEMPLATE_STATUS_APPROVED,
70
+ WHATSAPP_TEMPLATE_STATUSES_WAITING: whatsappTemplates_1.WHATSAPP_TEMPLATE_STATUSES_WAITING,
71
+ WHATSAPP_TEMPLATE_STATUSES_STOPPED: whatsappTemplates_1.WHATSAPP_TEMPLATE_STATUSES_STOPPED,
72
+ WHATSAPP_TEMPLATE_NAME_MAX: whatsappTemplates_1.WHATSAPP_TEMPLATE_NAME_MAX,
73
+ WHATSAPP_TEMPLATE_BODY_MAX: whatsappTemplates_1.WHATSAPP_TEMPLATE_BODY_MAX,
74
+ WHATSAPP_TEMPLATE_HEADER_MAX: whatsappTemplates_1.WHATSAPP_TEMPLATE_HEADER_MAX,
75
+ WHATSAPP_TEMPLATE_FOOTER_MAX: whatsappTemplates_1.WHATSAPP_TEMPLATE_FOOTER_MAX,
76
+ WHATSAPP_TEMPLATE_BUTTON_MAX: whatsappTemplates_1.WHATSAPP_TEMPLATE_BUTTON_MAX,
77
+ WHATSAPP_TEMPLATE_BUTTONS_MAX: whatsappTemplates_1.WHATSAPP_TEMPLATE_BUTTONS_MAX,
78
+ WHATSAPP_TEMPLATE_VARIABLES_MAX: whatsappTemplates_1.WHATSAPP_TEMPLATE_VARIABLES_MAX,
79
+ WHATSAPP_TEMPLATE_LABEL_MAX: whatsappTemplates_1.WHATSAPP_TEMPLATE_LABEL_MAX,
80
+ WHATSAPP_TEMPLATE_EXAMPLE_MAX: whatsappTemplates_1.WHATSAPP_TEMPLATE_EXAMPLE_MAX,
81
+ WHATSAPP_TEMPLATE_LANGUAGES: whatsappTemplates_1.WHATSAPP_TEMPLATE_LANGUAGES,
82
+ whatsappTemplateVariables: whatsappTemplates_1.whatsappTemplateVariables,
83
+ whatsappTemplateVariableCount: whatsappTemplates_1.whatsappTemplateVariableCount,
84
+ checkWhatsappTemplate: whatsappTemplates_1.checkWhatsappTemplate,
85
+ whatsappTemplateIssueText: whatsappTemplates_1.whatsappTemplateIssueText,
86
+ whatsappTemplateComponents: whatsappTemplates_1.whatsappTemplateComponents,
87
+ whatsappTemplateContent: whatsappTemplates_1.whatsappTemplateContent,
88
+ fillWhatsappTemplate: whatsappTemplates_1.fillWhatsappTemplate,
89
+ whatsappTemplateSendable: whatsappTemplates_1.whatsappTemplateSendable,
90
+ cleanWhatsappTemplateParam: whatsappTemplates_1.cleanWhatsappTemplateParam,
91
+ whatsappSendError: whatsappTemplates_1.whatsappSendError,
92
+ whatsappMessageChange: whatsappWebhook_1.whatsappMessageChange,
93
+ whatsappAccountChanges: whatsappWebhook_1.whatsappAccountChanges,
65
94
  getEnv: getEnv_1.getEnv,
66
95
  fetcher: fetcher_1.fetcher,
67
96
  constants: constants_1.constants,
@@ -119,6 +148,8 @@ exports.utils = {
119
148
  oauthProviders: oauthProviders_1.oauthProviders,
120
149
  resolveAttachment: attachment_1.resolveAttachment,
121
150
  isExposedResource: exposedResource_1.isExposedResource,
151
+ dataAttachmentOf: dataAttachment_1.dataAttachmentOf,
152
+ skipsIndexing: dataAttachment_1.skipsIndexing,
122
153
  isSyncableResource: syncableResource_1.isSyncableResource,
123
154
  isResourceSyncInProgress: syncableResource_1.isResourceSyncInProgress,
124
155
  resourceSyncProvider: syncableResource_1.resourceSyncProvider,
@@ -1 +1 @@
1
- {"version":3,"file":"localizeDataError.d.ts","sourceRoot":"","sources":["../src/localizeDataError.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,KAAK,MAAM,CAAC;AA2B9E,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA8dlE,CAAC;AA2DF,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,EACf,UAAU,MAAM,KACf,MAUF,CAAC"}
1
+ {"version":3,"file":"localizeDataError.d.ts","sourceRoot":"","sources":["../src/localizeDataError.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,KAAK,MAAM,CAAC;AA0C9E,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAijBlE,CAAC;AA2DF,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,EACf,UAAU,MAAM,KACf,MAUF,CAAC"}
@@ -25,6 +25,18 @@ const guardSuffix = (suffix) => {
25
25
  return ` Valores actuales: ${current[1]}.`;
26
26
  return suffix;
27
27
  };
28
+ // Meta's other template statuses, as the refusal writes them.
29
+ const TEMPLATE_STATUS_ES = {
30
+ paused: 'pausada',
31
+ disabled: 'desactivada',
32
+ flagged: 'marcada',
33
+ 'in appeal': 'en apelación',
34
+ 'pending deletion': 'pendiente de eliminación',
35
+ deleted: 'eliminada',
36
+ 'limit exceeded': 'por encima del límite'
37
+ };
38
+ // "The WhatsApp template x (es)", as a channel's refusal names it.
39
+ const templateLabel = (label) => label.replace(/^The WhatsApp template /, 'La plantilla de WhatsApp ');
28
40
  exports.DATA_ERROR_MESSAGES_ES = {
29
41
  'Unknown column "{0}" in {1}. Columns: {2}.': 'Columna desconocida "{0}" en {1}. Columnas: {2}.',
30
42
  'Unknown table "{0}". Tables: {1}.': 'Tabla desconocida "{0}". Tablas: {1}.',
@@ -79,7 +91,14 @@ exports.DATA_ERROR_MESSAGES_ES = {
79
91
  '{0}: only integer and decimal columns take "min".': '{0}: solo las columnas integer y decimal llevan "min".',
80
92
  '{0}: "min" is a number.': '{0}: "min" es un número.',
81
93
  "{0}: a {1} column can't be unique.": '{0}: una columna {1} no puede ser única.',
82
- '{0}: only text columns can be searchable (text, long_text, email, url, phone, enum).': '{0}: solo las columnas de texto pueden ser buscables (text, long_text, email, url, phone, enum).',
94
+ '{0}: only text and file columns can be searchable (text, long_text, email, url, phone, enum, file).': '{0}: solo las columnas de texto y de archivo pueden ser buscables (text, long_text, email, url, phone, enum, file).',
95
+ "{0} takes a knowledge item's uri, e.g. resource://menu-photo.": '{0} lleva el uri de un elemento del conocimiento, p. ej. resource://menu-photo.',
96
+ '{0}: a uri is at most {1} characters.': '{0}: un uri tiene como máximo {1} caracteres.',
97
+ '"uris" lists 1 to {0} knowledge item uris.': '"uris" lista de 1 a {0} uris de elementos del conocimiento.',
98
+ 'No resource in this project has the uri {0}; link an existing resource by its uri.': 'Ningún recurso de este proyecto tiene el uri {0}; enlaza un recurso que exista por su uri.',
99
+ 'File links are for the owner.': 'Los enlaces a archivos son para el dueño.',
100
+ '"changes" lists 1 to {0} { from, to } pairs.': '"changes" lista de 1 a {0} pares { from, to }.',
101
+ 'Each change is { from, to }; to is null to clear.': 'Cada cambio es { from, to }; to es null para quitar el enlace.',
83
102
  '{0}: a column named "rank" can\'t be searchable; rename it (e.g. "ranking").': '{0}: una columna llamada "rank" no puede ser buscable; cámbiale el nombre (p. ej. "ranking").',
84
103
  "{0}: a {1} column can't be filterable; mark it searchable instead.": '{0}: una columna {1} no puede ser filtrable; márcala como buscable.',
85
104
  "{0}: a {1} column can't have a default.": '{0}: una columna {1} no puede tener valor por defecto.',
@@ -274,6 +293,8 @@ exports.DATA_ERROR_MESSAGES_ES = {
274
293
  'That bookmark is not one to restore to: use the one a checkpoint, a dropped table or column, a type change, or a restore answered with.': 'Ese marcador no sirve para restaurar: usa el que te devolvió un punto de control, una tabla o columna eliminada, un cambio de tipo o una restauración.',
275
294
  'Type the table\'s name, "{0}", to drop it.': 'Escribe el nombre de la tabla, "{0}", para eliminarla.',
276
295
  'There is no such run.': 'No existe esa ejecución.',
296
+ 'There is no such index suggestion.': 'No existe esa sugerencia de índice.',
297
+ 'An unused index is only flagged; remove it from the column if you want to, or dismiss the suggestion.': 'Un índice sin uso solo se señala; quítalo de la columna si quieres, o descarta la sugerencia.',
277
298
  'Only a failed or skipped run can be tried again.': 'Solo se puede reintentar una ejecución fallida u omitida.',
278
299
  'This run kept no event to send again.': 'Esta ejecución no guardó ningún evento para enviar de nuevo.',
279
300
  'This export failed: {0}.': a => `Esta exportación falló: ${a[0] === 'unknown error' ? 'error desconocido' : a[0]}.`,
@@ -300,7 +321,48 @@ exports.DATA_ERROR_MESSAGES_ES = {
300
321
  '"{0}" looks like one of the database\'s own index names; pick another table name.': '"{0}" parece el nombre de uno de los índices de la base de datos; elige otro nombre de tabla.',
301
322
  '"{0}" is reserved by SQLite; pick another table name (e.g. "{1}_ref").': '"{0}" está reservado por SQLite; elige otro nombre de tabla (p. ej. "{1}_ref").',
302
323
  '"{0}" is reserved by SQLite; pick another column name (e.g. "{1}_ref").': '"{0}" está reservado por SQLite; elige otro nombre de columna (p. ej. "{1}_ref").',
303
- '"{0}" is a column every table already has.': '"{0}" es una columna que ya tienen todas las tablas.'
324
+ '"{0}" is a column every table already has.': '"{0}" es una columna que ya tienen todas las tablas.',
325
+ // A test send of a trigger's customer message.
326
+ "You haven't linked a chat with this project's bots: write to the bot from your own phone and send /link.": 'No has vinculado un chat con los bots de este proyecto: escríbele al bot desde tu propio teléfono y envía /link.',
327
+ "{0} isn't one of your linked chats with this project's bots.": '{0} no es uno de tus chats vinculados con los bots de este proyecto.',
328
+ 'Several of your chats are linked to this project\'s bots; pick one with "participantId".': 'Varios de tus chats están vinculados con los bots de este proyecto; elige uno con "participantId".',
329
+ '{0} has no rows yet; add one to build the test from.': '{0} aún no tiene filas; agrega una para armar la prueba.',
330
+ 'Reading a row as its trigger event is for the project owner.': 'Leer una fila como su evento de disparador es solo para el dueño del proyecto.',
331
+ // The channel's refusals, which a test send answers with.
332
+ "This channel's credentials can't be read; connect it again.": 'No se pueden leer las credenciales de este canal; conéctalo de nuevo.',
333
+ 'A message needs "text".': 'Un mensaje necesita "text".',
334
+ 'A message is at most {0} characters.': 'Un mensaje tiene como máximo {0} caracteres.',
335
+ '{0} refused the message: {1}': '{0} rechazó el mensaje: {1}',
336
+ '{0} refused the message.': '{0} rechazó el mensaje.',
337
+ "Ganju can't send messages on {0} channels.": 'Ganju no puede enviar mensajes en canales de {0}.',
338
+ 'WhatsApp: {0}': 'WhatsApp: {0}',
339
+ 'The {0} channel is paused.': 'El canal de {0} está en pausa.',
340
+ "{0} isn't on this channel's WhatsApp Business account. Create it in the channel's Message templates, or check its name and language.": a => `${templateLabel(a[0])} no está en la cuenta de WhatsApp Business de este canal. Créala en Plantillas de mensajes del canal, o revisa su nombre e idioma.`,
341
+ '{0} {1}; only approved templates can be sent.': a => {
342
+ const whole = `${a[0]} ${a[1]}`;
343
+ const m = /^(The WhatsApp template [\s\S]+? \([^)]*\)) (is still in Meta's review|was rejected by Meta|is ([\s\S]+?) by Meta)( \([\s\S]*\))?$/.exec(whole);
344
+ if (!m)
345
+ return `${whole}; solo se pueden enviar plantillas aprobadas.`;
346
+ const why = m[2].startsWith('is still')
347
+ ? 'sigue en revisión de Meta'
348
+ : m[2].startsWith('was rejected')
349
+ ? 'fue rechazada por Meta'
350
+ : `está ${TEMPLATE_STATUS_ES[m[3]] ?? `en el estado ${m[3]}`} por Meta`;
351
+ return `${templateLabel(m[1])} ${why}${m[4] ?? ''}; solo se pueden enviar plantillas aprobadas.`;
352
+ },
353
+ "{0} has a media header, a header variable or a button that takes a value; Ganju only fills the message's variables. Make a version without them.": a => `${templateLabel(a[0])} tiene un encabezado con archivo, una variable en el encabezado o un botón que recibe un valor; Ganju solo llena las variables del mensaje. Haz una versión sin ellos.`,
354
+ "There is no customer {0} on this project's channels.": 'No hay ningún cliente {0} en los canales de este proyecto.',
355
+ 'A message needs "text", a "template", or both.': 'Un mensaje necesita "text", una "template", o ambos.',
356
+ 'This customer has never written to the bot privately, so there is no chat to message them in.': 'Este cliente nunca le ha escrito al bot en privado, así que no hay un chat donde escribirle.',
357
+ "This customer already got the channel's {0} messages for the last 24 hours.": 'Este cliente ya recibió los {0} mensajes del canal de las últimas 24 horas.',
358
+ "Outside WhatsApp's 24-hour window (this customer last wrote more than 24 hours ago); use an approved template.": 'Fuera de la ventana de 24 horas de WhatsApp (este cliente escribió por última vez hace más de 24 horas); usa una plantilla aprobada.',
359
+ 'Templates are for WhatsApp; {0} takes "text".': 'Las plantillas son para WhatsApp; {0} recibe "text".',
360
+ 'The WhatsApp template {0} has {1} variable; {2} value was given.': 'La plantilla de WhatsApp {0} tiene {1} variable; se dio {2} valor.',
361
+ 'The WhatsApp template {0} has {1} variable; {2} values were given.': 'La plantilla de WhatsApp {0} tiene {1} variable; se dieron {2} valores.',
362
+ 'The WhatsApp template {0} has {1} variables; {2} value was given.': 'La plantilla de WhatsApp {0} tiene {1} variables; se dio {2} valor.',
363
+ 'The WhatsApp template {0} has {1} variables; {2} values were given.': 'La plantilla de WhatsApp {0} tiene {1} variables; se dieron {2} valores.',
364
+ 'A post needs "chatId".': 'Una publicación necesita "chatId".',
365
+ 'WhatsApp has no group chats for bots; message a customer with send().': 'WhatsApp no tiene chats de grupo para bots; escríbele a un cliente con send().'
304
366
  };
305
367
  const compile = (template, render) => {
306
368
  const parts = template.split(/\{\d+\}/);
package/dist/schema.d.ts CHANGED
@@ -321,6 +321,7 @@ declare const CUSTOM_CODE_TOOL: z.ZodObject<{
321
321
  }>>;
322
322
  tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
323
323
  }, z.core.$strict>>;
324
+ channels: z.ZodOptional<z.ZodBoolean>;
324
325
  }, z.core.$strip>;
325
326
  declare const CUSTOM_CODE_MANIFEST: z.ZodObject<{
326
327
  tools: z.ZodArray<z.ZodObject<{
@@ -369,6 +370,7 @@ declare const CUSTOM_CODE_MANIFEST: z.ZodObject<{
369
370
  }>>;
370
371
  tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
371
372
  }, z.core.$strict>>;
373
+ channels: z.ZodOptional<z.ZodBoolean>;
372
374
  }, z.core.$strip>>;
373
375
  }, z.core.$strip>;
374
376
  declare const CUSTOM_CODE_BROKER_RESOURCE_CREATE: z.ZodObject<{
@@ -793,6 +795,18 @@ export declare const Schema: {
793
795
  userId: z.ZodUUID;
794
796
  organizationId: z.ZodUUID;
795
797
  }, z.core.$strip>;
798
+ DATA_ATTACHMENT_METADATA: z.ZodObject<{
799
+ table: z.ZodString;
800
+ column: z.ZodString;
801
+ index: z.ZodBoolean;
802
+ }, z.core.$strip>;
803
+ ARTIFACT_PICK_RESOURCE: z.ZodObject<{
804
+ projectId: z.ZodUUID;
805
+ userId: z.ZodUUID;
806
+ organizationId: z.ZodUUID;
807
+ q: z.ZodOptional<z.ZodString>;
808
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
809
+ }, z.core.$strip>;
796
810
  ARTIFACT_CREATE_RESOURCE_VIEW: z.ZodObject<{
797
811
  type: z.ZodDefault<z.ZodEnum<{
798
812
  static: "static";
@@ -1203,8 +1217,8 @@ export declare const Schema: {
1203
1217
  displayColumn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1204
1218
  access: z.ZodOptional<z.ZodEnum<{
1205
1219
  none: "none";
1206
- read: "read";
1207
1220
  add: "add";
1221
+ read: "read";
1208
1222
  full: "full";
1209
1223
  }>>;
1210
1224
  customerScoped: z.ZodOptional<z.ZodBoolean>;
@@ -1252,8 +1266,8 @@ export declare const Schema: {
1252
1266
  displayColumn: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
1253
1267
  access: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
1254
1268
  none: "none";
1255
- read: "read";
1256
1269
  add: "add";
1270
+ read: "read";
1257
1271
  full: "full";
1258
1272
  }>>>;
1259
1273
  customerScoped: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
@@ -1529,6 +1543,20 @@ export declare const Schema: {
1529
1543
  }, z.core.$strict>>;
1530
1544
  }, z.core.$strict>>;
1531
1545
  }, z.core.$strict>;
1546
+ DATA_TRIGGER_TEST_SEND_BODY: z.ZodObject<{
1547
+ table: z.ZodString;
1548
+ customer: z.ZodObject<{
1549
+ text: z.ZodString;
1550
+ template: z.ZodOptional<z.ZodObject<{
1551
+ name: z.ZodString;
1552
+ language: z.ZodString;
1553
+ params: z.ZodOptional<z.ZodArray<z.ZodString>>;
1554
+ }, z.core.$strict>>;
1555
+ }, z.core.$strict>;
1556
+ rowId: z.ZodOptional<z.ZodNumber>;
1557
+ participantId: z.ZodOptional<z.ZodString>;
1558
+ asTemplate: z.ZodOptional<z.ZodBoolean>;
1559
+ }, z.core.$strict>;
1532
1560
  DATA_TRIGGER_RUN_LIST_QUERY: z.ZodObject<{
1533
1561
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1534
1562
  }, z.core.$strip>;
@@ -1545,6 +1573,12 @@ export declare const Schema: {
1545
1573
  name: z.ZodString;
1546
1574
  runId: z.ZodString;
1547
1575
  }, z.core.$strip>;
1576
+ DATA_INDEX_ADVICE_PARAMS: z.ZodObject<{
1577
+ projectId: z.ZodUUID;
1578
+ userId: z.ZodUUID;
1579
+ organizationId: z.ZodUUID;
1580
+ adviceId: z.ZodUUID;
1581
+ }, z.core.$strip>;
1548
1582
  DATA_COLUMN_PARAMS: z.ZodObject<{
1549
1583
  projectId: z.ZodUUID;
1550
1584
  userId: z.ZodUUID;
@@ -1847,6 +1881,49 @@ export declare const Schema: {
1847
1881
  userId: z.ZodUUID;
1848
1882
  organizationId: z.ZodUUID;
1849
1883
  }, z.core.$strip>;
1884
+ CHANNEL_WHATSAPP_PARAMS: z.ZodObject<{
1885
+ channelId: z.ZodUUID;
1886
+ projectId: z.ZodUUID;
1887
+ userId: z.ZodUUID;
1888
+ organizationId: z.ZodUUID;
1889
+ }, z.core.$strip>;
1890
+ CHANNEL_WHATSAPP_ACCOUNT: z.ZodObject<{
1891
+ accessToken: z.ZodOptional<z.ZodString>;
1892
+ businessAccountId: z.ZodOptional<z.ZodString>;
1893
+ }, z.core.$strict>;
1894
+ CHANNEL_WHATSAPP_TEMPLATE_CREATE: z.ZodObject<{
1895
+ category: z.ZodEnum<{
1896
+ UTILITY: "UTILITY";
1897
+ MARKETING: "MARKETING";
1898
+ }>;
1899
+ header: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1900
+ body: z.ZodString;
1901
+ footer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1902
+ buttons: z.ZodOptional<z.ZodArray<z.ZodString>>;
1903
+ examples: z.ZodOptional<z.ZodArray<z.ZodString>>;
1904
+ labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
1905
+ name: z.ZodString;
1906
+ language: z.ZodString;
1907
+ }, z.core.$strict>;
1908
+ CHANNEL_WHATSAPP_TEMPLATE_CONTENT: z.ZodObject<{
1909
+ category: z.ZodEnum<{
1910
+ UTILITY: "UTILITY";
1911
+ MARKETING: "MARKETING";
1912
+ }>;
1913
+ header: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1914
+ body: z.ZodString;
1915
+ footer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1916
+ buttons: z.ZodOptional<z.ZodArray<z.ZodString>>;
1917
+ examples: z.ZodOptional<z.ZodArray<z.ZodString>>;
1918
+ labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
1919
+ }, z.core.$strict>;
1920
+ CHANNEL_WHATSAPP_TEMPLATE_PARAMS: z.ZodObject<{
1921
+ channelId: z.ZodUUID;
1922
+ projectId: z.ZodUUID;
1923
+ userId: z.ZodUUID;
1924
+ organizationId: z.ZodUUID;
1925
+ templateId: z.ZodUUID;
1926
+ }, z.core.$strip>;
1850
1927
  ARTIFACT_UPDATE_RESOURCE_SHOW_SOURCE: z.ZodObject<{
1851
1928
  resourceId: z.ZodUUID;
1852
1929
  showSource: z.ZodEnum<{
@@ -2431,6 +2508,7 @@ export declare const Schema: {
2431
2508
  }>>;
2432
2509
  tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
2433
2510
  }, z.core.$strict>>;
2511
+ channels: z.ZodOptional<z.ZodBoolean>;
2434
2512
  }, z.core.$strip>;
2435
2513
  TOOL_ANNOTATIONS: z.ZodObject<{
2436
2514
  readOnlyHint: z.ZodOptional<z.ZodBoolean>;
@@ -2485,6 +2563,7 @@ export declare const Schema: {
2485
2563
  }>>;
2486
2564
  tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
2487
2565
  }, z.core.$strict>>;
2566
+ channels: z.ZodOptional<z.ZodBoolean>;
2488
2567
  }, z.core.$strip>>;
2489
2568
  }, z.core.$strip>;
2490
2569
  ARTIFACT_CUSTOM_CODE_CREATE_VERSION: z.ZodObject<{
@@ -2535,6 +2614,7 @@ export declare const Schema: {
2535
2614
  }>>;
2536
2615
  tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
2537
2616
  }, z.core.$strict>>;
2617
+ channels: z.ZodOptional<z.ZodBoolean>;
2538
2618
  }, z.core.$strip>>;
2539
2619
  }, z.core.$strip>;
2540
2620
  config: z.ZodOptional<z.ZodObject<{
@@ -2680,6 +2760,9 @@ export declare const Schema: {
2680
2760
  chatId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
2681
2761
  text: z.ZodString;
2682
2762
  }, z.core.$strip>;
2763
+ CUSTOM_CODE_BROKER_CHANNELS_TEMPLATES: z.ZodObject<{
2764
+ call: z.ZodString;
2765
+ }, z.core.$strip>;
2683
2766
  CUSTOM_CODE_BROKER_RESOURCE_SEARCH: z.ZodObject<{
2684
2767
  query: z.ZodString;
2685
2768
  limit: z.ZodDefault<z.ZodNumber>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":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OAAO,kCAAkC,CAC1C,CAAC;AAKF,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IAIrB,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;CAChD;AAKD,MAAM,WAAW,0BAA0B;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CAC1E;AAMD,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,0BAA0B,EAAE,CAAC;IACzC,OAAO,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACtC"}
package/dist/schema.js CHANGED
@@ -11,6 +11,7 @@ const slugifyTitle_1 = require("./slugifyTitle");
11
11
  const toolConfirmation_1 = require("./toolConfirmation");
12
12
  const channelCustomer_1 = require("./channelCustomer");
13
13
  const dataTypes_1 = require("./dataTypes");
14
+ const whatsappTemplates_1 = require("./whatsappTemplates");
14
15
  // A prompt title becomes a slash command; it must not collide with a command
15
16
  // the channel runner handles itself (e.g. `/link`).
16
17
  const PROMPT_TITLE = zod_1.z
@@ -319,6 +320,13 @@ const ARTIFACT_SYNC_ONE_DRIVE = zod_1.z.object({
319
320
  userId: zod_1.z.uuid(),
320
321
  organizationId: zod_1.z.uuid()
321
322
  });
323
+ // A knowledge item uploaded from a Data row: which file column it was for,
324
+ // and whether it is indexed for search too (the column's searchable switch).
325
+ const DATA_ATTACHMENT_METADATA = zod_1.z.object({
326
+ table: zod_1.z.string().min(1).max(64),
327
+ column: zod_1.z.string().min(1).max(64),
328
+ index: zod_1.z.boolean()
329
+ });
322
330
  const ARTIFACT_CREATE_RESOURCE = zod_1.z.object({
323
331
  title: zod_1.z.string().min(3).max(200),
324
332
  uri: zod_1.z.string(),
@@ -422,6 +430,14 @@ const ARTIFACT_GET_RESOURCE_BY_ID = zod_1.z.object({
422
430
  userId: zod_1.z.uuid(),
423
431
  organizationId: zod_1.z.uuid()
424
432
  });
433
+ // The knowledge items a Data file column can link, newest first.
434
+ const ARTIFACT_PICK_RESOURCE = zod_1.z.object({
435
+ projectId: zod_1.z.uuid(),
436
+ userId: zod_1.z.uuid(),
437
+ organizationId: zod_1.z.uuid(),
438
+ q: zod_1.z.string().trim().max(200).optional(),
439
+ limit: zod_1.z.coerce.number().int().min(1).max(50).default(20)
440
+ });
425
441
  const ARTIFACT_REMOVE_RESOURCE = zod_1.z.object({
426
442
  resourceId: zod_1.z.uuid(),
427
443
  projectId: zod_1.z.uuid(),
@@ -690,6 +706,17 @@ const DATA_TRIGGER_PATCH = zod_1.z.strictObject({ enabled: zod_1.z.boolean() });
690
706
  const DATA_TRIGGER_DEPLOY_BODY = zod_1.z.strictObject({
691
707
  triggers: zod_1.z.array(DATA_TRIGGER_INPUT).max(50)
692
708
  });
709
+ // A test of a "customer" action as the dialog has it, sent to the signed-in
710
+ // owner's own chat with the bot, built from one row (the newest by default).
711
+ const DATA_TRIGGER_TEST_SEND_BODY = zod_1.z.strictObject({
712
+ table: DATA_IDENTIFIER,
713
+ customer: DATA_TRIGGER_INPUT.shape.customer.unwrap(),
714
+ rowId: zod_1.z.number().int().min(1).optional(),
715
+ // Which of the owner's linked chats, when there is more than one.
716
+ participantId: zod_1.z.string().min(1).max(64).optional(),
717
+ // Send the template even inside WhatsApp's 24-hour window.
718
+ asTemplate: zod_1.z.boolean().optional()
719
+ });
693
720
  const DATA_TRIGGER_RUN_LIST_QUERY = zod_1.z.object({
694
721
  limit: zod_1.z.coerce.number().int().min(1).max(50).optional()
695
722
  });
@@ -703,6 +730,8 @@ const DATA_TRIGGER_PATH_PARAMS = DATA_DATABASE_GET.extend({ name: DATA_TRIGGER_N
703
730
  const DATA_TRIGGER_RUN_PARAMS = DATA_TRIGGER_PATH_PARAMS.extend({
704
731
  runId: zod_1.z.string().min(1).max(64)
705
732
  });
733
+ // An index suggestion, by its id.
734
+ const DATA_INDEX_ADVICE_PARAMS = DATA_DATABASE_GET.extend({ adviceId: zod_1.z.uuid() });
706
735
  const ARTIFACT_UPLOAD_RESOURCE_FILE = zod_1.z.object({
707
736
  resourceId: zod_1.z.uuid(),
708
737
  projectId: zod_1.z.uuid(),
@@ -1264,7 +1293,10 @@ const CUSTOM_CODE_TOOL = zod_1.z.object({
1264
1293
  access: zod_1.z.enum(['read', 'write']).optional(),
1265
1294
  tables: zod_1.z.array(zod_1.z.string().min(1).max(63)).max(50).optional()
1266
1295
  })
1267
- .optional()
1296
+ .optional(),
1297
+ // true: the function may message customers and chats through ctx.channels.
1298
+ // Left out, the broker refuses it.
1299
+ channels: zod_1.z.boolean().optional()
1268
1300
  });
1269
1301
  // The manifest a `ganju deploy` (or the dashboard) uploads alongside a bundle.
1270
1302
  // Names must be unique within one script: apps/mcp registers them into a single
@@ -1507,6 +1539,11 @@ const CUSTOM_CODE_BROKER_CHANNELS_SEND = zod_1.z.object({
1507
1539
  text: zod_1.z.string().min(1).max(4000).optional(),
1508
1540
  template: DATA_TRIGGER_TEMPLATE.optional()
1509
1541
  });
1542
+ // ctx.channels.templates: the approved WhatsApp templates of the project's
1543
+ // channels.
1544
+ const CUSTOM_CODE_BROKER_CHANNELS_TEMPLATES = zod_1.z.object({
1545
+ call: zod_1.z.string().min(1).max(4000)
1546
+ });
1510
1547
  const CUSTOM_CODE_BROKER_CHANNELS_POST = zod_1.z.object({
1511
1548
  call: zod_1.z.string().min(1).max(4000),
1512
1549
  channelId: zod_1.z.string().min(1).max(100),
@@ -1730,6 +1767,52 @@ const CHANNEL_LIST_MESSAGES = zod_1.z.object({
1730
1767
  userId: zod_1.z.uuid(),
1731
1768
  organizationId: zod_1.z.uuid()
1732
1769
  });
1770
+ const CHANNEL_WHATSAPP_PARAMS = zod_1.z.object({
1771
+ channelId: zod_1.z.uuid(),
1772
+ projectId: zod_1.z.uuid(),
1773
+ userId: zod_1.z.uuid(),
1774
+ organizationId: zod_1.z.uuid()
1775
+ });
1776
+ // A new access token, the business account's id, or both, for a WhatsApp
1777
+ // channel's message templates. The rest of its credentials stay as they are.
1778
+ const CHANNEL_WHATSAPP_ACCOUNT = zod_1.z
1779
+ .strictObject({
1780
+ accessToken: zod_1.z.string().trim().min(20).max(2000).optional(),
1781
+ businessAccountId: zod_1.z
1782
+ .string()
1783
+ .trim()
1784
+ .regex(/^\d{5,30}$/, 'The business account id is a number')
1785
+ .optional()
1786
+ })
1787
+ .refine(v => v.accessToken !== undefined || v.businessAccountId !== undefined, 'Give a new access token, the business account id, or both');
1788
+ // A WhatsApp message template as the dashboard writes it. Meta's own rules
1789
+ // are checked with checkWhatsappTemplate before it is sent for review.
1790
+ const CHANNEL_WHATSAPP_TEMPLATE_CONTENT = zod_1.z.strictObject({
1791
+ category: zod_1.z.enum(whatsappTemplates_1.WHATSAPP_TEMPLATE_CATEGORIES),
1792
+ header: zod_1.z.string().max(whatsappTemplates_1.WHATSAPP_TEMPLATE_HEADER_MAX).nullish(),
1793
+ body: zod_1.z.string().trim().min(1).max(whatsappTemplates_1.WHATSAPP_TEMPLATE_BODY_MAX),
1794
+ footer: zod_1.z.string().max(whatsappTemplates_1.WHATSAPP_TEMPLATE_FOOTER_MAX).nullish(),
1795
+ buttons: zod_1.z
1796
+ .array(zod_1.z.string().max(whatsappTemplates_1.WHATSAPP_TEMPLATE_BUTTON_MAX))
1797
+ .max(whatsappTemplates_1.WHATSAPP_TEMPLATE_BUTTONS_MAX)
1798
+ .optional(),
1799
+ // {{n}}'s example value and label are at n - 1.
1800
+ examples: zod_1.z
1801
+ .array(zod_1.z.string().max(whatsappTemplates_1.WHATSAPP_TEMPLATE_EXAMPLE_MAX))
1802
+ .max(whatsappTemplates_1.WHATSAPP_TEMPLATE_VARIABLES_MAX)
1803
+ .optional(),
1804
+ labels: zod_1.z
1805
+ .array(zod_1.z.string().max(whatsappTemplates_1.WHATSAPP_TEMPLATE_LABEL_MAX))
1806
+ .max(whatsappTemplates_1.WHATSAPP_TEMPLATE_VARIABLES_MAX)
1807
+ .optional()
1808
+ });
1809
+ const CHANNEL_WHATSAPP_TEMPLATE_CREATE = CHANNEL_WHATSAPP_TEMPLATE_CONTENT.extend({
1810
+ name: zod_1.z.string().trim().min(1).max(whatsappTemplates_1.WHATSAPP_TEMPLATE_NAME_MAX),
1811
+ language: zod_1.z.string().trim().min(2).max(10)
1812
+ });
1813
+ const CHANNEL_WHATSAPP_TEMPLATE_PARAMS = CHANNEL_WHATSAPP_PARAMS.extend({
1814
+ templateId: zod_1.z.uuid()
1815
+ });
1733
1816
  const CHANNEL_CREATE_VIEW = CHANNEL_CREATE.omit({
1734
1817
  projectId: true,
1735
1818
  userId: true,
@@ -1802,6 +1885,8 @@ exports.Schema = {
1802
1885
  ARTIFACT_GET_PROMPT,
1803
1886
  ARTIFACT_REMOVE_PROMPT,
1804
1887
  ARTIFACT_CREATE_RESOURCE,
1888
+ DATA_ATTACHMENT_METADATA,
1889
+ ARTIFACT_PICK_RESOURCE,
1805
1890
  ARTIFACT_CREATE_RESOURCE_VIEW,
1806
1891
  ARTIFACT_CREATE_WEBSITE,
1807
1892
  ARTIFACT_CREATE_WEBSITE_VIEW,
@@ -1848,9 +1933,11 @@ exports.Schema = {
1848
1933
  DATA_TRIGGER_INPUT,
1849
1934
  DATA_TRIGGER_PATCH,
1850
1935
  DATA_TRIGGER_DEPLOY_BODY,
1936
+ DATA_TRIGGER_TEST_SEND_BODY,
1851
1937
  DATA_TRIGGER_RUN_LIST_QUERY,
1852
1938
  DATA_TRIGGER_PATH_PARAMS,
1853
1939
  DATA_TRIGGER_RUN_PARAMS,
1940
+ DATA_INDEX_ADVICE_PARAMS,
1854
1941
  DATA_COLUMN_PARAMS,
1855
1942
  DATA_ROW_PARAMS,
1856
1943
  ARTIFACT_REMOVE_RESOURCE,
@@ -1887,6 +1974,11 @@ exports.Schema = {
1887
1974
  CHANNEL_REMOVE,
1888
1975
  CHANNEL_LIST_CONVERSATIONS,
1889
1976
  CHANNEL_LIST_MESSAGES,
1977
+ CHANNEL_WHATSAPP_PARAMS,
1978
+ CHANNEL_WHATSAPP_ACCOUNT,
1979
+ CHANNEL_WHATSAPP_TEMPLATE_CREATE,
1980
+ CHANNEL_WHATSAPP_TEMPLATE_CONTENT,
1981
+ CHANNEL_WHATSAPP_TEMPLATE_PARAMS,
1890
1982
  ARTIFACT_UPDATE_RESOURCE_SHOW_SOURCE,
1891
1983
  ARTIFACT_UPDATE_RESOURCE_SYNC_INTERVAL,
1892
1984
  ARTIFACT_SYNC_RESOURCE,
@@ -1917,6 +2009,7 @@ exports.Schema = {
1917
2009
  CUSTOM_CODE_BROKER_DATA,
1918
2010
  CUSTOM_CODE_BROKER_CHANNELS_SEND,
1919
2011
  CUSTOM_CODE_BROKER_CHANNELS_POST,
2012
+ CUSTOM_CODE_BROKER_CHANNELS_TEMPLATES,
1920
2013
  CUSTOM_CODE_BROKER_RESOURCE_SEARCH,
1921
2014
  CUSTOM_CODE_BROKER_RESOURCE_READ,
1922
2015
  CUSTOM_CODE_BROKER_RESOURCE_CREATE,
@@ -12,6 +12,7 @@ export declare const CUSTOM_CODE_BROKER_PATH_SEND_FILE = "/send-file";
12
12
  export declare const CUSTOM_CODE_BROKER_PATH_DATA = "/data";
13
13
  export declare const CUSTOM_CODE_BROKER_PATH_CHANNELS_SEND = "/channels/send";
14
14
  export declare const CUSTOM_CODE_BROKER_PATH_CHANNELS_POST = "/channels/post";
15
+ export declare const CUSTOM_CODE_BROKER_PATH_CHANNELS_TEMPLATES = "/channels/templates";
15
16
  export declare const CUSTOM_CODE_BINDING_VERSION = "GANJU_SCRIPT_VERSION";
16
17
  export declare const CUSTOM_CODE_HEALTH_TOOL = "__ganju_health";
17
18
  export declare const CUSTOM_CODE_MAX_LOGS = 50;
@@ -1 +1 @@
1
- {"version":3,"file":"sdkConstants.d.ts","sourceRoot":"","sources":["../src/sdkConstants.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAC5D,eAAO,MAAM,0BAA0B,iBAAiB,CAAC;AAKzD,eAAO,MAAM,yBAAyB,kCAAkC,CAAC;AACzE,eAAO,MAAM,kCAAkC,gBAAgB,CAAC;AAChE,eAAO,MAAM,8BAA8B,YAAY,CAAC;AACxD,eAAO,MAAM,wCAAwC,sBAAsB,CAAC;AAC5E,eAAO,MAAM,sCAAsC,oBAAoB,CAAC;AACxE,eAAO,MAAM,sCAAsC,oBAAoB,CAAC;AACxE,eAAO,MAAM,wCAAwC,sBAAsB,CAAC;AAC5E,eAAO,MAAM,wCAAwC,sBAAsB,CAAC;AAC5E,eAAO,MAAM,iCAAiC,eAAe,CAAC;AAC9D,eAAO,MAAM,4BAA4B,UAAU,CAAC;AACpD,eAAO,MAAM,qCAAqC,mBAAmB,CAAC;AACtE,eAAO,MAAM,qCAAqC,mBAAmB,CAAC;AAYtE,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAOlE,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAKxD,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,0BAA0B,OAAQ,CAAC"}
1
+ {"version":3,"file":"sdkConstants.d.ts","sourceRoot":"","sources":["../src/sdkConstants.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAC5D,eAAO,MAAM,0BAA0B,iBAAiB,CAAC;AAKzD,eAAO,MAAM,yBAAyB,kCAAkC,CAAC;AACzE,eAAO,MAAM,kCAAkC,gBAAgB,CAAC;AAChE,eAAO,MAAM,8BAA8B,YAAY,CAAC;AACxD,eAAO,MAAM,wCAAwC,sBAAsB,CAAC;AAC5E,eAAO,MAAM,sCAAsC,oBAAoB,CAAC;AACxE,eAAO,MAAM,sCAAsC,oBAAoB,CAAC;AACxE,eAAO,MAAM,wCAAwC,sBAAsB,CAAC;AAC5E,eAAO,MAAM,wCAAwC,sBAAsB,CAAC;AAC5E,eAAO,MAAM,iCAAiC,eAAe,CAAC;AAC9D,eAAO,MAAM,4BAA4B,UAAU,CAAC;AACpD,eAAO,MAAM,qCAAqC,mBAAmB,CAAC;AACtE,eAAO,MAAM,qCAAqC,mBAAmB,CAAC;AACtE,eAAO,MAAM,0CAA0C,wBAAwB,CAAC;AAYhF,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAOlE,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAKxD,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,0BAA0B,OAAQ,CAAC"}
@@ -11,7 +11,7 @@
11
11
  // The rule for this file: nothing lands here unless the SDK reads it at runtime,
12
12
  // and it imports nothing.
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.CUSTOM_CODE_MAX_LOG_LENGTH = exports.CUSTOM_CODE_MAX_LOGS = exports.CUSTOM_CODE_HEALTH_TOOL = exports.CUSTOM_CODE_BINDING_VERSION = exports.CUSTOM_CODE_BROKER_PATH_CHANNELS_POST = exports.CUSTOM_CODE_BROKER_PATH_CHANNELS_SEND = exports.CUSTOM_CODE_BROKER_PATH_DATA = exports.CUSTOM_CODE_BROKER_PATH_SEND_FILE = exports.CUSTOM_CODE_BROKER_PATH_RESOURCES_DELETE = exports.CUSTOM_CODE_BROKER_PATH_RESOURCES_CREATE = exports.CUSTOM_CODE_BROKER_PATH_RESOURCES_LIST = exports.CUSTOM_CODE_BROKER_PATH_RESOURCES_READ = exports.CUSTOM_CODE_BROKER_PATH_RESOURCES_SEARCH = exports.CUSTOM_CODE_BROKER_PATH_SECRET = exports.CUSTOM_CODE_BROKER_PATH_CONNECTION = exports.CUSTOM_CODE_BROKER_ORIGIN = exports.CUSTOM_CODE_BINDING_BROKER = exports.CUSTOM_CODE_BINDING_TOKEN = void 0;
14
+ exports.CUSTOM_CODE_MAX_LOG_LENGTH = exports.CUSTOM_CODE_MAX_LOGS = exports.CUSTOM_CODE_HEALTH_TOOL = exports.CUSTOM_CODE_BINDING_VERSION = exports.CUSTOM_CODE_BROKER_PATH_CHANNELS_TEMPLATES = exports.CUSTOM_CODE_BROKER_PATH_CHANNELS_POST = exports.CUSTOM_CODE_BROKER_PATH_CHANNELS_SEND = exports.CUSTOM_CODE_BROKER_PATH_DATA = exports.CUSTOM_CODE_BROKER_PATH_SEND_FILE = exports.CUSTOM_CODE_BROKER_PATH_RESOURCES_DELETE = exports.CUSTOM_CODE_BROKER_PATH_RESOURCES_CREATE = exports.CUSTOM_CODE_BROKER_PATH_RESOURCES_LIST = exports.CUSTOM_CODE_BROKER_PATH_RESOURCES_READ = exports.CUSTOM_CODE_BROKER_PATH_RESOURCES_SEARCH = exports.CUSTOM_CODE_BROKER_PATH_SECRET = exports.CUSTOM_CODE_BROKER_PATH_CONNECTION = exports.CUSTOM_CODE_BROKER_ORIGIN = exports.CUSTOM_CODE_BINDING_BROKER = exports.CUSTOM_CODE_BINDING_TOKEN = void 0;
15
15
  // Bindings injected into every user script at upload time. The token is a
16
16
  // secret_text binding rotated on each publish; the broker is a service binding.
17
17
  // Names are part of the SDK's contract with the script, so they can't be
@@ -33,6 +33,7 @@ exports.CUSTOM_CODE_BROKER_PATH_SEND_FILE = '/send-file';
33
33
  exports.CUSTOM_CODE_BROKER_PATH_DATA = '/data';
34
34
  exports.CUSTOM_CODE_BROKER_PATH_CHANNELS_SEND = '/channels/send';
35
35
  exports.CUSTOM_CODE_BROKER_PATH_CHANNELS_POST = '/channels/post';
36
+ exports.CUSTOM_CODE_BROKER_PATH_CHANNELS_TEMPLATES = '/channels/templates';
36
37
  // Injected at upload time and echoed back by the health probe below. Uploading a
37
38
  // script into the dispatch namespace is not read-your-writes: dispatching to the
38
39
  // name immediately afterwards can still reach the previous edition. Tool names
@@ -0,0 +1,77 @@
1
+ export declare const WHATSAPP_TEMPLATE_CATEGORIES: readonly ["UTILITY", "MARKETING"];
2
+ export type WhatsappTemplateCategory = (typeof WHATSAPP_TEMPLATE_CATEGORIES)[number];
3
+ export declare const WHATSAPP_TEMPLATE_STATUS_APPROVED = "APPROVED";
4
+ export declare const WHATSAPP_TEMPLATE_STATUSES_WAITING: string[];
5
+ export declare const WHATSAPP_TEMPLATE_STATUSES_STOPPED: string[];
6
+ export declare const WHATSAPP_TEMPLATE_NAME_MAX = 512;
7
+ export declare const WHATSAPP_TEMPLATE_BODY_MAX = 1024;
8
+ export declare const WHATSAPP_TEMPLATE_HEADER_MAX = 60;
9
+ export declare const WHATSAPP_TEMPLATE_FOOTER_MAX = 60;
10
+ export declare const WHATSAPP_TEMPLATE_BUTTON_MAX = 25;
11
+ export declare const WHATSAPP_TEMPLATE_BUTTONS_MAX = 10;
12
+ export declare const WHATSAPP_TEMPLATE_VARIABLES_MAX = 20;
13
+ export declare const WHATSAPP_TEMPLATE_LABEL_MAX = 40;
14
+ export declare const WHATSAPP_TEMPLATE_EXAMPLE_MAX = 200;
15
+ export declare const WHATSAPP_TEMPLATE_LANGUAGES: {
16
+ code: string;
17
+ name: string;
18
+ }[];
19
+ /** A template as the owner writes it. `examples[i]` and `labels[i]` are {{i+1}}'s. */
20
+ export interface WhatsappTemplateDraft {
21
+ name: string;
22
+ language: string;
23
+ category: WhatsappTemplateCategory;
24
+ header?: string | null;
25
+ body: string;
26
+ footer?: string | null;
27
+ buttons?: string[];
28
+ examples?: string[];
29
+ labels?: string[];
30
+ }
31
+ /** A template's text, read back from Meta's components. */
32
+ export interface WhatsappTemplateContent {
33
+ header: string | null;
34
+ body: string;
35
+ footer: string | null;
36
+ buttons: string[];
37
+ examples: string[];
38
+ }
39
+ export type WhatsappTemplateIssueCode = 'name_format' | 'name_long' | 'language' | 'category' | 'body_empty' | 'body_long' | 'header_long' | 'header_variables' | 'header_lines' | 'footer_long' | 'footer_variables' | 'button_empty' | 'button_long' | 'button_variables' | 'buttons_many' | 'buttons_repeated' | 'variables_many' | 'variables_order' | 'variable_at_start' | 'variable_at_end' | 'variables_adjacent' | 'variables_dense' | 'example_missing';
40
+ export interface WhatsappTemplateIssue {
41
+ code: WhatsappTemplateIssueCode;
42
+ n?: number;
43
+ }
44
+ /** Each {{n}} in the text, in the order they appear. */
45
+ export declare const whatsappTemplateVariables: (text: string) => number[];
46
+ /** How many variables the body has: its highest {{n}}. */
47
+ export declare const whatsappTemplateVariableCount: (body: string) => number;
48
+ /**
49
+ * The rules Meta rejects templates for most often, checked before sending
50
+ * one for review. Meta's review has the last word; this only catches the
51
+ * common mistakes early.
52
+ */
53
+ export declare const checkWhatsappTemplate: (draft: WhatsappTemplateDraft) => WhatsappTemplateIssue[];
54
+ export declare const whatsappTemplateIssueText: (issue: WhatsappTemplateIssue) => string;
55
+ /** The components Meta's create and edit calls take. */
56
+ export declare const whatsappTemplateComponents: (draft: WhatsappTemplateDraft) => Record<string, unknown>[];
57
+ /** A template's text, from the components Meta returns. */
58
+ export declare const whatsappTemplateContent: (components: unknown) => WhatsappTemplateContent;
59
+ /**
60
+ * Whether Ganju can send it: it fills the body's variables only. A media
61
+ * header, a header variable, or a button that takes a value (a URL with a
62
+ * variable, a code, a flow) needs more, and Meta refuses the send.
63
+ */
64
+ export declare const whatsappTemplateSendable: (components: unknown) => boolean;
65
+ /** The body with each {{n}} replaced, for previews and the message record. */
66
+ export declare const fillWhatsappTemplate: (body: string, values: string[]) => string;
67
+ /**
68
+ * A value for a {{n}} as Meta accepts it: no line breaks or tabs, no long
69
+ * runs of spaces, and never empty.
70
+ */
71
+ export declare const cleanWhatsappTemplateParam: (value: unknown) => string;
72
+ /** A Meta send error as an owner reads it, and whether a retry may help. */
73
+ export declare const whatsappSendError: (code: number | undefined, detail: string | undefined) => {
74
+ text: string;
75
+ retry: boolean;
76
+ };
77
+ //# sourceMappingURL=whatsappTemplates.d.ts.map