Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x | /**
* System Constants
*
* Shared constants used across Lambda functions
*/
/**
* Reserved entity IDs that cannot be used for user-created entities
* These correspond to system entities with hardcoded schemas
*/
const RESERVED_ENTITY_IDS = ['entity', 'role', 'user']
/**
* Default visibility levels for entities. `restricted` entities ignore entity
* wildcards and flat shorthands — see PermissionChecker.permissionsGrant.
*/
const VISIBILITY_LEVELS = ['flow-members', 'restricted', 'public']
/**
* Maximum number of line breaks allowed in an entity description
*/
const MAX_DESCRIPTION_NEWLINES = 4
/**
* Item-count threshold above which items/list.js routes structured field
* filters through the FieldValueIndexTable instead of fetching every item
* and filtering in memory. Deliberately a single tunable constant.
*/
const LARGE_ENTITY_ITEM_THRESHOLD = 1000
/**
* Upper bound on how many item ids a large-entity indexed filter query will
* examine/intersect, to keep a low-selectivity filter (e.g. a common boolean
* value) from degenerating into an unbounded scan of the FieldValueIndexTable.
*/
const MAX_FILTER_INDEX_RESULTS = 5000
/**
* Same purpose as MAX_FILTER_INDEX_RESULTS, for the Catalog search index
* (see utils/catalogSearchIndex.js) — bounds how many entity ids a search's
* seed-trigram query will examine before reporting `truncated: true`.
*/
const MAX_CATALOG_SEARCH_INDEX_RESULTS = 5000
/**
* Same purpose again, for the users/flows directory search index (see
* utils/directorySearchIndex.js) — bounds how many subject ids one seed-trigram
* query reads before reporting `truncated: true`.
*/
const MAX_DIRECTORY_SEARCH_INDEX_RESULTS = 5000
/**
* Maximum number of field definitions on a single entity, and of forms
* derived from them. Bounds what a single entities/create|update request can
* cost (schema size, downstream item-write cost) — see
* docs/architecture/USAGE_METERING.md "Bounding storage before it can be priced".
*/
const MAX_ENTITY_FIELDS = 100
const MAX_ENTITY_FORMS = 50
/**
* Ceiling on an item's serialized `data` size, comfortably under DynamoDB's
* hard 400KB item limit — leaves headroom for `id`/`entityId`/`flowId`/
* timestamps and DynamoDB's own per-attribute-name overhead, so a write that
* would otherwise fail with an opaque ValidationException instead gets a
* clean 400 here. See docs/architecture/USAGE_METERING.md "Bounding storage
* before it can be priced".
*/
const MAX_ITEM_SIZE_BYTES = 350 * 1024
/**
* Ceiling on an entity's serialized `fields` + `forms` size — the same
* mechanics as MAX_ITEM_SIZE_BYTES, but for the schema itself: MAX_ENTITY_FIELDS/
* MAX_ENTITY_FORMS bound how many field/form definitions an entity can have,
* not how large any individual one (options lists, labels, descriptions...)
* can be. See docs/architecture/USAGE_METERING.md "Bounding storage before
* it can be priced".
*/
const MAX_ENTITY_SIZE_BYTES = 350 * 1024
/**
* Ceiling on a flow's serialized `settings` size — the same mechanics as
* MAX_ITEM_SIZE_BYTES/MAX_ENTITY_SIZE_BYTES, but for a flow's one open-ended,
* client-supplied field (name/slug/description are already bounded
* elsewhere). See docs/architecture/USAGE_METERING.md "Bounding storage
* before it can be priced".
*/
const MAX_FLOW_SETTINGS_BYTES = 50 * 1024
/**
* Ceiling on a single direct-message body — a chat message, not a document,
* so bounded much tighter than MAX_ITEM_SIZE_BYTES/MAX_ENTITY_SIZE_BYTES.
*/
const MAX_MESSAGE_BODY_BYTES = 10 * 1024
/**
* How many direct-message requests (first message to a user one is not
* connected with, see utils/directMessages.js) one user can send per UTC day
* — the brake on sending unsolicited messages in bulk.
*/
const MAX_DAILY_MESSAGE_REQUESTS = 20
/**
* A comment is a short remark, not a document: capped at 256 characters
* (counted as Unicode code points, what the user sees in the counter) and, as
* a safety net for multi-byte scripts and emoji, at MAX_COMMENT_BODY_BYTES —
* 256 four-byte code points fit in exactly 1KB.
*/
const MAX_COMMENT_LENGTH = 256
const MAX_COMMENT_BODY_BYTES = 1024
const COMMENTS_DEFAULT_PAGE_SIZE = 20
const COMMENTS_MAX_PAGE_SIZE = 50
module.exports = {
RESERVED_ENTITY_IDS,
VISIBILITY_LEVELS,
MAX_DESCRIPTION_NEWLINES,
LARGE_ENTITY_ITEM_THRESHOLD,
MAX_FILTER_INDEX_RESULTS,
MAX_CATALOG_SEARCH_INDEX_RESULTS,
MAX_DIRECTORY_SEARCH_INDEX_RESULTS,
MAX_ENTITY_FIELDS,
MAX_ENTITY_FORMS,
MAX_ITEM_SIZE_BYTES,
MAX_ENTITY_SIZE_BYTES,
MAX_FLOW_SETTINGS_BYTES,
MAX_MESSAGE_BODY_BYTES,
MAX_DAILY_MESSAGE_REQUESTS,
MAX_COMMENT_LENGTH,
MAX_COMMENT_BODY_BYTES,
COMMENTS_DEFAULT_PAGE_SIZE,
COMMENTS_MAX_PAGE_SIZE
}
|