@jaypie/dynamodb 0.1.3 → 0.3.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/dist/cjs/constants.d.ts +2 -5
- package/dist/cjs/entities.d.ts +13 -13
- package/dist/cjs/index.cjs +312 -124
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +6 -4
- package/dist/cjs/keyBuilders.d.ts +36 -21
- package/dist/cjs/mcp/admin/createTable.d.ts +1 -1
- package/dist/cjs/mcp/admin/dockerCompose.d.ts +1 -1
- package/dist/cjs/mcp/admin/status.d.ts +1 -1
- package/dist/cjs/mcp/index.cjs +245 -197
- package/dist/cjs/mcp/index.cjs.map +1 -1
- package/dist/cjs/queries.d.ts +16 -16
- package/dist/cjs/query.d.ts +58 -0
- package/dist/cjs/seedExport.d.ts +11 -11
- package/dist/cjs/types.d.ts +25 -27
- package/dist/esm/constants.d.ts +2 -5
- package/dist/esm/entities.d.ts +13 -13
- package/dist/esm/index.d.ts +6 -4
- package/dist/esm/index.js +281 -110
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/keyBuilders.d.ts +36 -21
- package/dist/esm/mcp/admin/createTable.d.ts +1 -1
- package/dist/esm/mcp/admin/dockerCompose.d.ts +1 -1
- package/dist/esm/mcp/admin/status.d.ts +1 -1
- package/dist/esm/mcp/index.js +239 -191
- package/dist/esm/mcp/index.js.map +1 -1
- package/dist/esm/queries.d.ts +16 -16
- package/dist/esm/query.d.ts +58 -0
- package/dist/esm/seedExport.d.ts +11 -11
- package/dist/esm/types.d.ts +25 -27
- package/package.json +2 -2
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FabricModel } from "@jaypie/fabric";
|
|
1
2
|
/**
|
|
2
3
|
* DynamoDB client configuration
|
|
3
4
|
*/
|
|
@@ -15,7 +16,7 @@ export interface DynamoClientConfig {
|
|
|
15
16
|
tableName?: string;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
|
-
* Parent reference for calculating
|
|
19
|
+
* Parent reference for calculating scope
|
|
19
20
|
*/
|
|
20
21
|
export interface ParentReference {
|
|
21
22
|
id: string;
|
|
@@ -37,13 +38,13 @@ export interface BaseQueryOptions {
|
|
|
37
38
|
startKey?: Record<string, unknown>;
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
|
-
* Parameters for
|
|
41
|
+
* Parameters for queryByScope
|
|
41
42
|
*/
|
|
42
|
-
export interface
|
|
43
|
+
export interface QueryByScopeParams extends BaseQueryOptions {
|
|
43
44
|
/** The entity model name */
|
|
44
45
|
model: string;
|
|
45
|
-
/** The
|
|
46
|
-
|
|
46
|
+
/** The scope (APEX or "{parent.model}#{parent.id}") */
|
|
47
|
+
scope: string;
|
|
47
48
|
}
|
|
48
49
|
/**
|
|
49
50
|
* Parameters for queryByAlias
|
|
@@ -57,8 +58,8 @@ export interface QueryByAliasParams {
|
|
|
57
58
|
deleted?: boolean;
|
|
58
59
|
/** The entity model name */
|
|
59
60
|
model: string;
|
|
60
|
-
/** The
|
|
61
|
-
|
|
61
|
+
/** The scope */
|
|
62
|
+
scope: string;
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
64
65
|
* Parameters for queryByClass
|
|
@@ -66,8 +67,8 @@ export interface QueryByAliasParams {
|
|
|
66
67
|
export interface QueryByClassParams extends BaseQueryOptions {
|
|
67
68
|
/** The entity model name */
|
|
68
69
|
model: string;
|
|
69
|
-
/** The
|
|
70
|
-
|
|
70
|
+
/** The scope */
|
|
71
|
+
scope: string;
|
|
71
72
|
/** The category classification */
|
|
72
73
|
recordClass: string;
|
|
73
74
|
}
|
|
@@ -77,8 +78,8 @@ export interface QueryByClassParams extends BaseQueryOptions {
|
|
|
77
78
|
export interface QueryByTypeParams extends BaseQueryOptions {
|
|
78
79
|
/** The entity model name */
|
|
79
80
|
model: string;
|
|
80
|
-
/** The
|
|
81
|
-
|
|
81
|
+
/** The scope */
|
|
82
|
+
scope: string;
|
|
82
83
|
/** The type classification */
|
|
83
84
|
type: string;
|
|
84
85
|
}
|
|
@@ -92,47 +93,44 @@ export interface QueryByXidParams {
|
|
|
92
93
|
deleted?: boolean;
|
|
93
94
|
/** The entity model name */
|
|
94
95
|
model: string;
|
|
95
|
-
/** The
|
|
96
|
-
|
|
96
|
+
/** The scope */
|
|
97
|
+
scope: string;
|
|
97
98
|
/** The external ID */
|
|
98
99
|
xid: string;
|
|
99
100
|
}
|
|
100
101
|
/**
|
|
101
102
|
* Result of a query operation
|
|
102
103
|
*/
|
|
103
|
-
export interface QueryResult<T =
|
|
104
|
+
export interface QueryResult<T = StorableEntity> {
|
|
104
105
|
/** Array of matching entities */
|
|
105
106
|
items: T[];
|
|
106
107
|
/** Pagination cursor for next page (undefined if no more results) */
|
|
107
108
|
lastEvaluatedKey?: Record<string, unknown>;
|
|
108
109
|
}
|
|
109
110
|
/**
|
|
110
|
-
*
|
|
111
|
+
* Entity with required fields for DynamoDB storage.
|
|
112
|
+
*
|
|
113
|
+
* Extends FabricModel from @jaypie/fabric with:
|
|
114
|
+
* - Required storage fields (id, model, name, scope, sequence)
|
|
115
|
+
* - String timestamps (DynamoDB uses ISO 8601 strings, not Date objects)
|
|
116
|
+
* - GSI index keys (auto-populated by indexEntity)
|
|
111
117
|
*/
|
|
112
|
-
export interface
|
|
118
|
+
export interface StorableEntity extends Omit<FabricModel, "archivedAt" | "createdAt" | "deletedAt" | "updatedAt"> {
|
|
113
119
|
/** Partition key (e.g., "record", "message") */
|
|
114
120
|
model: string;
|
|
115
121
|
/** Sort key (UUID) */
|
|
116
122
|
id: string;
|
|
117
123
|
/** Human-readable name */
|
|
118
124
|
name: string;
|
|
119
|
-
/**
|
|
120
|
-
|
|
125
|
+
/** Scope: APEX ("@") or "{parent.model}#{parent.id}" */
|
|
126
|
+
scope: string;
|
|
121
127
|
/** Timestamp for chronological ordering (Date.now()) */
|
|
122
128
|
sequence: number;
|
|
123
129
|
indexAlias?: string;
|
|
124
130
|
indexClass?: string;
|
|
125
|
-
|
|
131
|
+
indexScope?: string;
|
|
126
132
|
indexType?: string;
|
|
127
133
|
indexXid?: string;
|
|
128
|
-
/** Human-friendly slug/alias */
|
|
129
|
-
alias?: string;
|
|
130
|
-
/** Category classification */
|
|
131
|
-
class?: string;
|
|
132
|
-
/** Type classification */
|
|
133
|
-
type?: string;
|
|
134
|
-
/** External ID for integration with external systems */
|
|
135
|
-
xid?: string;
|
|
136
134
|
createdAt: string;
|
|
137
135
|
updatedAt: string;
|
|
138
136
|
/** Archive timestamp (for inactive but preserved records) */
|
package/dist/esm/constants.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const SEPARATOR = "#";
|
|
1
|
+
export { APEX, ARCHIVED_SUFFIX, DELETED_SUFFIX, SEPARATOR, } from "@jaypie/fabric";
|
|
3
2
|
export declare const INDEX_ALIAS = "indexAlias";
|
|
4
3
|
export declare const INDEX_CLASS = "indexClass";
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const INDEX_SCOPE = "indexScope";
|
|
6
5
|
export declare const INDEX_TYPE = "indexType";
|
|
7
6
|
export declare const INDEX_XID = "indexXid";
|
|
8
|
-
export declare const ARCHIVED_SUFFIX = "#archived";
|
|
9
|
-
export declare const DELETED_SUFFIX = "#deleted";
|
package/dist/esm/entities.d.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StorableEntity } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Get a single entity by primary key
|
|
4
4
|
*/
|
|
5
|
-
export declare const getEntity: import("@jaypie/
|
|
5
|
+
export declare const getEntity: import("@jaypie/fabric").Service<Record<string, unknown>, StorableEntity | null>;
|
|
6
6
|
/**
|
|
7
7
|
* Put (create or replace) an entity
|
|
8
8
|
* Auto-populates GSI index keys via indexEntity
|
|
9
9
|
*
|
|
10
|
-
* Note: This is a regular async function (not
|
|
11
|
-
* complex
|
|
10
|
+
* Note: This is a regular async function (not fabricService) because it accepts
|
|
11
|
+
* complex StorableEntity objects that can't be coerced by vocabulary's type system.
|
|
12
12
|
*/
|
|
13
13
|
export declare function putEntity({ entity, }: {
|
|
14
|
-
entity:
|
|
15
|
-
}): Promise<
|
|
14
|
+
entity: StorableEntity;
|
|
15
|
+
}): Promise<StorableEntity>;
|
|
16
16
|
/**
|
|
17
17
|
* Update an existing entity
|
|
18
18
|
* Auto-populates GSI index keys and sets updatedAt
|
|
19
19
|
*
|
|
20
|
-
* Note: This is a regular async function (not
|
|
21
|
-
* complex
|
|
20
|
+
* Note: This is a regular async function (not fabricService) because it accepts
|
|
21
|
+
* complex StorableEntity objects that can't be coerced by vocabulary's type system.
|
|
22
22
|
*/
|
|
23
23
|
export declare function updateEntity({ entity, }: {
|
|
24
|
-
entity:
|
|
25
|
-
}): Promise<
|
|
24
|
+
entity: StorableEntity;
|
|
25
|
+
}): Promise<StorableEntity>;
|
|
26
26
|
/**
|
|
27
27
|
* Soft delete an entity by setting deletedAt timestamp
|
|
28
28
|
* Re-indexes with appropriate suffix based on archived/deleted state
|
|
29
29
|
*/
|
|
30
|
-
export declare const deleteEntity: import("@jaypie/
|
|
30
|
+
export declare const deleteEntity: import("@jaypie/fabric").Service<Record<string, unknown>, boolean>;
|
|
31
31
|
/**
|
|
32
32
|
* Archive an entity by setting archivedAt timestamp
|
|
33
33
|
* Re-indexes with appropriate suffix based on archived/deleted state
|
|
34
34
|
*/
|
|
35
|
-
export declare const archiveEntity: import("@jaypie/
|
|
35
|
+
export declare const archiveEntity: import("@jaypie/fabric").Service<Record<string, unknown>, boolean>;
|
|
36
36
|
/**
|
|
37
37
|
* Hard delete an entity (permanently removes from table)
|
|
38
38
|
* Use with caution - prefer deleteEntity for soft delete
|
|
39
39
|
*/
|
|
40
|
-
export declare const destroyEntity: import("@jaypie/
|
|
40
|
+
export declare const destroyEntity: import("@jaypie/fabric").Service<Record<string, unknown>, boolean>;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { getDocClient, getTableName, initClient, isInitialized, resetClient, } from "./client.js";
|
|
2
|
-
export { APEX, ARCHIVED_SUFFIX, DELETED_SUFFIX, INDEX_ALIAS, INDEX_CLASS,
|
|
2
|
+
export { APEX, ARCHIVED_SUFFIX, DELETED_SUFFIX, INDEX_ALIAS, INDEX_CLASS, INDEX_SCOPE, INDEX_TYPE, INDEX_XID, SEPARATOR, } from "./constants.js";
|
|
3
3
|
export { archiveEntity, deleteEntity, destroyEntity, getEntity, putEntity, updateEntity, } from "./entities.js";
|
|
4
|
-
export { buildIndexAlias, buildIndexClass,
|
|
5
|
-
export { queryByAlias, queryByClass,
|
|
4
|
+
export { buildCompositeKey, buildIndexAlias, buildIndexClass, buildIndexScope, buildIndexType, buildIndexXid, calculateScope, DEFAULT_INDEXES, indexEntity, } from "./keyBuilders.js";
|
|
5
|
+
export { queryByAlias, queryByClass, queryByScope, queryByType, queryByXid, } from "./queries.js";
|
|
6
|
+
export { query } from "./query.js";
|
|
7
|
+
export type { QueryParams } from "./query.js";
|
|
6
8
|
export { exportEntities, exportEntitiesToJson, seedEntities, seedEntityIfNotExists, } from "./seedExport.js";
|
|
7
|
-
export type { BaseQueryOptions, DynamoClientConfig,
|
|
9
|
+
export type { BaseQueryOptions, DynamoClientConfig, ParentReference, QueryResult, StorableEntity, } from "./types.js";
|
|
8
10
|
export type { ExportResult, SeedOptions, SeedResult } from "./seedExport.js";
|