@collective-intelligence/extensions-sdk 0.1.17 → 0.1.18

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/README.md CHANGED
@@ -452,9 +452,8 @@ Users; every other User field accepts Organization members only.
452
452
 
453
453
  At most one User field per schema sets `accounts: true`
454
454
  (`accounts: { accounts: true, multiple: true }`). It becomes the schema's
455
- accounts field: the users it lists act for the record, and the host adds the
456
- record to their policy subject's `linkedCompanyIds` in place of company links
457
- for that schema.
455
+ accounts field: the users it lists act for the record. Only the host writes
456
+ it, and a policy can read it as `resource` path `["data", "accounts"]`.
458
457
 
459
458
  `declareKnowledgeEntitySchema` declares File fields in `fileFields`, keyed by
460
459
  top-level property key. Each declaration takes `multiple`, `accepts` (matched
@@ -2168,12 +2167,12 @@ and authorized Organization reader UUID. Knowledge policies use the native
2168
2167
  `{ subjectMatch, rule? }` AST, including recursive comparisons and logical
2169
2168
  predicates. The old `{ version, rules }` shape is rejected. `subject` refs read
2170
2169
  the caller as CI built it: `user.id`, `user.role` (organization membership
2171
- role), `groupIds`, `linkedCompanyIds` and `access`. CI sets `access` to `"read"`
2170
+ role), `groupIds` and `access`. CI sets `access` to `"read"`
2172
2171
  for get, list, search, facets, autocomplete, traverse and retrieval, and to
2173
2172
  `"write"` for create, update, delete and relation writes; a policy that does not
2174
2173
  test it applies to both. For example, this `deny` `filter` policy lets
2175
- `member`-role users read every company but write only the ones they are linked
2176
- to:
2174
+ `member`-role users read every company but write only the ones whose accounts
2175
+ field lists them:
2177
2176
 
2178
2177
  ```ts
2179
2178
  const memberCompanyWrites = declareKnowledgePolicy({
@@ -2207,8 +2206,8 @@ const memberCompanyWrites = declareKnowledgePolicy({
2207
2206
  op: "not",
2208
2207
  arg: {
2209
2208
  op: "in",
2210
- value: { kind: "resource", path: ["id"] },
2211
- set: { kind: "subject", path: ["linkedCompanyIds"] }
2209
+ value: { kind: "subject", path: ["user", "id"] },
2210
+ set: { kind: "resource", path: ["data", "accounts"] }
2212
2211
  }
2213
2212
  }
2214
2213
  }
@@ -30,8 +30,7 @@ export type KnowledgeFileFieldDeclaration = KnowledgeFileField & Readonly<{
30
30
  * Explicit top-level references to Organization members or External App Users
31
31
  * of the Organization; the host generates UUID values. `accounts: true` makes
32
32
  * it the schema's accounts field (at most one per schema): the users it lists
33
- * act for the record, and the record is among their policy subject's
34
- * `linkedCompanyIds`.
33
+ * act for the record. Only the host writes it.
35
34
  */
36
35
  export type KnowledgeUserField = Readonly<{
37
36
  accounts?: true;
@@ -270,15 +269,15 @@ export type KnowledgePolicyPredicate = Readonly<{
270
269
  /**
271
270
  * A Knowledge policy: `subjectMatch` selects whom it applies to, `rule` which
272
271
  * records. `subject` refs read the caller as CI built it: `user.id`,
273
- * `user.role` (the organization membership role), `groupIds`,
274
- * `linkedCompanyIds` (the user's linked company entities) and `access`.
272
+ * `user.role` (the organization membership role), `groupIds` and `access`.
275
273
  * `access` is `"read"` for get, list, search, facets, autocomplete, traverse
276
274
  * and retrieval, and `"write"` for create, update, delete and relation writes;
277
275
  * the deciding operation sets it, never the caller. A policy that does not
278
276
  * test `access` applies to both. `resource` refs read `["id"]` or a `data`
279
277
  * path.
280
278
  *
281
- * Write-only deny: members read every company but write only linked ones.
279
+ * Write-only deny: members read every company but write only the ones whose
280
+ * accounts field lists them.
282
281
  *
283
282
  * ```ts
284
283
  * const memberCompanyWrites: KnowledgePolicyBody = {
@@ -291,7 +290,7 @@ export type KnowledgePolicyPredicate = Readonly<{
291
290
  * },
292
291
  * rule: {
293
292
  * op: "not",
294
- * arg: { op: "in", value: { kind: "resource", path: ["id"] }, set: { kind: "subject", path: ["linkedCompanyIds"] } }
293
+ * arg: { op: "in", value: { kind: "subject", path: ["user", "id"] }, set: { kind: "resource", path: ["data", "accounts"] } }
295
294
  * }
296
295
  * }
297
296
  * ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collective-intelligence/extensions-sdk",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "Framework-neutral authoring contracts for Collective Intelligence extension packages.",
5
5
  "type": "module",
6
6
  "sideEffects": false,