@geonosis/document 0.4.0 → 0.4.1
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 +9 -0
- package/dist/index.d.cts +21 -21
- package/dist/index.d.ts +21 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @geonosis/document
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cdc88fc: `documentStore<Map, Key, Handle = Executor>({ seam: SessionSeam<Key, Handle> })` — every door and
|
|
8
|
+
both undos are typed over the consumer's own handle, the way `defineEntity`, `defineLog` and
|
|
9
|
+
`projectionOf` already are; a seam opened over a drizzle database hands in without a cast (#433).
|
|
10
|
+
`DocumentStore` and `DocumentStoreOptions` gain the third type parameter.
|
|
11
|
+
|
|
3
12
|
## 0.4.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
export { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
-
import { EntityColumns, EntityName, FreezeRegister, TenantPolicyNames, SessionSettings, EntityMigration,
|
|
3
|
+
import { EntityColumns, EntityName, FreezeRegister, TenantPolicyNames, SessionSettings, EntityMigration, Executor, Projection, Query, EntityListing, EntityPage, EntityUndo, SessionSeam } from '@geonosis/db';
|
|
4
4
|
export { ENTITY_PLACEHOLDERS as DOCUMENT_MIGRATION_PLACEHOLDERS } from '@geonosis/db';
|
|
5
5
|
|
|
6
6
|
declare const BODY_VERSION_KEY = "_v";
|
|
@@ -304,13 +304,13 @@ type StorableDocumentEntity = AnyDocumentEntity & {
|
|
|
304
304
|
prepare: (body: never) => unknown;
|
|
305
305
|
};
|
|
306
306
|
type Registry$1<Map extends Readonly<Record<string, StorableDocumentEntity>>> = ReturnType<typeof documentEntities<Map>>;
|
|
307
|
-
type DocumentStoreOptions<Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string> = {
|
|
307
|
+
type DocumentStoreOptions<Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string, Handle = Executor> = {
|
|
308
308
|
archive?: ArchivePort;
|
|
309
309
|
columns?: DocumentColumns;
|
|
310
310
|
registry: Registry$1<Map>;
|
|
311
311
|
revisions?: DocumentRevisionsOptions | false;
|
|
312
312
|
schema?: string;
|
|
313
|
-
seam: SessionSeam<Key,
|
|
313
|
+
seam: SessionSeam<Key, Handle>;
|
|
314
314
|
table?: string;
|
|
315
315
|
};
|
|
316
316
|
type HeadColumn = HeadField | 'entity' | 'number';
|
|
@@ -403,63 +403,63 @@ type VerifyResult = {
|
|
|
403
403
|
ok: true;
|
|
404
404
|
versions: number;
|
|
405
405
|
};
|
|
406
|
-
type DocumentEntityStore<Key extends string> = Pick<Projection<unknown, Item, Key, 'ref',
|
|
406
|
+
type DocumentEntityStore<Key extends string, Handle> = Pick<Projection<unknown, Item, Key, 'ref', Handle, string, string>, 'get' | 'listAll'> & {
|
|
407
407
|
asOf: Query<Readonly<Record<Key, string>> & {
|
|
408
408
|
at: number;
|
|
409
409
|
ref: string;
|
|
410
|
-
}, Item | null,
|
|
410
|
+
}, Item | null, Handle>;
|
|
411
411
|
at: Query<Readonly<Record<Key, string>> & {
|
|
412
412
|
ref: string;
|
|
413
413
|
version: number;
|
|
414
|
-
}, Item | null,
|
|
414
|
+
}, Item | null, Handle>;
|
|
415
415
|
commit: Query<Readonly<Record<Key, string>> & {
|
|
416
416
|
actor: string;
|
|
417
417
|
body: unknown;
|
|
418
418
|
reason?: string;
|
|
419
419
|
ref: string;
|
|
420
|
-
}, CommitOutput,
|
|
420
|
+
}, CommitOutput, Handle>;
|
|
421
421
|
history: Query<Readonly<Record<Key, string>> & {
|
|
422
422
|
lineage?: number;
|
|
423
423
|
ref: string;
|
|
424
|
-
}, HistoryEntry[],
|
|
425
|
-
list: Query<Readonly<Record<Key, string>> & EntityListing<DocumentSortColumn, HeadField>, EntityPage<Item>,
|
|
424
|
+
}, HistoryEntry[], Handle>;
|
|
425
|
+
list: Query<Readonly<Record<Key, string>> & EntityListing<DocumentSortColumn, HeadField>, EntityPage<Item>, Handle>;
|
|
426
426
|
reinstate: Query<Readonly<Record<Key, string>> & {
|
|
427
427
|
actor: string;
|
|
428
428
|
reason?: string;
|
|
429
429
|
ref: string;
|
|
430
|
-
}, ReinstateOutput,
|
|
430
|
+
}, ReinstateOutput, Handle>;
|
|
431
431
|
retire: Query<Readonly<Record<Key, string>> & {
|
|
432
432
|
actor: string;
|
|
433
433
|
reason?: string;
|
|
434
434
|
ref: string;
|
|
435
|
-
}, RetireOutput,
|
|
435
|
+
}, RetireOutput, Handle>;
|
|
436
436
|
succeed: Query<Readonly<Record<Key, string>> & {
|
|
437
437
|
actor: string;
|
|
438
438
|
body: unknown;
|
|
439
439
|
reason?: string;
|
|
440
440
|
ref: string;
|
|
441
|
-
}, CommitOutput,
|
|
441
|
+
}, CommitOutput, Handle>;
|
|
442
442
|
undos: {
|
|
443
|
-
commit: EntityUndo<CommitOutput,
|
|
444
|
-
retire: EntityUndo<RetireOutput,
|
|
443
|
+
commit: EntityUndo<CommitOutput, Handle>;
|
|
444
|
+
retire: EntityUndo<RetireOutput, Handle>;
|
|
445
445
|
};
|
|
446
446
|
verify: Query<Readonly<Record<Key, string>> & {
|
|
447
447
|
lineage?: number;
|
|
448
448
|
ref: string;
|
|
449
|
-
}, VerifyResult,
|
|
449
|
+
}, VerifyResult, Handle>;
|
|
450
450
|
};
|
|
451
|
-
type DocumentStore<Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string> = {
|
|
452
|
-
[Name in keyof Map & string]: DocumentEntityStore<Key>;
|
|
451
|
+
type DocumentStore<Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string, Handle = Executor> = {
|
|
452
|
+
[Name in keyof Map & string]: DocumentEntityStore<Key, Handle>;
|
|
453
453
|
} & {
|
|
454
|
-
aggregate: Query<Readonly<Record<Key, string>> & AggregateArgs, AggregateRow[],
|
|
455
|
-
heads: <Columns extends readonly HeadColumn[]>(handle:
|
|
454
|
+
aggregate: Query<Readonly<Record<Key, string>> & AggregateArgs, AggregateRow[], Handle>;
|
|
455
|
+
heads: <Columns extends readonly HeadColumn[]>(handle: Handle, params: Readonly<Record<Key, string>> & HeadsArgs<Columns>) => Promise<HeadRow<Columns>[]>;
|
|
456
456
|
rebuild: Query<Readonly<Record<Key, string>> & {
|
|
457
457
|
entity?: string;
|
|
458
458
|
}, {
|
|
459
459
|
rows: number;
|
|
460
|
-
},
|
|
460
|
+
}, Handle>;
|
|
461
461
|
};
|
|
462
|
-
declare const documentStore: <Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string>(options: DocumentStoreOptions<Map, Key>) => DocumentStore<Map, Key>;
|
|
462
|
+
declare const documentStore: <Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string, Handle = Executor>(options: DocumentStoreOptions<Map, Key, Handle>) => DocumentStore<Map, Key, Handle>;
|
|
463
463
|
|
|
464
464
|
type SurfaceVerb = 'query' | 'mutation';
|
|
465
465
|
type SurfaceScope = 'org' | 'public' | 'token';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
export { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
-
import { EntityColumns, EntityName, FreezeRegister, TenantPolicyNames, SessionSettings, EntityMigration,
|
|
3
|
+
import { EntityColumns, EntityName, FreezeRegister, TenantPolicyNames, SessionSettings, EntityMigration, Executor, Projection, Query, EntityListing, EntityPage, EntityUndo, SessionSeam } from '@geonosis/db';
|
|
4
4
|
export { ENTITY_PLACEHOLDERS as DOCUMENT_MIGRATION_PLACEHOLDERS } from '@geonosis/db';
|
|
5
5
|
|
|
6
6
|
declare const BODY_VERSION_KEY = "_v";
|
|
@@ -304,13 +304,13 @@ type StorableDocumentEntity = AnyDocumentEntity & {
|
|
|
304
304
|
prepare: (body: never) => unknown;
|
|
305
305
|
};
|
|
306
306
|
type Registry$1<Map extends Readonly<Record<string, StorableDocumentEntity>>> = ReturnType<typeof documentEntities<Map>>;
|
|
307
|
-
type DocumentStoreOptions<Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string> = {
|
|
307
|
+
type DocumentStoreOptions<Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string, Handle = Executor> = {
|
|
308
308
|
archive?: ArchivePort;
|
|
309
309
|
columns?: DocumentColumns;
|
|
310
310
|
registry: Registry$1<Map>;
|
|
311
311
|
revisions?: DocumentRevisionsOptions | false;
|
|
312
312
|
schema?: string;
|
|
313
|
-
seam: SessionSeam<Key,
|
|
313
|
+
seam: SessionSeam<Key, Handle>;
|
|
314
314
|
table?: string;
|
|
315
315
|
};
|
|
316
316
|
type HeadColumn = HeadField | 'entity' | 'number';
|
|
@@ -403,63 +403,63 @@ type VerifyResult = {
|
|
|
403
403
|
ok: true;
|
|
404
404
|
versions: number;
|
|
405
405
|
};
|
|
406
|
-
type DocumentEntityStore<Key extends string> = Pick<Projection<unknown, Item, Key, 'ref',
|
|
406
|
+
type DocumentEntityStore<Key extends string, Handle> = Pick<Projection<unknown, Item, Key, 'ref', Handle, string, string>, 'get' | 'listAll'> & {
|
|
407
407
|
asOf: Query<Readonly<Record<Key, string>> & {
|
|
408
408
|
at: number;
|
|
409
409
|
ref: string;
|
|
410
|
-
}, Item | null,
|
|
410
|
+
}, Item | null, Handle>;
|
|
411
411
|
at: Query<Readonly<Record<Key, string>> & {
|
|
412
412
|
ref: string;
|
|
413
413
|
version: number;
|
|
414
|
-
}, Item | null,
|
|
414
|
+
}, Item | null, Handle>;
|
|
415
415
|
commit: Query<Readonly<Record<Key, string>> & {
|
|
416
416
|
actor: string;
|
|
417
417
|
body: unknown;
|
|
418
418
|
reason?: string;
|
|
419
419
|
ref: string;
|
|
420
|
-
}, CommitOutput,
|
|
420
|
+
}, CommitOutput, Handle>;
|
|
421
421
|
history: Query<Readonly<Record<Key, string>> & {
|
|
422
422
|
lineage?: number;
|
|
423
423
|
ref: string;
|
|
424
|
-
}, HistoryEntry[],
|
|
425
|
-
list: Query<Readonly<Record<Key, string>> & EntityListing<DocumentSortColumn, HeadField>, EntityPage<Item>,
|
|
424
|
+
}, HistoryEntry[], Handle>;
|
|
425
|
+
list: Query<Readonly<Record<Key, string>> & EntityListing<DocumentSortColumn, HeadField>, EntityPage<Item>, Handle>;
|
|
426
426
|
reinstate: Query<Readonly<Record<Key, string>> & {
|
|
427
427
|
actor: string;
|
|
428
428
|
reason?: string;
|
|
429
429
|
ref: string;
|
|
430
|
-
}, ReinstateOutput,
|
|
430
|
+
}, ReinstateOutput, Handle>;
|
|
431
431
|
retire: Query<Readonly<Record<Key, string>> & {
|
|
432
432
|
actor: string;
|
|
433
433
|
reason?: string;
|
|
434
434
|
ref: string;
|
|
435
|
-
}, RetireOutput,
|
|
435
|
+
}, RetireOutput, Handle>;
|
|
436
436
|
succeed: Query<Readonly<Record<Key, string>> & {
|
|
437
437
|
actor: string;
|
|
438
438
|
body: unknown;
|
|
439
439
|
reason?: string;
|
|
440
440
|
ref: string;
|
|
441
|
-
}, CommitOutput,
|
|
441
|
+
}, CommitOutput, Handle>;
|
|
442
442
|
undos: {
|
|
443
|
-
commit: EntityUndo<CommitOutput,
|
|
444
|
-
retire: EntityUndo<RetireOutput,
|
|
443
|
+
commit: EntityUndo<CommitOutput, Handle>;
|
|
444
|
+
retire: EntityUndo<RetireOutput, Handle>;
|
|
445
445
|
};
|
|
446
446
|
verify: Query<Readonly<Record<Key, string>> & {
|
|
447
447
|
lineage?: number;
|
|
448
448
|
ref: string;
|
|
449
|
-
}, VerifyResult,
|
|
449
|
+
}, VerifyResult, Handle>;
|
|
450
450
|
};
|
|
451
|
-
type DocumentStore<Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string> = {
|
|
452
|
-
[Name in keyof Map & string]: DocumentEntityStore<Key>;
|
|
451
|
+
type DocumentStore<Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string, Handle = Executor> = {
|
|
452
|
+
[Name in keyof Map & string]: DocumentEntityStore<Key, Handle>;
|
|
453
453
|
} & {
|
|
454
|
-
aggregate: Query<Readonly<Record<Key, string>> & AggregateArgs, AggregateRow[],
|
|
455
|
-
heads: <Columns extends readonly HeadColumn[]>(handle:
|
|
454
|
+
aggregate: Query<Readonly<Record<Key, string>> & AggregateArgs, AggregateRow[], Handle>;
|
|
455
|
+
heads: <Columns extends readonly HeadColumn[]>(handle: Handle, params: Readonly<Record<Key, string>> & HeadsArgs<Columns>) => Promise<HeadRow<Columns>[]>;
|
|
456
456
|
rebuild: Query<Readonly<Record<Key, string>> & {
|
|
457
457
|
entity?: string;
|
|
458
458
|
}, {
|
|
459
459
|
rows: number;
|
|
460
|
-
},
|
|
460
|
+
}, Handle>;
|
|
461
461
|
};
|
|
462
|
-
declare const documentStore: <Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string>(options: DocumentStoreOptions<Map, Key>) => DocumentStore<Map, Key>;
|
|
462
|
+
declare const documentStore: <Map extends Readonly<Record<string, StorableDocumentEntity>>, Key extends string, Handle = Executor>(options: DocumentStoreOptions<Map, Key, Handle>) => DocumentStore<Map, Key, Handle>;
|
|
463
463
|
|
|
464
464
|
type SurfaceVerb = 'query' | 'mutation';
|
|
465
465
|
type SurfaceScope = 'org' | 'public' | 'token';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geonosis/document",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"description": "The abstract Document: an entity-first base every kind of paper-trail record extends, a derived entity registry whose name union keeps every consumer map total, and per-entity body versioning — engine-free, SQL-free, the pure core the store, the workflows and the wire contract build on.",
|
|
6
6
|
"keywords": [
|