@sixb/pg 0.2.1 → 0.2.2

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 (44) hide show
  1. package/README.md +9 -8
  2. package/dist/agents/computers.d.ts +8 -2
  3. package/dist/agents/computers.d.ts.map +1 -1
  4. package/dist/index.js +559 -138
  5. package/dist/index.js.map +18 -15
  6. package/dist/migrations.d.ts.map +1 -1
  7. package/dist/objects/conditional-reader.d.ts +7 -2
  8. package/dist/objects/conditional-reader.d.ts.map +1 -1
  9. package/dist/objects/partitions.d.ts.map +1 -1
  10. package/dist/objects/prepare-queries.d.ts.map +1 -1
  11. package/dist/objects/query-compiler.d.ts +14 -1
  12. package/dist/objects/query-compiler.d.ts.map +1 -1
  13. package/dist/objects/query-indexes.d.ts +13 -1
  14. package/dist/objects/query-indexes.d.ts.map +1 -1
  15. package/dist/objects/read-scope.d.ts.map +1 -1
  16. package/dist/objects/reader.d.ts +14 -1
  17. package/dist/objects/reader.d.ts.map +1 -1
  18. package/dist/objects/storage.d.ts +1 -0
  19. package/dist/objects/storage.d.ts.map +1 -1
  20. package/dist/objects/visibility-indexes.d.ts +22 -0
  21. package/dist/objects/visibility-indexes.d.ts.map +1 -0
  22. package/dist/objects/visibility-statistics.d.ts +26 -0
  23. package/dist/objects/visibility-statistics.d.ts.map +1 -0
  24. package/dist/objects/visibility.d.ts +34 -0
  25. package/dist/objects/visibility.d.ts.map +1 -0
  26. package/dist/pg-client.d.ts.map +1 -1
  27. package/package.json +3 -3
  28. package/src/agents/computers.ts +54 -5
  29. package/src/migrations/087-agent-computer-background-commands.sql +4 -0
  30. package/src/migrations/088-web-search-model-kind.sql +12 -0
  31. package/src/migrations.ts +6 -0
  32. package/src/objects/conditional-reader.ts +26 -4
  33. package/src/objects/partitions.ts +17 -4
  34. package/src/objects/prepare-queries.ts +8 -3
  35. package/src/objects/query-compiler.ts +64 -23
  36. package/src/objects/query-indexes.ts +93 -27
  37. package/src/objects/read-scope.ts +147 -77
  38. package/src/objects/reader.ts +46 -18
  39. package/src/objects/storage.ts +4 -0
  40. package/src/objects/visibility-indexes.ts +222 -0
  41. package/src/objects/visibility-statistics.ts +73 -0
  42. package/src/objects/visibility.ts +135 -0
  43. package/src/ontology-storage/materializations.ts +3 -1
  44. package/src/pg-client.ts +4 -0
package/README.md CHANGED
@@ -124,12 +124,7 @@ const User = defineObjectType({
124
124
  ],
125
125
  query: {
126
126
  indexes: [
127
- { kind: "sort", fields: [{ propertyId: "createdAt", direction: "desc" }] },
128
- {
129
- kind: "sort",
130
- fields: [{ propertyId: "createdAt", direction: "desc" }],
131
- filters: ["status"],
132
- },
127
+ { kind: "sort", fields: [{ propertyId: "createdAt" }], filters: ["status"] },
133
128
  { kind: "text", propertyId: "searchText", filters: ["status"] },
134
129
  ],
135
130
  },
@@ -172,10 +167,14 @@ Custom runtimes can opt into the same lifecycle with:
172
167
  await migrateStorage(storage, {
173
168
  projectId: sixb.id,
174
169
  ontology: sixb.definitions.ontology,
170
+ security: sixb.definitions.security,
175
171
  })
176
172
  ```
177
173
 
178
- Passing only `storage` retains schema-only migration. Providers without query preparation,
174
+ `security` lets preparation index the roles' view conditions; without it, the indexes an earlier
175
+ preparation built for them stay as they are. A member's ordered page walks a sort index, unless
176
+ the statistics on those conditions list none of the member's keys: such a member sees few objects,
177
+ which their page reads first through the condition's index, then sorts. Passing only `storage` retains schema-only migration. Providers without query preparation,
179
178
  including SQLite and in-memory storage, continue normally; explicitly calling
180
179
  `prepareObjectQueries` or `db prepare` on them reports the unsupported capability.
181
180
 
@@ -213,7 +212,9 @@ application configuration should use ontology declarations.
213
212
  ### Pages, search and totals
214
213
 
215
214
  Use `list({ includeTotal: false })` for independently loaded pages. Existing cursor pagination
216
- uses ordered index ranges, including deep pages. Incoming relationship pages can choose an ordered
215
+ uses ordered index ranges, including deep pages. A one-field sort index serves both directions: a
216
+ descending sort breaks ties in reverse identity order, so its page is the ascending index read
217
+ backwards, in two ranges, values then nulls, since nulls sort last either way. Incoming relationship pages can choose an ordered
217
218
  endpoint scan after a bounded fanout probe; aggregates use their own execution plan.
218
219
 
219
220
  Search remains literal, case-insensitive substring search, including `%`, `_` and `\` characters.
@@ -1,9 +1,15 @@
1
- import type { AgentComputerSessionRecord, AgentComputerSessionStore, Principal } from "@sixb/core/storage";
1
+ import type { AgentBackgroundCommandRef, AgentComputerSessionRecord, AgentComputerSessionStore, Principal } from "@sixb/core/storage";
2
2
  import type { PgStoreClient } from "../transactions";
3
3
  export declare class PgAgentComputerSessionStore implements AgentComputerSessionStore {
4
4
  private readonly sql;
5
5
  constructor(sql: PgStoreClient);
6
- hold(input: AgentComputerSessionRecord): Promise<void>;
6
+ hold(input: Omit<AgentComputerSessionRecord, "stopRequests">): Promise<void>;
7
+ requestStop(input: {
8
+ readonly projectId: string;
9
+ readonly id: string;
10
+ readonly ownerPrincipal: Principal;
11
+ readonly command: AgentBackgroundCommandRef;
12
+ }): Promise<AgentComputerSessionRecord | null>;
7
13
  release(input: {
8
14
  readonly projectId: string;
9
15
  readonly id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"computers.d.ts","sourceRoot":"","sources":["../../src/agents/computers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,SAAS,EACV,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAapD,qBAAa,2BAA4B,YAAW,yBAAyB;IAC/D,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEzC,IAAI,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBtD,OAAO,CAAC,KAAK,EAAE;QACnB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;QACnB,QAAQ,CAAC,cAAc,EAAE,SAAS,CAAA;KACnC,GAA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