ab-ecosystem-cpass 1.0.10 → 1.0.11

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.
@@ -58,6 +58,23 @@ import type { HttpClient } from '../http';
58
58
  * is returned -- no host, no user, no connection string -- because there is no
59
59
  * second way in: the API is the only door to those records.
60
60
  *
61
+ * That extends to its failures. On a `self` store an upstream error carries the
62
+ * database's own message, because it is yours and the detail is what you act on
63
+ * (`datastore_auth_failed` with the reason, `datastore_unreachable` pointing at
64
+ * an IP access list). On a `cloud` store every upstream failure is one code --
65
+ * `502 datastore_unavailable`, no details -- because the cluster is the
66
+ * platform's and nothing in that message would be yours to fix. Refusals about
67
+ * *your request* are reported in full either way.
68
+ *
69
+ * ## A record is a row, not a file
70
+ *
71
+ * Records hold structured values. **Files are refused**, in either kind of
72
+ * store: a `data:` URI or base64 that begins with a known file signature comes
73
+ * back `422` however small it is, and every value and every record is capped --
74
+ * see `insert` for the numbers. Put the file in object storage and store its
75
+ * URL, which is cheaper, cacheable, and does not pass through this API on every
76
+ * page read.
77
+ *
61
78
  * Which also means every record call costs a round trip to your database. The
62
79
  * platform keeps the connection open between calls, so that is one query's
63
80
  * latency rather than a fresh TLS handshake each time, but a loop of a thousand
@@ -162,6 +179,7 @@ export declare class DataStores {
162
179
  * | 422 | `invalid_datastore_host` | The host does not resolve, or resolves somewhere private. |
163
180
  * | 502 | `datastore_auth_failed` | The database refused the username or password. |
164
181
  * | 502 | `datastore_unreachable` | No answer in time -- usually an IP access list. |
182
+ * | 502 | `datastore_unavailable` | A `cloud` store only: the platform's cluster did not answer. Nothing for you to fix; retry. |
165
183
  *
166
184
  * Scope: `datastores:write`.
167
185
  */
@@ -402,6 +420,31 @@ export declare class DataStoreCollections {
402
420
  */
403
421
  export declare class DataStoreRecords {
404
422
  private readonly http;
423
+ /**
424
+ * ## What a record may hold
425
+ *
426
+ * Structured values -- text, numbers, booleans, dates, short lists. **Not
427
+ * files.** A record is a row: every read of a page carries every byte of it
428
+ * back through the API, uncached and unstreamed, so one embedded image turns
429
+ * a 25-row page into a response nobody wants. The file belongs in object
430
+ * storage with its URL in the record.
431
+ *
432
+ * Refused with `422 validation_failed`, keyed by the field:
433
+ *
434
+ * | | |
435
+ * | --- | --- |
436
+ * | A `data:` URI | At any size. Unambiguously a file. |
437
+ * | Base64 starting with a file signature | PNG, JPEG, GIF, WebP, PDF, ZIP, MP3, MP4, WebM -- only for values of 64 characters or more, so a short string that happens to start that way is fine. |
438
+ * | A raw file header | `%PDF-`, `GIF89a`, the PNG and JPEG magic bytes, a ZIP header. |
439
+ * | `$binary`, `$uuid`, `$code`, `$function`, `$where` | Extended-JSON keys anywhere inside an `Array` value: binary and stored JavaScript, by another route. |
440
+ * | A value over **16KB** | Serialised. Generous for text, hopeless for media. |
441
+ * | A record over **64KB** | The finished document, so a hundred legal fields cannot add up to an illegal row. |
442
+ * | An array over **1000 items**, or nesting deeper than **8** | A list of options, not a dataset. |
443
+ *
444
+ * The same rules apply to `insert`, `update` and `bulkUpdate`, and to a
445
+ * `cloud` store and your own alike -- the cost is the round trip, which both
446
+ * pay.
447
+ */
405
448
  constructor(http: HttpClient);
406
449
  /**
407
450
  * `POST /v1/datastores/:store/collections/:collection/records` -- 201.
@@ -65,6 +65,23 @@ const recordsPath = (store, collection) => `${collectionPath(store, collection)}
65
65
  * is returned -- no host, no user, no connection string -- because there is no
66
66
  * second way in: the API is the only door to those records.
67
67
  *
68
+ * That extends to its failures. On a `self` store an upstream error carries the
69
+ * database's own message, because it is yours and the detail is what you act on
70
+ * (`datastore_auth_failed` with the reason, `datastore_unreachable` pointing at
71
+ * an IP access list). On a `cloud` store every upstream failure is one code --
72
+ * `502 datastore_unavailable`, no details -- because the cluster is the
73
+ * platform's and nothing in that message would be yours to fix. Refusals about
74
+ * *your request* are reported in full either way.
75
+ *
76
+ * ## A record is a row, not a file
77
+ *
78
+ * Records hold structured values. **Files are refused**, in either kind of
79
+ * store: a `data:` URI or base64 that begins with a known file signature comes
80
+ * back `422` however small it is, and every value and every record is capped --
81
+ * see `insert` for the numbers. Put the file in object storage and store its
82
+ * URL, which is cheaper, cacheable, and does not pass through this API on every
83
+ * page read.
84
+ *
68
85
  * Which also means every record call costs a round trip to your database. The
69
86
  * platform keeps the connection open between calls, so that is one query's
70
87
  * latency rather than a fresh TLS handshake each time, but a loop of a thousand
@@ -171,6 +188,7 @@ class DataStores {
171
188
  * | 422 | `invalid_datastore_host` | The host does not resolve, or resolves somewhere private. |
172
189
  * | 502 | `datastore_auth_failed` | The database refused the username or password. |
173
190
  * | 502 | `datastore_unreachable` | No answer in time -- usually an IP access list. |
191
+ * | 502 | `datastore_unavailable` | A `cloud` store only: the platform's cluster did not answer. Nothing for you to fix; retry. |
174
192
  *
175
193
  * Scope: `datastores:write`.
176
194
  */
@@ -439,6 +457,31 @@ exports.DataStoreCollections = DataStoreCollections;
439
457
  */
440
458
  class DataStoreRecords {
441
459
  http;
460
+ /**
461
+ * ## What a record may hold
462
+ *
463
+ * Structured values -- text, numbers, booleans, dates, short lists. **Not
464
+ * files.** A record is a row: every read of a page carries every byte of it
465
+ * back through the API, uncached and unstreamed, so one embedded image turns
466
+ * a 25-row page into a response nobody wants. The file belongs in object
467
+ * storage with its URL in the record.
468
+ *
469
+ * Refused with `422 validation_failed`, keyed by the field:
470
+ *
471
+ * | | |
472
+ * | --- | --- |
473
+ * | A `data:` URI | At any size. Unambiguously a file. |
474
+ * | Base64 starting with a file signature | PNG, JPEG, GIF, WebP, PDF, ZIP, MP3, MP4, WebM -- only for values of 64 characters or more, so a short string that happens to start that way is fine. |
475
+ * | A raw file header | `%PDF-`, `GIF89a`, the PNG and JPEG magic bytes, a ZIP header. |
476
+ * | `$binary`, `$uuid`, `$code`, `$function`, `$where` | Extended-JSON keys anywhere inside an `Array` value: binary and stored JavaScript, by another route. |
477
+ * | A value over **16KB** | Serialised. Generous for text, hopeless for media. |
478
+ * | A record over **64KB** | The finished document, so a hundred legal fields cannot add up to an illegal row. |
479
+ * | An array over **1000 items**, or nesting deeper than **8** | A list of options, not a dataset. |
480
+ *
481
+ * The same rules apply to `insert`, `update` and `bulkUpdate`, and to a
482
+ * `cloud` store and your own alike -- the cost is the round trip, which both
483
+ * pay.
484
+ */
442
485
  constructor(http) {
443
486
  this.http = http;
444
487
  }
@@ -1 +1 @@
1
- {"version":3,"file":"data-stores.js","sourceRoot":"","sources":["../../src/resources/data-stores.ts"],"names":[],"mappings":";;;AAuBA,mCAAyC;AAEzC,MAAM,IAAI,GAAG,iBAAS,CAAC;AAEvB,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,KAAK,CAAC,EAAE,CAAC;AAC7D,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC;AAC7E,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,UAAkB,EAAE,EAAE,CAC3D,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,IAAA,WAAG,EAAC,UAAU,CAAC,EAAE,CAAC;AACjD,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,UAAkB,EAAE,EAAE,CACxD,GAAG,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,MAAa,UAAU;IACQ;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;;;;;;;;OAWG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAmC,KAAK,EAAE,GAAG,IAAI,gBAAgB,CAAC,CAAC;IAC7F,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC;CACF;AArND,4CAqNC"}
@@ -106,6 +106,28 @@ If a collection cannot be deleted, the call is a `502 datastore_purge_failed`
106
106
  naming it, and **nothing** has been removed: the store and its schemas are
107
107
  intact and the call can be retried once the cause is fixed.
108
108
 
109
+ ## Errors from a cloud store say less, deliberately
110
+
111
+ On a **self** store an upstream failure carries the database's own message,
112
+ because the database is yours and the detail is the part you act on:
113
+
114
+ | Status | Code | |
115
+ | --- | --- | --- |
116
+ | 502 | `datastore_auth_failed` | The credential was refused. `details.reason` is the driver's message. |
117
+ | 502 | `datastore_unreachable` | No answer in time — usually an IP access list. |
118
+
119
+ On a **cloud** store every upstream failure is one code with no details:
120
+
121
+ | Status | Code | |
122
+ | --- | --- | --- |
123
+ | 502 | `datastore_unavailable` | The platform's cluster did not answer. Retry; there is nothing on your side to change. |
124
+
125
+ That is not vagueness for its own sake. Those messages name hosts, replica-set
126
+ members and database users belonging to the platform, none of which you can act
127
+ on and none of which an API should hand out. Refusals about **your request** —
128
+ a validation failure, a unique index, a 404 — are reported in full on both kinds
129
+ of store.
130
+
109
131
  ## What the platform holds
110
132
 
111
133
  For a `self` store, **the credential and the schemas, and nothing else**. There
@@ -353,6 +375,44 @@ does not migrate anything:
353
375
 
354
376
  ---
355
377
 
378
+ ## A record is a row, not a file
379
+
380
+ Records hold structured values. **Files are refused** — in a cloud store and in
381
+ your own alike, because the cost is the round trip and both pay it: every read
382
+ of a page carries every byte back through the API, with no cache and no
383
+ streaming, so one embedded image turns a 25-row page into a response nobody
384
+ wants. It is also storage nobody budgeted for, at a price object storage beats
385
+ by an order of magnitude.
386
+
387
+ So store the URL:
388
+
389
+ ```ts
390
+ // no
391
+ await crm.dataStoreRecords.insert(store.id, collection.id, {
392
+ record: { name: 'Badge', image: 'data:image/png;base64,iVBORw0KGgo…' },
393
+ });
394
+ // → 422 validation_failed { image: ["This looks like a file. …store its URL here"] }
395
+
396
+ // yes
397
+ await crm.dataStoreRecords.insert(store.id, collection.id, {
398
+ record: { name: 'Badge', image: 'https://cdn.example.com/badges/42.png' },
399
+ });
400
+ ```
401
+
402
+ What gets refused, with `422 validation_failed` keyed by the field:
403
+
404
+ | | |
405
+ | --- | --- |
406
+ | A `data:` URI | At any size — it can only be a file. |
407
+ | Base64 beginning with a file signature | PNG, JPEG, GIF, WebP, PDF, ZIP, MP3, MP4, WebM. Only checked on values of 64 characters or more, so a short string that happens to start that way is fine. |
408
+ | A raw file header | `%PDF-`, `GIF89a`, the PNG and JPEG magic bytes, a ZIP header. |
409
+ | `$binary`, `$uuid`, `$code`, `$function`, `$where` | Extended-JSON keys anywhere inside an `Array` value — binary and stored JavaScript by another route. |
410
+ | A value over **16KB** | Serialised. Roughly four thousand words in one field. |
411
+ | A record over **64KB** | The finished document, so a hundred legal fields cannot add up to an illegal row. |
412
+ | An array over **1000 items**, or nested deeper than **8** | A list of options, not a dataset. |
413
+
414
+ `insert`, `update` and `bulkUpdate` all go through the same check.
415
+
356
416
  ## Records
357
417
 
358
418
  Documents in your database.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-ecosystem-cpass",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "JavaScript/TypeScript SDK for the CPaaS CRM gateway: audience and channels",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",