@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
@@ -66,6 +66,7 @@ interface PlanLimits {
66
66
  maxDataBytes: number | null;
67
67
  maxDataTablesPerDatabase: number | null;
68
68
  triggerRunHardCap: number | null;
69
+ dailyTriggerEmailCap: number | null;
69
70
  }
70
71
  export type { PlanLimits };
71
72
  export declare const constants: {
@@ -104,6 +105,22 @@ export declare const constants: {
104
105
  DATA_DELETE_GRACE_DAYS: number;
105
106
  DATA_PURGE_BATCH: number;
106
107
  DATA_ACTIVITY_THROTTLE_MS: number;
108
+ DATA_INDEX_ADVICE_WINDOW_DAYS: number;
109
+ DATA_INDEX_ADVICE_MIN_QUERIES: number;
110
+ DATA_INDEX_ADVICE_MIN_ROWS_READ: number;
111
+ DATA_INDEX_ADVICE_MIN_READ_RATIO: number;
112
+ DATA_INDEX_UNUSED_WINDOW_DAYS: number;
113
+ DATA_INDEX_UNUSED_MIN_ROWS_WRITTEN: number;
114
+ DATA_QUERY_STAT_KEEP_DAYS: number;
115
+ DATA_INDEX_ADVICE_ADD: "add";
116
+ DATA_INDEX_ADVICE_UNUSED: "unused";
117
+ DATA_INDEX_ADVICE_OPEN: "open";
118
+ DATA_INDEX_ADVICE_DISMISSED: "dismissed";
119
+ DATA_DAILY_JOB_HOUR_UTC: number;
120
+ DATA_ABANDON_WARN_DAYS: number;
121
+ DATA_ABANDON_REMIND_DAYS: number;
122
+ DATA_ABANDON_DELETE_DAYS: number;
123
+ DATA_ABANDON_EXPORT_KEEP_DAYS: number;
107
124
  ARTIFACT_DATABASE_STATUS_CREATING: "CREATING";
108
125
  ARTIFACT_DATABASE_STATUS_READY: "READY";
109
126
  ARTIFACT_DATABASE_STATUS_FAILED: "FAILED";
@@ -657,6 +674,7 @@ export declare const constants: {
657
674
  CUSTOM_CODE_BROKER_PATH_DATA: string;
658
675
  CUSTOM_CODE_BROKER_PATH_CHANNELS_SEND: string;
659
676
  CUSTOM_CODE_BROKER_PATH_CHANNELS_POST: string;
677
+ CUSTOM_CODE_BROKER_PATH_CHANNELS_TEMPLATES: string;
660
678
  CUSTOM_CODE_OUTBOUND_PARAM_ARTIFACT_ID: "artifactId";
661
679
  CUSTOM_CODE_OUTBOUND_PARAM_ALLOWED_HOSTS: "allowedHosts";
662
680
  CUSTOM_CODE_PLATFORM_HOSTS: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAqKA,QAAA,MAAM,yBAAyB,EAAiB,UAAU,CAAC;AAC3D,QAAA,MAAM,+BAA+B,EAAuB,gBAAgB,CAAC;AAC7E,QAAA,MAAM,8BAA8B,EAAsB,eAAe,C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 20;
1899
1899
  // last_read_at / last_write_at move at most this often, so they aren't a
1900
1900
  // Postgres write per query.
1901
1901
  const DATA_ACTIVITY_THROTTLE_MS = 60 * 60 * 1000;
1902
+ // Index advice. A column is worth an index when, over a week, at least 50
1903
+ // queries filtered or sorted on it and they read on average 1,000 rows and
1904
+ // 20 rows for every row returned. An index no query used in 30 days on a
1905
+ // table written at least 1,000 rows (and more rows written than queries) is
1906
+ // flagged as unused. Never dropped automatically.
1907
+ const DATA_INDEX_ADVICE_WINDOW_DAYS = 7;
1908
+ const DATA_INDEX_ADVICE_MIN_QUERIES = 50;
1909
+ const DATA_INDEX_ADVICE_MIN_ROWS_READ = 1_000;
1910
+ const DATA_INDEX_ADVICE_MIN_READ_RATIO = 20;
1911
+ const DATA_INDEX_UNUSED_WINDOW_DAYS = 30;
1912
+ const DATA_INDEX_UNUSED_MIN_ROWS_WRITTEN = 1_000;
1913
+ // Daily stats are kept past the longest window, then removed.
1914
+ const DATA_QUERY_STAT_KEEP_DAYS = 35;
1915
+ const DATA_INDEX_ADVICE_ADD = 'add';
1916
+ const DATA_INDEX_ADVICE_UNUSED = 'unused';
1917
+ const DATA_INDEX_ADVICE_OPEN = 'open';
1918
+ const DATA_INDEX_ADVICE_DISMISSED = 'dismissed';
1919
+ // The daily jobs (index advice and the abandoned-database flow) run on the
1920
+ // hourly cron at this UTC hour.
1921
+ const DATA_DAILY_JOB_HOUR_UTC = 13;
1922
+ // Days on Free before a database is warned about, reminded about, and listed
1923
+ // for Ganju to delete by hand.
1924
+ const DATA_ABANDON_WARN_DAYS = 30;
1925
+ const DATA_ABANDON_REMIND_DAYS = 41;
1926
+ const DATA_ABANDON_DELETE_DAYS = 44;
1927
+ // How long the export taken before a database is deleted is kept.
1928
+ const DATA_ABANDON_EXPORT_KEEP_DAYS = 90;
1902
1929
  const PLAN_LIMITS = {
1903
1930
  FREE: {
1904
1931
  maxProjects: 1,
@@ -1938,7 +1965,8 @@ const PLAN_LIMITS = {
1938
1965
  canUseData: false,
1939
1966
  maxDataBytes: null,
1940
1967
  maxDataTablesPerDatabase: null,
1941
- triggerRunHardCap: 0
1968
+ triggerRunHardCap: 0,
1969
+ dailyTriggerEmailCap: 0
1942
1970
  },
1943
1971
  PRO: {
1944
1972
  maxProjects: null,
@@ -1969,7 +1997,8 @@ const PLAN_LIMITS = {
1969
1997
  canUseData: true,
1970
1998
  maxDataBytes: DATA_MAX_DATABASE_BYTES,
1971
1999
  maxDataTablesPerDatabase: DATA_MAX_TABLES_PER_DATABASE,
1972
- triggerRunHardCap: DATA_TRIGGER_RUN_HARD_CAP
2000
+ triggerRunHardCap: DATA_TRIGGER_RUN_HARD_CAP,
2001
+ dailyTriggerEmailCap: 500
1973
2002
  },
1974
2003
  ENTERPRISE: {
1975
2004
  maxProjects: null,
@@ -2000,7 +2029,8 @@ const PLAN_LIMITS = {
2000
2029
  canUseData: true,
2001
2030
  maxDataBytes: DATA_MAX_DATABASE_BYTES,
2002
2031
  maxDataTablesPerDatabase: DATA_MAX_TABLES_PER_DATABASE,
2003
- triggerRunHardCap: null
2032
+ triggerRunHardCap: null,
2033
+ dailyTriggerEmailCap: 5000
2004
2034
  }
2005
2035
  };
2006
2036
  // Quota features — used as the `feature` discriminator on PlanLimitError so the
@@ -2187,6 +2217,22 @@ exports.constants = {
2187
2217
  DATA_DELETE_GRACE_DAYS,
2188
2218
  DATA_PURGE_BATCH,
2189
2219
  DATA_ACTIVITY_THROTTLE_MS,
2220
+ DATA_INDEX_ADVICE_WINDOW_DAYS,
2221
+ DATA_INDEX_ADVICE_MIN_QUERIES,
2222
+ DATA_INDEX_ADVICE_MIN_ROWS_READ,
2223
+ DATA_INDEX_ADVICE_MIN_READ_RATIO,
2224
+ DATA_INDEX_UNUSED_WINDOW_DAYS,
2225
+ DATA_INDEX_UNUSED_MIN_ROWS_WRITTEN,
2226
+ DATA_QUERY_STAT_KEEP_DAYS,
2227
+ DATA_INDEX_ADVICE_ADD,
2228
+ DATA_INDEX_ADVICE_UNUSED,
2229
+ DATA_INDEX_ADVICE_OPEN,
2230
+ DATA_INDEX_ADVICE_DISMISSED,
2231
+ DATA_DAILY_JOB_HOUR_UTC,
2232
+ DATA_ABANDON_WARN_DAYS,
2233
+ DATA_ABANDON_REMIND_DAYS,
2234
+ DATA_ABANDON_DELETE_DAYS,
2235
+ DATA_ABANDON_EXPORT_KEEP_DAYS,
2190
2236
  ARTIFACT_DATABASE_STATUS_CREATING,
2191
2237
  ARTIFACT_DATABASE_STATUS_READY,
2192
2238
  ARTIFACT_DATABASE_STATUS_FAILED,
@@ -2719,6 +2765,7 @@ exports.constants = {
2719
2765
  CUSTOM_CODE_BROKER_PATH_DATA: sdkConstants_1.CUSTOM_CODE_BROKER_PATH_DATA,
2720
2766
  CUSTOM_CODE_BROKER_PATH_CHANNELS_SEND: sdkConstants_1.CUSTOM_CODE_BROKER_PATH_CHANNELS_SEND,
2721
2767
  CUSTOM_CODE_BROKER_PATH_CHANNELS_POST: sdkConstants_1.CUSTOM_CODE_BROKER_PATH_CHANNELS_POST,
2768
+ CUSTOM_CODE_BROKER_PATH_CHANNELS_TEMPLATES: sdkConstants_1.CUSTOM_CODE_BROKER_PATH_CHANNELS_TEMPLATES,
2722
2769
  CUSTOM_CODE_OUTBOUND_PARAM_ARTIFACT_ID,
2723
2770
  CUSTOM_CODE_OUTBOUND_PARAM_ALLOWED_HOSTS,
2724
2771
  CUSTOM_CODE_PLATFORM_HOSTS,
package/dist/crypto.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Context } from 'hono';
2
- export declare const getCredentialEncryptionKey: (c: Context) => string;
1
+ import type { EnvSource } from './getEnv';
2
+ export declare const getCredentialEncryptionKey: (c: EnvSource) => string;
3
3
  export declare const encryptString: (plaintext: string, rawKey: string) => string;
4
4
  export declare const decryptString: (value: string, rawKey: string) => string;
5
5
  export declare const sha256Hex: (input: string) => Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts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BYTES = 24;
9
9
  const KEY_BYTES = 32;
10
10
  const KEY_ENV = 'CRYPTO_SECRET';
11
+ // A request's context, or anything with the worker's env (a cron, a queue).
11
12
  const getCredentialEncryptionKey = (c) => {
12
13
  const rawKey = (0, getEnv_1.getEnv)(c, KEY_ENV);
13
14
  if (!rawKey) {
package/dist/data.d.ts CHANGED
@@ -1,15 +1,17 @@
1
1
  export * from './dataTypes';
2
2
  export { DATA_IDENTIFIER_PATTERN, DATA_SYSTEM_COLUMNS, DATA_HIDDEN_COLUMNS, identifierIssue, isValidIdentifier } from './dataIdentifiers';
3
3
  export { createTableSql, columnDefinitionSql, desiredIndexes, desiredTriggers, ftsCreateSql, ftsTableName, searchableColumns, sqlLiteral } from './dataDdl';
4
- export { chunkRows, rowsPerInsert, ftsMatch, keysetCondition, encodeCursor, decodeCursor, isSensitiveWrite, tidyArgs, zoned } from './dataCompiler';
4
+ export { chunkRows, rowsPerInsert, ftsMatch, keysetCondition, encodeCursor, decodeCursor, isSensitiveWrite, fileUriOf, unknownFileUris, tidyArgs, zoned } from './dataCompiler';
5
5
  export type { SqlValue, KeysetCursor, SortKey } from './dataCompiler';
6
- export { INTERNAL_MIGRATIONS, INTERNAL_SCHEMA_VERSION, hasInternalTables, getMeta, setMeta, migrateInternal, loadSchema, toTableInput, normaliseColumn, translateSqliteError, describe, query, write, rowHistory, pruneHistory, deleteImpact, createTable, updateTable, dropTable, addColumn, updateColumn, dropColumn, columnChangeNeedsRebuild, dropColumnNeedsRebuild, readTableCopy, clearFailedTableCopy, copyTableStep, writeReachesCopy, assertActor, assertWritable, exportRows } from './dataEngine';
6
+ export { INTERNAL_MIGRATIONS, INTERNAL_SCHEMA_VERSION, hasInternalTables, getMeta, setMeta, migrateInternal, loadSchema, toTableInput, normaliseColumn, translateSqliteError, describe, query, write, rowHistory, pruneHistory, deleteImpact, fileLinks, replaceFileLinks, createTable, updateTable, dropTable, addColumn, updateColumn, dropColumn, columnChangeNeedsRebuild, dropColumnNeedsRebuild, readTableCopy, clearFailedTableCopy, copyTableStep, writeReachesCopy, assertActor, assertWritable, exportRows } from './dataEngine';
7
7
  export type { SqlRow, SqlRunner } from './dataEngine';
8
+ export { adviseIndexes, adviceDoubled } from './dataIndexAdvice';
9
+ export type { IndexAdviceCandidate, IndexAdviceInput, IndexAdviceStat } from './dataIndexAdvice';
8
10
  export { DATA_QUERY_PARAM_TYPES, DATA_MAX_QUERIES, DATA_MAX_QUERY_SQL, DATA_MAX_QUERY_PARAMS, DATA_DEFAULT_QUERY_ROWS, compileQuerySql, checkQueryPlan, listQueries, queriesFor, saveQuery, dropQuery, runQuery } from './dataQueries';
9
11
  export type { DataQuery, DataQueryInput, DataQueryParam, DataQueryParamType } from './dataQueries';
10
12
  export type { ProjectDatabaseRpc, DatabaseInfo, ExportFile, ExportFormat, ExportState, RestoreResult } from './dataRpc';
11
13
  export { DATA_TOOL_DESCRIBE, DATA_TOOL_QUERY, DATA_TOOL_WRITE, DATA_TOOL_ADMIN, DATA_TOOL_NAMES, DATA_TOOL_TITLES, DATA_TOOL_MAX_LIMIT, DATA_ADMIN_ACTIONS, hasDataToolTables, dataToolDefinitions, dataAdminToolDefinition } from './dataTools';
12
14
  export type { DataToolDefinition, DataAdminAction } from './dataTools';
13
- export { DATA_TRIGGER_EVENTS, DATA_TRIGGER_ACTIONS, DATA_MAX_TRIGGERS, DATA_TRIGGER_MAX_DEPTH, DATA_TRIGGER_DEFAULT_RATE, DATA_TRIGGER_MAX_RATE, DATA_OUTBOX_BATCH, DATA_TRIGGER_MAX_MESSAGE_BYTES, utf8Bytes, conditionMatches, renderTriggerText, normaliseTrigger, listTriggers, getTrigger, saveTrigger, dropTrigger, setTriggerEnabled, replaceManagedTriggers, collectTriggerEvents, readOutbox, deleteOutbox, outboxSize, clearOutbox, triggersUsingColumn, renameColumnInTriggers } from './dataTriggers';
14
- export type { DataTrigger, DataTriggerAction, DataTriggerActionType, DataTriggerCondition, DataTriggerEvent, DataTriggerEventMessage, DataTriggerInput, DataTriggerTemplate, DataTriggerTest, DataTriggerWithSecret, SavedTrigger } from './dataTriggers';
15
+ export { DATA_TRIGGER_EVENTS, DATA_TRIGGER_ACTIONS, DATA_MAX_TRIGGERS, DATA_TRIGGER_MAX_DEPTH, DATA_TRIGGER_DEFAULT_RATE, DATA_TRIGGER_MAX_RATE, DATA_OUTBOX_BATCH, DATA_TRIGGER_MAX_MESSAGE_BYTES, utf8Bytes, conditionMatches, renderTriggerText, renderCustomerMessage, readEventRow, normaliseTrigger, normaliseCustomerAction, listTriggers, getTrigger, saveTrigger, dropTrigger, setTriggerEnabled, replaceManagedTriggers, collectTriggerEvents, readOutbox, deleteOutbox, outboxSize, clearOutbox, triggersUsingColumn, renameColumnInTriggers } from './dataTriggers';
16
+ export type { DataTrigger, DataTriggerAction, DataTriggerActionType, DataTriggerCondition, DataTriggerCustomerMessage, DataTriggerEvent, DataTriggerEventMessage, DataTriggerInput, DataTriggerTemplate, DataTriggerTest, DataTriggerWithSecret, SavedTrigger } from './dataTriggers';
15
17
  //# sourceMappingURL=data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACX,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,SAAS,EACT,aAAa,EACb,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,KAAK,EACN,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAA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AiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,YAAY,EACb,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACX,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,SAAS,EACT,aAAa,EACb,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,QAAQ,EACR,KAAK,EACN,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,OAAO,EACP,OAAO,EACP,eAAe,EACf,UAAU,EACV,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,KAAK,EACL,KAAK,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,SAAS,EACT,S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AW,EACX,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,YAAY,EACb,MAAM,gBAAgB,CAAC"}
package/dist/data.js CHANGED
@@ -14,9 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.writeReachesCopy = exports.copyTableStep = exports.clearFailedTableCopy = exports.readTableCopy = exports.dropColumnNeedsRebuild = exports.columnChangeNeedsRebuild = exports.dropColumn = exports.updateColumn = exports.addColumn = exports.dropTable = exports.updateTable = exports.createTable = exports.deleteImpact = exports.pruneHistory = exports.rowHistory = exports.write = exports.query = exports.describe = exports.translateSqliteError = exports.normaliseColumn = exports.toTableInput = exports.loadSchema = exports.migrateInternal = exports.setMeta = exports.getMeta = exports.hasInternalTables = exports.INTERNAL_SCHEMA_VERSION = exports.INTERNAL_MIGRATIONS = exports.zoned = exports.tidyArgs = exports.isSensitiveWrite = exports.decodeCursor = exports.encodeCursor = exports.keysetCondition = exports.ftsMatch = exports.rowsPerInsert = exports.chunkRows = exports.sqlLiteral = exports.searchableColumns = exports.ftsTableName = exports.ftsCreateSql = exports.desiredTriggers = exports.desiredIndexes = exports.columnDefinitionSql = exports.createTableSql = exports.isValidIdentifier = exports.identifierIssue = exports.DATA_HIDDEN_COLUMNS = exports.DATA_SYSTEM_COLUMNS = exports.DATA_IDENTIFIER_PATTERN = void 0;
18
- exports.triggersUsingColumn = exports.clearOutbox = exports.outboxSize = exports.deleteOutbox = exports.readOutbox = exports.collectTriggerEvents = exports.replaceManagedTriggers = exports.setTriggerEnabled = exports.dropTrigger = exports.saveTrigger = exports.getTrigger = exports.listTriggers = exports.normaliseTrigger = exports.renderTriggerText = exports.conditionMatches = exports.utf8Bytes = exports.DATA_TRIGGER_MAX_MESSAGE_BYTES = exports.DATA_OUTBOX_BATCH = exports.DATA_TRIGGER_MAX_RATE = exports.DATA_TRIGGER_DEFAULT_RATE = exports.DATA_TRIGGER_MAX_DEPTH = exports.DATA_MAX_TRIGGERS = exports.DATA_TRIGGER_ACTIONS = exports.DATA_TRIGGER_EVENTS = exports.dataAdminToolDefinition = exports.dataToolDefinitions = exports.hasDataToolTables = exports.DATA_ADMIN_ACTIONS = exports.DATA_TOOL_MAX_LIMIT = exports.DATA_TOOL_TITLES = exports.DATA_TOOL_NAMES = exports.DATA_TOOL_ADMIN = exports.DATA_TOOL_WRITE = exports.DATA_TOOL_QUERY = exports.DATA_TOOL_DESCRIBE = exports.runQuery = exports.dropQuery = exports.saveQuery = exports.queriesFor = exports.listQueries = exports.checkQueryPlan = exports.compileQuerySql = exports.DATA_DEFAULT_QUERY_ROWS = exports.DATA_MAX_QUERY_PARAMS = exports.DATA_MAX_QUERY_SQL = exports.DATA_MAX_QUERIES = exports.DATA_QUERY_PARAM_TYPES = exports.exportRows = exports.assertWritable = exports.assertActor = void 0;
19
- exports.renameColumnInTriggers = void 0;
17
+ exports.dropColumnNeedsRebuild = exports.columnChangeNeedsRebuild = exports.dropColumn = exports.updateColumn = exports.addColumn = exports.dropTable = exports.updateTable = exports.createTable = exports.replaceFileLinks = exports.fileLinks = exports.deleteImpact = exports.pruneHistory = exports.rowHistory = exports.write = exports.query = exports.describe = exports.translateSqliteError = exports.normaliseColumn = exports.toTableInput = exports.loadSchema = exports.migrateInternal = exports.setMeta = exports.getMeta = exports.hasInternalTables = exports.INTERNAL_SCHEMA_VERSION = exports.INTERNAL_MIGRATIONS = exports.zoned = exports.tidyArgs = exports.unknownFileUris = exports.fileUriOf = exports.isSensitiveWrite = exports.decodeCursor = exports.encodeCursor = exports.keysetCondition = exports.ftsMatch = exports.rowsPerInsert = exports.chunkRows = exports.sqlLiteral = exports.searchableColumns = exports.ftsTableName = exports.ftsCreateSql = exports.desiredTriggers = exports.desiredIndexes = exports.columnDefinitionSql = exports.createTableSql = exports.isValidIdentifier = exports.identifierIssue = exports.DATA_HIDDEN_COLUMNS = exports.DATA_SYSTEM_COLUMNS = exports.DATA_IDENTIFIER_PATTERN = void 0;
18
+ exports.saveTrigger = exports.getTrigger = exports.listTriggers = exports.normaliseCustomerAction = exports.normaliseTrigger = exports.readEventRow = exports.renderCustomerMessage = exports.renderTriggerText = exports.conditionMatches = exports.utf8Bytes = exports.DATA_TRIGGER_MAX_MESSAGE_BYTES = exports.DATA_OUTBOX_BATCH = exports.DATA_TRIGGER_MAX_RATE = exports.DATA_TRIGGER_DEFAULT_RATE = exports.DATA_TRIGGER_MAX_DEPTH = exports.DATA_MAX_TRIGGERS = exports.DATA_TRIGGER_ACTIONS = exports.DATA_TRIGGER_EVENTS = exports.dataAdminToolDefinition = exports.dataToolDefinitions = exports.hasDataToolTables = exports.DATA_ADMIN_ACTIONS = exports.DATA_TOOL_MAX_LIMIT = exports.DATA_TOOL_TITLES = exports.DATA_TOOL_NAMES = exports.DATA_TOOL_ADMIN = exports.DATA_TOOL_WRITE = exports.DATA_TOOL_QUERY = exports.DATA_TOOL_DESCRIBE = exports.runQuery = exports.dropQuery = exports.saveQuery = exports.queriesFor = exports.listQueries = exports.checkQueryPlan = exports.compileQuerySql = exports.DATA_DEFAULT_QUERY_ROWS = exports.DATA_MAX_QUERY_PARAMS = exports.DATA_MAX_QUERY_SQL = exports.DATA_MAX_QUERIES = exports.DATA_QUERY_PARAM_TYPES = exports.adviceDoubled = exports.adviseIndexes = exports.exportRows = exports.assertWritable = exports.assertActor = exports.writeReachesCopy = exports.copyTableStep = exports.clearFailedTableCopy = exports.readTableCopy = void 0;
19
+ exports.renameColumnInTriggers = exports.triggersUsingColumn = exports.clearOutbox = exports.outboxSize = exports.deleteOutbox = exports.readOutbox = exports.collectTriggerEvents = exports.replaceManagedTriggers = exports.setTriggerEnabled = exports.dropTrigger = void 0;
20
20
  // Entry point for `@ganju/utils/data`: everything a project's database and
21
21
  // its callers share, without pulling in the rest of the package.
22
22
  __exportStar(require("./dataTypes"), exports);
@@ -43,6 +43,8 @@ Object.defineProperty(exports, "keysetCondition", { enumerable: true, get: funct
43
43
  Object.defineProperty(exports, "encodeCursor", { enumerable: true, get: function () { return dataCompiler_1.encodeCursor; } });
44
44
  Object.defineProperty(exports, "decodeCursor", { enumerable: true, get: function () { return dataCompiler_1.decodeCursor; } });
45
45
  Object.defineProperty(exports, "isSensitiveWrite", { enumerable: true, get: function () { return dataCompiler_1.isSensitiveWrite; } });
46
+ Object.defineProperty(exports, "fileUriOf", { enumerable: true, get: function () { return dataCompiler_1.fileUriOf; } });
47
+ Object.defineProperty(exports, "unknownFileUris", { enumerable: true, get: function () { return dataCompiler_1.unknownFileUris; } });
46
48
  Object.defineProperty(exports, "tidyArgs", { enumerable: true, get: function () { return dataCompiler_1.tidyArgs; } });
47
49
  Object.defineProperty(exports, "zoned", { enumerable: true, get: function () { return dataCompiler_1.zoned; } });
48
50
  var dataEngine_1 = require("./dataEngine");
@@ -62,6 +64,8 @@ Object.defineProperty(exports, "write", { enumerable: true, get: function () { r
62
64
  Object.defineProperty(exports, "rowHistory", { enumerable: true, get: function () { return dataEngine_1.rowHistory; } });
63
65
  Object.defineProperty(exports, "pruneHistory", { enumerable: true, get: function () { return dataEngine_1.pruneHistory; } });
64
66
  Object.defineProperty(exports, "deleteImpact", { enumerable: true, get: function () { return dataEngine_1.deleteImpact; } });
67
+ Object.defineProperty(exports, "fileLinks", { enumerable: true, get: function () { return dataEngine_1.fileLinks; } });
68
+ Object.defineProperty(exports, "replaceFileLinks", { enumerable: true, get: function () { return dataEngine_1.replaceFileLinks; } });
65
69
  Object.defineProperty(exports, "createTable", { enumerable: true, get: function () { return dataEngine_1.createTable; } });
66
70
  Object.defineProperty(exports, "updateTable", { enumerable: true, get: function () { return dataEngine_1.updateTable; } });
67
71
  Object.defineProperty(exports, "dropTable", { enumerable: true, get: function () { return dataEngine_1.dropTable; } });
@@ -77,6 +81,9 @@ Object.defineProperty(exports, "writeReachesCopy", { enumerable: true, get: func
77
81
  Object.defineProperty(exports, "assertActor", { enumerable: true, get: function () { return dataEngine_1.assertActor; } });
78
82
  Object.defineProperty(exports, "assertWritable", { enumerable: true, get: function () { return dataEngine_1.assertWritable; } });
79
83
  Object.defineProperty(exports, "exportRows", { enumerable: true, get: function () { return dataEngine_1.exportRows; } });
84
+ var dataIndexAdvice_1 = require("./dataIndexAdvice");
85
+ Object.defineProperty(exports, "adviseIndexes", { enumerable: true, get: function () { return dataIndexAdvice_1.adviseIndexes; } });
86
+ Object.defineProperty(exports, "adviceDoubled", { enumerable: true, get: function () { return dataIndexAdvice_1.adviceDoubled; } });
80
87
  var dataQueries_1 = require("./dataQueries");
81
88
  Object.defineProperty(exports, "DATA_QUERY_PARAM_TYPES", { enumerable: true, get: function () { return dataQueries_1.DATA_QUERY_PARAM_TYPES; } });
82
89
  Object.defineProperty(exports, "DATA_MAX_QUERIES", { enumerable: true, get: function () { return dataQueries_1.DATA_MAX_QUERIES; } });
@@ -114,7 +121,10 @@ Object.defineProperty(exports, "DATA_TRIGGER_MAX_MESSAGE_BYTES", { enumerable: t
114
121
  Object.defineProperty(exports, "utf8Bytes", { enumerable: true, get: function () { return dataTriggers_1.utf8Bytes; } });
115
122
  Object.defineProperty(exports, "conditionMatches", { enumerable: true, get: function () { return dataTriggers_1.conditionMatches; } });
116
123
  Object.defineProperty(exports, "renderTriggerText", { enumerable: true, get: function () { return dataTriggers_1.renderTriggerText; } });
124
+ Object.defineProperty(exports, "renderCustomerMessage", { enumerable: true, get: function () { return dataTriggers_1.renderCustomerMessage; } });
125
+ Object.defineProperty(exports, "readEventRow", { enumerable: true, get: function () { return dataTriggers_1.readEventRow; } });
117
126
  Object.defineProperty(exports, "normaliseTrigger", { enumerable: true, get: function () { return dataTriggers_1.normaliseTrigger; } });
127
+ Object.defineProperty(exports, "normaliseCustomerAction", { enumerable: true, get: function () { return dataTriggers_1.normaliseCustomerAction; } });
118
128
  Object.defineProperty(exports, "listTriggers", { enumerable: true, get: function () { return dataTriggers_1.listTriggers; } });
119
129
  Object.defineProperty(exports, "getTrigger", { enumerable: true, get: function () { return dataTriggers_1.getTrigger; } });
120
130
  Object.defineProperty(exports, "saveTrigger", { enumerable: true, get: function () { return dataTriggers_1.saveTrigger; } });
package/dist/dataApi.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare const DATA_API_ROUTES: {
19
19
  readonly path: "";
20
20
  readonly tag: "Database";
21
21
  readonly summary: "The project's database";
22
- readonly description: "Its status and size, and its tables when it is ready. `database` is null when the project has none.";
22
+ readonly description: "Its status and size, and its tables when it is ready, with `indexAdvice`: the open index suggestions. `database` is null when the project has none.";
23
23
  readonly returns: "{ database }";
24
24
  };
25
25
  readonly create: {
@@ -94,6 +94,22 @@ export declare const DATA_API_ROUTES: {
94
94
  readonly description: "A column change on a table over 100,000 rows copies it in the background; table changes, and writes that would change its rows, wait until it finishes (`copy` on `GET` shows how far it got). A copy that failed left the table as it was and stays in `copy` with its `error` until dismissed, or until the next column change.";
95
95
  readonly returns: "{ copy: null }";
96
96
  };
97
+ readonly applyIndexAdvice: {
98
+ readonly method: "post";
99
+ readonly path: "/advice/:adviceId";
100
+ readonly tag: "Tables";
101
+ readonly summary: "Add a suggested index";
102
+ readonly description: "`GET` lists the open suggestions in `indexAdvice`: a column filtered or sorted on by 50 or more queries in a week that each read 1,000 or more rows, 20 for every row returned. This marks the column filterable, which indexes it, and records it in the change log. A suggestion of kind `unused` is only a flag; it can't be applied here, only dismissed.";
103
+ readonly returns: "{ table }";
104
+ };
105
+ readonly dismissIndexAdvice: {
106
+ readonly method: "delete";
107
+ readonly path: "/advice/:adviceId";
108
+ readonly tag: "Tables";
109
+ readonly summary: "Dismiss an index suggestion";
110
+ readonly description: "It stays dismissed until its numbers double (queries, rows read per query, or rows written for an unused index).";
111
+ readonly returns: "{ dismissed: true }";
112
+ };
97
113
  readonly listTables: {
98
114
  readonly method: "get";
99
115
  readonly path: "/table";
@@ -113,8 +129,8 @@ export declare const DATA_API_ROUTES: {
113
129
  displayColumn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
114
130
  access: z.ZodOptional<z.ZodEnum<{
115
131
  none: "none";
116
- read: "read";
117
132
  add: "add";
133
+ read: "read";
118
134
  full: "full";
119
135
  }>>;
120
136
  customerScoped: z.ZodOptional<z.ZodBoolean>;
@@ -170,8 +186,8 @@ export declare const DATA_API_ROUTES: {
170
186
  displayColumn: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
171
187
  access: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
172
188
  none: "none";
173
- read: "read";
174
189
  add: "add";
190
+ read: "read";
175
191
  full: "full";
176
192
  }>>>;
177
193
  customerScoped: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
@@ -289,7 +305,7 @@ export declare const DATA_API_ROUTES: {
289
305
  readonly path: "/table/:table/row";
290
306
  readonly tag: "Rows";
291
307
  readonly summary: "List, filter and search rows";
292
- readonly description: "Up to 500 rows or 1 MB a page; `nextCursor` reads the next. `where` is JSON, e.g. `{\"status\":\"open\",\"price\":{\"lt\":30000}}`. `sort` is a list of columns, `-` for descending. `q` searches the searchable columns.";
308
+ readonly description: "Up to 500 rows or 1 MB a page; `nextCursor` reads the next. `where` is JSON, e.g. `{\"status\":\"open\",\"price\":{\"lt\":30000}}`. `sort` is a list of columns, `-` for descending. `q` searches the searchable columns. A relation comes back as `{ id, label }`; a file column as `{ uri, id, title, mimeType }`, or `{ uri, missing: true }` when no resource has the uri any more. Writes take a file column's uri.";
293
309
  readonly query: z.ZodObject<{
294
310
  where: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<unknown, string>>>;
295
311
  sort: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
@@ -476,7 +492,7 @@ export declare const DATA_API_ROUTES: {
476
492
  readonly path: "/trigger";
477
493
  readonly tag: "Triggers";
478
494
  readonly summary: "Save a trigger";
479
- readonly description: "Runs one action when rows of `table` are inserted, updated or deleted, and `when` holds: `{ \"status\": { \"changedTo\": \"READY\" } }` fires on the transition only; `changedFrom`, `changed: true` and `equals` test a column too, and `all` / `any` combine them. The action is one of `function` (a function of this project, given `{ event, table, row, previous, actor, eventId, triggerId }`), `webhook` (an https URL, sent a POST signed in `x-ganju-signature`), `chat` (`{ channelId, chatId, text }`), `email` (`{ to, subject, text }`) or `customer` (`{ text, template? }`, to the row's customer on a customer-scoped table). Texts take `{{field}}` from the row, inserted as plain text. Saving under an existing name replaces it, unless `replace` is false; with no `name`, it always creates a new trigger, named from the table, event and action and numbered past those taken. Left out, `enabled` keeps a saved trigger on or off as it was. A new webhook answers with its signing `secret`, shown this once. Delivery is at least once: every event carries an `eventId`.";
495
+ readonly description: "Runs one action when rows of `table` are inserted, updated or deleted, and `when` holds: `{ \"status\": { \"changedTo\": \"READY\" } }` fires on the transition only; `changedFrom`, `changed: true` and `equals` test a column too, and `all` / `any` combine them. The action is one of `function` (a function of this project, given `{ event, table, row, previous, actor, eventId, triggerId }`), `webhook` (an https URL, sent a POST signed in `x-ganju-signature`), `chat` (`{ channelId, chatId, text }`), `email` (`{ to, subject, text }`) or `customer` (`{ text, template? }`, to the row's customer on a customer-scoped table). Texts take `{{field}}` from the row, inserted as plain text. Saving under an existing name replaces it, unless `replace` is false; with no `name`, it always creates a new trigger, named from the table, event and action and numbered past those taken. Left out, `enabled` keeps a saved trigger on or off as it was. A new webhook answers with its signing `secret`, shown this once. An `email` goes to the organization's members; any other address is sent a link to confirm first, and those still waiting come back as `confirming`. Delivery is at least once: every event carries an `eventId`.";
480
496
  readonly body: z.ZodObject<{
481
497
  name: z.ZodOptional<z.ZodString>;
482
498
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -511,7 +527,7 @@ export declare const DATA_API_ROUTES: {
511
527
  }, z.core.$strict>>;
512
528
  }, z.core.$strict>>;
513
529
  }, z.core.$strict>;
514
- readonly returns: "{ trigger, secret? }";
530
+ readonly returns: "{ trigger, secret?, confirming? }";
515
531
  readonly status: 201;
516
532
  };
517
533
  readonly updateTrigger: {
@@ -537,7 +553,7 @@ export declare const DATA_API_ROUTES: {
537
553
  readonly path: "/trigger/deploy";
538
554
  readonly tag: "Triggers";
539
555
  readonly summary: "Deploy the triggers of ganju.json";
540
- readonly description: "What `ganju deploy` sends: every trigger listed is saved as managed by the CLI, and the CLI's earlier ones not listed are deleted. Triggers made in the dashboard are left alone. All or nothing. New webhooks' secrets come back once, by name.";
556
+ readonly description: "What `ganju deploy` sends: every trigger listed is saved as managed by the CLI, and the CLI's earlier ones not listed are deleted. Triggers made in the dashboard are left alone. All or nothing. New webhooks' secrets come back once, by name, and email addresses still to confirm as `confirming`.";
541
557
  readonly body: z.ZodObject<{
542
558
  triggers: z.ZodArray<z.ZodObject<{
543
559
  name: z.ZodOptional<z.ZodString>;
@@ -574,7 +590,37 @@ export declare const DATA_API_ROUTES: {
574
590
  }, z.core.$strict>>;
575
591
  }, z.core.$strict>>;
576
592
  }, z.core.$strict>;
577
- readonly returns: "{ triggers, removed, secrets }";
593
+ readonly returns: "{ triggers, removed, secrets, confirming? }";
594
+ };
595
+ readonly listTestRecipients: {
596
+ readonly method: "get";
597
+ readonly path: "/trigger/test-send";
598
+ readonly tag: "Triggers";
599
+ readonly summary: "Where a test send can go";
600
+ readonly description: "The caller's own chats with this project's bots: the ones they linked to their Ganju account by sending `/link` to the bot. Empty when there are none.";
601
+ readonly returns: "{ recipients }";
602
+ };
603
+ readonly testSend: {
604
+ readonly method: "post";
605
+ readonly path: "/trigger/test-send";
606
+ readonly tag: "Triggers";
607
+ readonly summary: "Send a test of a customer message";
608
+ readonly description: "Sends a `customer` action, saved or not, to the caller's own chat with the bot instead of the row's customer: built from the row `rowId` (the table's newest row by default), the same as a real run. `participantId` picks one of `GET /trigger/test-send`'s recipients when there are several. With `asTemplate`, a WhatsApp template goes out even inside the 24-hour window. Not a run: it isn't listed with any trigger's runs and doesn't count toward the daily limit per customer. Five a minute per user. A channel's refusal (the template not approved, outside the window with no template, the daily limit) comes back as the error.";
609
+ readonly body: z.ZodObject<{
610
+ table: z.ZodString;
611
+ customer: z.ZodObject<{
612
+ text: z.ZodString;
613
+ template: z.ZodOptional<z.ZodObject<{
614
+ name: z.ZodString;
615
+ language: z.ZodString;
616
+ params: z.ZodOptional<z.ZodArray<z.ZodString>>;
617
+ }, z.core.$strict>>;
618
+ }, z.core.$strict>;
619
+ rowId: z.ZodOptional<z.ZodNumber>;
620
+ participantId: z.ZodOptional<z.ZodString>;
621
+ asTemplate: z.ZodOptional<z.ZodBoolean>;
622
+ }, z.core.$strict>;
623
+ readonly returns: "{ sent, text, template, rowId, recipient }";
578
624
  };
579
625
  readonly listTriggerRuns: {
580
626
  readonly method: "get";
@@ -1 +1 @@
1
- {"version":3,"file":"dataApi.d.ts","sourceRoot":"","sources":["../src/dataApi.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa,mEACwC,CAAC;AAEnE,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,aAAa,CAAC;IAEtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EACC,UAAU,GACV,QAAQ,GACR,MAAM,GACN,SAAS,GACT,UAAU,GACV,oBAAoB,CAAC;IACzB,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwYqB,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,eAAe,CAAC;AAmB1D;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,WAAW,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8G5C,CAAC"}
package/dist/dataApi.js CHANGED
@@ -7,14 +7,14 @@ exports.dataOpenApi = exports.DATA_API_ROUTES = exports.DATA_API_BASE = void 0;
7
7
  const zod_1 = require("zod");
8
8
  const schema_1 = require("./schema");
9
9
  exports.DATA_API_BASE = '/organization/:organizationId/project/:projectId/artifact/data';
10
- const { DATA_DATABASE_CREATE, DATA_DATABASE_DELETE, DATA_DATABASE_PATCH, DATA_TABLE_INPUT, DATA_TABLE_PATCH, DATA_COLUMN_INPUT, DATA_COLUMN_PATCH, DATA_TABLE_DROP_BODY, DATA_ROW_LIST_QUERY, DATA_ROW_GET_QUERY, DATA_ROW_CREATE_BODY, DATA_ROW_UPDATE_BODY, DATA_ROW_DELETE_BODY, DATA_DELETE_PREVIEW_BODY, DATA_WRITE_BODY, DATA_ROW_HISTORY_QUERY, DATA_RESTORE_POINT_BODY, DATA_EXPORT_BODY, DATA_EXPORT_QUERY, DATA_EXPORT_FILE_QUERY, DATA_CHANGE_LIST_QUERY, DATA_QUERY_INPUT, DATA_QUERY_RUN_BODY, DATA_TRIGGER_INPUT, DATA_TRIGGER_PATCH, DATA_TRIGGER_DEPLOY_BODY, DATA_TRIGGER_RUN_LIST_QUERY } = schema_1.Schema;
10
+ const { DATA_DATABASE_CREATE, DATA_DATABASE_DELETE, DATA_DATABASE_PATCH, DATA_TABLE_INPUT, DATA_TABLE_PATCH, DATA_COLUMN_INPUT, DATA_COLUMN_PATCH, DATA_TABLE_DROP_BODY, DATA_ROW_LIST_QUERY, DATA_ROW_GET_QUERY, DATA_ROW_CREATE_BODY, DATA_ROW_UPDATE_BODY, DATA_ROW_DELETE_BODY, DATA_DELETE_PREVIEW_BODY, DATA_WRITE_BODY, DATA_ROW_HISTORY_QUERY, DATA_RESTORE_POINT_BODY, DATA_EXPORT_BODY, DATA_EXPORT_QUERY, DATA_EXPORT_FILE_QUERY, DATA_CHANGE_LIST_QUERY, DATA_QUERY_INPUT, DATA_QUERY_RUN_BODY, DATA_TRIGGER_INPUT, DATA_TRIGGER_PATCH, DATA_TRIGGER_DEPLOY_BODY, DATA_TRIGGER_TEST_SEND_BODY, DATA_TRIGGER_RUN_LIST_QUERY } = schema_1.Schema;
11
11
  exports.DATA_API_ROUTES = {
12
12
  getDatabase: {
13
13
  method: 'get',
14
14
  path: '',
15
15
  tag: 'Database',
16
16
  summary: "The project's database",
17
- description: 'Its status and size, and its tables when it is ready. `database` is null when the project has none.',
17
+ description: 'Its status and size, and its tables when it is ready, with `indexAdvice`: the open index suggestions. `database` is null when the project has none.',
18
18
  returns: '{ database }'
19
19
  },
20
20
  create: {
@@ -78,6 +78,22 @@ exports.DATA_API_ROUTES = {
78
78
  description: 'A column change on a table over 100,000 rows copies it in the background; table changes, and writes that would change its rows, wait until it finishes (`copy` on `GET` shows how far it got). A copy that failed left the table as it was and stays in `copy` with its `error` until dismissed, or until the next column change.',
79
79
  returns: '{ copy: null }'
80
80
  },
81
+ applyIndexAdvice: {
82
+ method: 'post',
83
+ path: '/advice/:adviceId',
84
+ tag: 'Tables',
85
+ summary: 'Add a suggested index',
86
+ description: "`GET` lists the open suggestions in `indexAdvice`: a column filtered or sorted on by 50 or more queries in a week that each read 1,000 or more rows, 20 for every row returned. This marks the column filterable, which indexes it, and records it in the change log. A suggestion of kind `unused` is only a flag; it can't be applied here, only dismissed.",
87
+ returns: '{ table }'
88
+ },
89
+ dismissIndexAdvice: {
90
+ method: 'delete',
91
+ path: '/advice/:adviceId',
92
+ tag: 'Tables',
93
+ summary: 'Dismiss an index suggestion',
94
+ description: 'It stays dismissed until its numbers double (queries, rows read per query, or rows written for an unused index).',
95
+ returns: '{ dismissed: true }'
96
+ },
81
97
  listTables: {
82
98
  method: 'get',
83
99
  path: '/table',
@@ -142,7 +158,7 @@ exports.DATA_API_ROUTES = {
142
158
  path: '/table/:table/row',
143
159
  tag: 'Rows',
144
160
  summary: 'List, filter and search rows',
145
- description: 'Up to 500 rows or 1 MB a page; `nextCursor` reads the next. `where` is JSON, e.g. `{"status":"open","price":{"lt":30000}}`. `sort` is a list of columns, `-` for descending. `q` searches the searchable columns.',
161
+ description: 'Up to 500 rows or 1 MB a page; `nextCursor` reads the next. `where` is JSON, e.g. `{"status":"open","price":{"lt":30000}}`. `sort` is a list of columns, `-` for descending. `q` searches the searchable columns. A relation comes back as `{ id, label }`; a file column as `{ uri, id, title, mimeType }`, or `{ uri, missing: true }` when no resource has the uri any more. Writes take a file column\'s uri.',
146
162
  query: DATA_ROW_LIST_QUERY,
147
163
  returns: '{ table, rows, total?, nextCursor? }'
148
164
  },
@@ -255,9 +271,9 @@ exports.DATA_API_ROUTES = {
255
271
  path: '/trigger',
256
272
  tag: 'Triggers',
257
273
  summary: 'Save a trigger',
258
- description: 'Runs one action when rows of `table` are inserted, updated or deleted, and `when` holds: `{ "status": { "changedTo": "READY" } }` fires on the transition only; `changedFrom`, `changed: true` and `equals` test a column too, and `all` / `any` combine them. The action is one of `function` (a function of this project, given `{ event, table, row, previous, actor, eventId, triggerId }`), `webhook` (an https URL, sent a POST signed in `x-ganju-signature`), `chat` (`{ channelId, chatId, text }`), `email` (`{ to, subject, text }`) or `customer` (`{ text, template? }`, to the row\'s customer on a customer-scoped table). Texts take `{{field}}` from the row, inserted as plain text. Saving under an existing name replaces it, unless `replace` is false; with no `name`, it always creates a new trigger, named from the table, event and action and numbered past those taken. Left out, `enabled` keeps a saved trigger on or off as it was. A new webhook answers with its signing `secret`, shown this once. Delivery is at least once: every event carries an `eventId`.',
274
+ description: 'Runs one action when rows of `table` are inserted, updated or deleted, and `when` holds: `{ "status": { "changedTo": "READY" } }` fires on the transition only; `changedFrom`, `changed: true` and `equals` test a column too, and `all` / `any` combine them. The action is one of `function` (a function of this project, given `{ event, table, row, previous, actor, eventId, triggerId }`), `webhook` (an https URL, sent a POST signed in `x-ganju-signature`), `chat` (`{ channelId, chatId, text }`), `email` (`{ to, subject, text }`) or `customer` (`{ text, template? }`, to the row\'s customer on a customer-scoped table). Texts take `{{field}}` from the row, inserted as plain text. Saving under an existing name replaces it, unless `replace` is false; with no `name`, it always creates a new trigger, named from the table, event and action and numbered past those taken. Left out, `enabled` keeps a saved trigger on or off as it was. A new webhook answers with its signing `secret`, shown this once. An `email` goes to the organization\'s members; any other address is sent a link to confirm first, and those still waiting come back as `confirming`. Delivery is at least once: every event carries an `eventId`.',
259
275
  body: DATA_TRIGGER_INPUT,
260
- returns: '{ trigger, secret? }',
276
+ returns: '{ trigger, secret?, confirming? }',
261
277
  status: 201
262
278
  },
263
279
  updateTrigger: {
@@ -281,9 +297,26 @@ exports.DATA_API_ROUTES = {
281
297
  path: '/trigger/deploy',
282
298
  tag: 'Triggers',
283
299
  summary: 'Deploy the triggers of ganju.json',
284
- description: "What `ganju deploy` sends: every trigger listed is saved as managed by the CLI, and the CLI's earlier ones not listed are deleted. Triggers made in the dashboard are left alone. All or nothing. New webhooks' secrets come back once, by name.",
300
+ description: "What `ganju deploy` sends: every trigger listed is saved as managed by the CLI, and the CLI's earlier ones not listed are deleted. Triggers made in the dashboard are left alone. All or nothing. New webhooks' secrets come back once, by name, and email addresses still to confirm as `confirming`.",
285
301
  body: DATA_TRIGGER_DEPLOY_BODY,
286
- returns: '{ triggers, removed, secrets }'
302
+ returns: '{ triggers, removed, secrets, confirming? }'
303
+ },
304
+ listTestRecipients: {
305
+ method: 'get',
306
+ path: '/trigger/test-send',
307
+ tag: 'Triggers',
308
+ summary: 'Where a test send can go',
309
+ description: "The caller's own chats with this project's bots: the ones they linked to their Ganju account by sending `/link` to the bot. Empty when there are none.",
310
+ returns: '{ recipients }'
311
+ },
312
+ testSend: {
313
+ method: 'post',
314
+ path: '/trigger/test-send',
315
+ tag: 'Triggers',
316
+ summary: 'Send a test of a customer message',
317
+ description: "Sends a `customer` action, saved or not, to the caller's own chat with the bot instead of the row's customer: built from the row `rowId` (the table's newest row by default), the same as a real run. `participantId` picks one of `GET /trigger/test-send`'s recipients when there are several. With `asTemplate`, a WhatsApp template goes out even inside the 24-hour window. Not a run: it isn't listed with any trigger's runs and doesn't count toward the daily limit per customer. Five a minute per user. A channel's refusal (the template not approved, outside the window with no template, the daily limit) comes back as the error.",
318
+ body: DATA_TRIGGER_TEST_SEND_BODY,
319
+ returns: '{ sent, text, template, rowId, recipient }'
287
320
  },
288
321
  listTriggerRuns: {
289
322
  method: 'get',
@@ -0,0 +1,8 @@
1
+ export interface DataAttachment {
2
+ table: string;
3
+ column: string;
4
+ index: boolean;
5
+ }
6
+ export declare const dataAttachmentOf: (metadata: unknown) => DataAttachment | null;
7
+ export declare const skipsIndexing: (metadata: unknown) => boolean;
8
+ //# sourceMappingURL=dataAttachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataAttachment.d.ts","sourceRoot":"","sources":["../src/dataAttachment.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB;AAID,eAAO,MAAM,gBAAgB,GAAI,UAAU,OAAO,KAAG,cAAc,GAAG,IAMrE,CAAC;AAGF,eAAO,MAAM,aAAa,GAAI,UAAU,OAAO,KAAG,OAGjD,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.skipsIndexing = exports.dataAttachmentOf = void 0;
4
+ const schema_1 = require("./schema");
5
+ // The Data upload a knowledge item came from, read from its metadata, or
6
+ // null for any other item.
7
+ const dataAttachmentOf = (metadata) => {
8
+ if (!metadata || typeof metadata !== 'object')
9
+ return null;
10
+ const parsed = schema_1.Schema.DATA_ATTACHMENT_METADATA.safeParse(metadata.dataAttachment);
11
+ return parsed.success ? parsed.data : null;
12
+ };
13
+ exports.dataAttachmentOf = dataAttachmentOf;
14
+ // Uploads from Data are stored, not indexed, unless their column asks.
15
+ const skipsIndexing = (metadata) => {
16
+ const attachment = (0, exports.dataAttachmentOf)(metadata);
17
+ return attachment !== null && !attachment.index;
18
+ };
19
+ exports.skipsIndexing = skipsIndexing;
@@ -28,6 +28,8 @@ export declare const joinsSql: (joins: Map<string, SqlJoin>) => string;
28
28
  export declare const joinsParams: (joins: Map<string, SqlJoin>) => SqlValue[];
29
29
  export declare const relationJoin: (caller: DataCaller, target: DataTable, alias: string, on: string) => SqlJoin;
30
30
  export declare const isoSeconds: (date: Date) => string;
31
+ export declare const fileUriOf: (value: unknown, label: string) => string;
32
+ export declare const unknownFileUris: (uris: string[]) => DataError;
31
33
  export declare const toStored: (table: DataTable, column: ResolvableColumn, value: unknown, timeZone?: string) => SqlValue;
32
34
  export declare const zoneOffsetMinutes: (date: Date, timeZone?: string) => number;
33
35
  export declare const zoned: (iso: string, timeZone?: string) => string;
@@ -44,6 +46,7 @@ export interface CompileContext {
44
46
  table: DataTable;
45
47
  joins: Map<string, SqlJoin>;
46
48
  params: SqlValue[];
49
+ filtered?: Set<string>;
47
50
  }
48
51
  export declare const resolvePath: (ctx: CompileContext, path: unknown) => ResolvedPath;
49
52
  export declare const compileWhere: (ctx: CompileContext, where: unknown, indexed?: Set<string>) => string[];
@@ -1 +1 @@
1
- {"version":3,"file":"dataCompiler.d.ts","sourceRoot":"","sources":["../src/dataCompiler.ts"],"names":[],"mappings":"AAMA,OAAO,EAKL,S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