@ai-matrx/records 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog — @ai-matrx/records
2
2
 
3
+ ## 0.27.0
4
+
5
+ **"Give me a board of deals by stage" — the rules that judge every move become
6
+ something a screen can ask about before the finger lets go.**
7
+
8
+ A pipeline is not a new kind of thing and this release adds none. It is a Choice
9
+ Field a Table names as its stage field, plus transition Rules of the ONE Rule
10
+ object — so a move is an ordinary record write the store judges, History records
11
+ because it IS a write, and every surface already knows how to read.
12
+
13
+ `src/pipeline.ts`: `Pipeline`, `PipelineStage`, `PipelineRule`, `PipelineColumn`,
14
+ `PipelineVerdict`, `PipelineMissingField`, `PipelineDeclared`, `PipelineSpec`.
15
+
16
+ Six client methods, each one door: `pipelineRead`, `pipelineBoard`,
17
+ `pipelineTransitionRefusal`, `pipelineMove`, `pipelineDeclare`, `tableStageField`.
18
+
19
+ THIS PACKAGE ENFORCES NOTHING, and that is the point. `pipelineTransitionRefusal`
20
+ asks the store the same question the write will ask — the same Rules, through the
21
+ same evaluator, on the document the move WOULD produce — and hands back the store's
22
+ own sentence plus, when a stage demands columns that are empty, exactly which ones.
23
+ A board that decided in the browser would be a second opinion with nothing keeping
24
+ it equal to the first, and it would be the comfortable one, because it is the one
25
+ nobody can be refused by.
26
+
27
+ `mayDrag(level)` is the one thing this package DOES decide, and it is about the
28
+ person, not the rules: a viewer's card carries no drag handle at all rather than
29
+ one that looks live and snaps back every time.
30
+
3
31
  ## 0.26.0
4
32
 
5
33
  **"Text me on a new lead; email me a Monday summary" — the second half of that
@@ -53,6 +53,7 @@ __export(core_exports, {
53
53
  PARITY_FIELD_TYPES: () => PARITY_FIELD_TYPES,
54
54
  PERMISSION_LEVELS: () => PERMISSION_LEVELS,
55
55
  PER_VALUE_ACCESS_WORDS: () => PER_VALUE_ACCESS_WORDS,
56
+ PIPELINE_RULE_KINDS: () => PIPELINE_RULE_KINDS,
56
57
  REFUSALS_WORTH_REPEATING: () => REFUSALS_WORTH_REPEATING,
57
58
  RELATION_BINDINGS: () => RELATION_BINDINGS,
58
59
  RELATION_CARDINALITIES: () => RELATION_CARDINALITIES,
@@ -94,6 +95,7 @@ __export(core_exports, {
94
95
  isTheChosen: () => isTheChosen,
95
96
  looksLikeAnId: () => looksLikeAnId,
96
97
  mapPgError: () => mapPgError,
98
+ mayDrag: () => mayDrag,
97
99
  measureKey: () => measureKey,
98
100
  memoryStore: () => memoryStore,
99
101
  mintClientKey: () => mintClientKey,
@@ -242,6 +244,12 @@ function looksLikeAnId(value) {
242
244
  return typeof value === "string" && UUID.test(value);
243
245
  }
244
246
 
247
+ // src/pipeline.ts
248
+ var PIPELINE_RULE_KINDS = ["moves", "requires", "who", "limit", "entry"];
249
+ function mayDrag(level) {
250
+ return level === "editor" || level === "admin" || level === "owner";
251
+ }
252
+
245
253
  // src/rule.ts
246
254
  function publicFormPath(formId) {
247
255
  return `/f/${formId}`;
@@ -2354,6 +2362,12 @@ var DOORS = {
2354
2362
  tableKernelId: "table_kernel_id",
2355
2363
  // A saved view references its membership Rule, and the STORE decides who is
2356
2364
  // in it — the screen never re-implements the predicate.
2365
+ pipelineDeclare: "pipeline_declare",
2366
+ pipelineRead: "pipeline_read",
2367
+ pipelineBoard: "pipeline_board",
2368
+ pipelineTransitionRefusal: "pipeline_transition_refusal",
2369
+ pipelineMove: "pipeline_move",
2370
+ tableStageField: "table_stage_field",
2357
2371
  ruleMembers: "rule_members",
2358
2372
  ruleMembership: "rule_membership",
2359
2373
  ruleRun: "rule_run",
@@ -3153,6 +3167,54 @@ function createRecordsClient(config) {
3153
3167
  async ruleKernelId() {
3154
3168
  return callDoor(DOORS.ruleKernelId, {}, "ruleKernelId");
3155
3169
  },
3170
+ async pipelineRead({ table_id }) {
3171
+ return callDoor(
3172
+ DOORS.pipelineRead,
3173
+ { p_organization_id: org, p_table_id: table_id },
3174
+ "pipelineRead"
3175
+ );
3176
+ },
3177
+ async pipelineBoard({ table_id, measure }) {
3178
+ return callDoor(
3179
+ DOORS.pipelineBoard,
3180
+ { p_organization_id: org, p_table_id: table_id, p_measure: measure ?? null },
3181
+ "pipelineBoard"
3182
+ );
3183
+ },
3184
+ async pipelineTransitionRefusal({ record_id, to }) {
3185
+ return callDoor(
3186
+ DOORS.pipelineTransitionRefusal,
3187
+ { p_organization_id: org, p_record_id: record_id, p_to: to },
3188
+ "pipelineTransitionRefusal"
3189
+ );
3190
+ },
3191
+ async pipelineMove({ record_id, to, also, expected_version }) {
3192
+ return callDoor(
3193
+ DOORS.pipelineMove,
3194
+ {
3195
+ p_organization_id: org,
3196
+ p_record_id: record_id,
3197
+ p_to: to,
3198
+ p_also: also ?? {},
3199
+ p_expected_version: expected_version ?? null
3200
+ },
3201
+ "pipelineMove"
3202
+ );
3203
+ },
3204
+ async pipelineDeclare({ table_id, spec }) {
3205
+ return callDoor(
3206
+ DOORS.pipelineDeclare,
3207
+ { p_organization_id: org, p_table_id: table_id, p_spec: spec },
3208
+ "pipelineDeclare"
3209
+ );
3210
+ },
3211
+ async tableStageField({ table_id }) {
3212
+ return callDoor(
3213
+ DOORS.tableStageField,
3214
+ { p_organization_id: org, p_table_id: table_id },
3215
+ "tableStageField"
3216
+ );
3217
+ },
3156
3218
  async ruleMembers({ rule_id }) {
3157
3219
  return callDoor(
3158
3220
  DOORS.ruleMembers,