@jaypie/dynamodb 0.0.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/LICENSE.txt +21 -0
- package/README.md +15 -0
- package/dist/cjs/client.d.ts +27 -0
- package/dist/cjs/constants.d.ts +9 -0
- package/dist/cjs/entities.d.ts +71 -0
- package/dist/cjs/index.cjs +483 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/keyBuilders.d.ts +59 -0
- package/dist/cjs/queries.d.ts +48 -0
- package/dist/cjs/types.d.ts +142 -0
- package/dist/esm/client.d.ts +27 -0
- package/dist/esm/constants.d.ts +9 -0
- package/dist/esm/entities.d.ts +71 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +450 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/keyBuilders.d.ts +59 -0
- package/dist/esm/queries.d.ts +48 -0
- package/dist/esm/types.d.ts +142 -0
- package/package.json +52 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DynamoDB client configuration
|
|
3
|
+
*/
|
|
4
|
+
export interface DynamoClientConfig {
|
|
5
|
+
/** DynamoDB table name */
|
|
6
|
+
tableName: string;
|
|
7
|
+
/** Optional endpoint URL for local development (e.g., "http://127.0.0.1:8100") */
|
|
8
|
+
endpoint?: string;
|
|
9
|
+
/** AWS region (default: "us-east-1") */
|
|
10
|
+
region?: string;
|
|
11
|
+
/** Optional credentials for local development */
|
|
12
|
+
credentials?: {
|
|
13
|
+
accessKeyId: string;
|
|
14
|
+
secretAccessKey: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Parent reference for calculating OU
|
|
19
|
+
*/
|
|
20
|
+
export interface ParentReference {
|
|
21
|
+
id: string;
|
|
22
|
+
model: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Base query options shared by all query functions
|
|
26
|
+
*/
|
|
27
|
+
export interface BaseQueryOptions {
|
|
28
|
+
/** Query archived entities instead of active ones */
|
|
29
|
+
archived?: boolean;
|
|
30
|
+
/** Whether to sort ascending (oldest first). Default: false (most recent first) */
|
|
31
|
+
ascending?: boolean;
|
|
32
|
+
/** Query deleted entities instead of active ones */
|
|
33
|
+
deleted?: boolean;
|
|
34
|
+
/** Maximum number of items to return */
|
|
35
|
+
limit?: number;
|
|
36
|
+
/** Pagination cursor from previous query */
|
|
37
|
+
startKey?: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parameters for queryByOu
|
|
41
|
+
*/
|
|
42
|
+
export interface QueryByOuParams extends BaseQueryOptions {
|
|
43
|
+
/** The entity model name */
|
|
44
|
+
model: string;
|
|
45
|
+
/** The organizational unit (APEX or "{parent.model}#{parent.id}") */
|
|
46
|
+
ou: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Parameters for queryByAlias
|
|
50
|
+
*/
|
|
51
|
+
export interface QueryByAliasParams {
|
|
52
|
+
/** The human-friendly alias */
|
|
53
|
+
alias: string;
|
|
54
|
+
/** Query archived entities instead of active ones */
|
|
55
|
+
archived?: boolean;
|
|
56
|
+
/** Query deleted entities instead of active ones */
|
|
57
|
+
deleted?: boolean;
|
|
58
|
+
/** The entity model name */
|
|
59
|
+
model: string;
|
|
60
|
+
/** The organizational unit */
|
|
61
|
+
ou: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Parameters for queryByClass
|
|
65
|
+
*/
|
|
66
|
+
export interface QueryByClassParams extends BaseQueryOptions {
|
|
67
|
+
/** The entity model name */
|
|
68
|
+
model: string;
|
|
69
|
+
/** The organizational unit */
|
|
70
|
+
ou: string;
|
|
71
|
+
/** The category classification */
|
|
72
|
+
recordClass: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Parameters for queryByType
|
|
76
|
+
*/
|
|
77
|
+
export interface QueryByTypeParams extends BaseQueryOptions {
|
|
78
|
+
/** The entity model name */
|
|
79
|
+
model: string;
|
|
80
|
+
/** The organizational unit */
|
|
81
|
+
ou: string;
|
|
82
|
+
/** The type classification */
|
|
83
|
+
type: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Parameters for queryByXid
|
|
87
|
+
*/
|
|
88
|
+
export interface QueryByXidParams {
|
|
89
|
+
/** Query archived entities instead of active ones */
|
|
90
|
+
archived?: boolean;
|
|
91
|
+
/** Query deleted entities instead of active ones */
|
|
92
|
+
deleted?: boolean;
|
|
93
|
+
/** The entity model name */
|
|
94
|
+
model: string;
|
|
95
|
+
/** The organizational unit */
|
|
96
|
+
ou: string;
|
|
97
|
+
/** The external ID */
|
|
98
|
+
xid: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Result of a query operation
|
|
102
|
+
*/
|
|
103
|
+
export interface QueryResult<T = FabricEntity> {
|
|
104
|
+
/** Array of matching entities */
|
|
105
|
+
items: T[];
|
|
106
|
+
/** Pagination cursor for next page (undefined if no more results) */
|
|
107
|
+
lastEvaluatedKey?: Record<string, unknown>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Base entity interface for DynamoDB single-table design
|
|
111
|
+
*/
|
|
112
|
+
export interface FabricEntity {
|
|
113
|
+
/** Partition key (e.g., "record", "message") */
|
|
114
|
+
model: string;
|
|
115
|
+
/** Sort key (UUID) */
|
|
116
|
+
id: string;
|
|
117
|
+
/** Human-readable name */
|
|
118
|
+
name: string;
|
|
119
|
+
/** Organizational unit: APEX ("@") or "{parent.model}#{parent.id}" */
|
|
120
|
+
ou: string;
|
|
121
|
+
/** Timestamp for chronological ordering (Date.now()) */
|
|
122
|
+
sequence: number;
|
|
123
|
+
indexAlias?: string;
|
|
124
|
+
indexClass?: string;
|
|
125
|
+
indexOu?: string;
|
|
126
|
+
indexType?: string;
|
|
127
|
+
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
|
+
createdAt: string;
|
|
137
|
+
updatedAt: string;
|
|
138
|
+
/** Archive timestamp (for inactive but preserved records) */
|
|
139
|
+
archivedAt?: string;
|
|
140
|
+
/** Soft-delete timestamp */
|
|
141
|
+
deletedAt?: string;
|
|
142
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jaypie/dynamodb",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/finlaysonstudio/jaypie.git"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"author": "Finlayson Studio",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/esm/index.d.ts",
|
|
15
|
+
"require": "./dist/cjs/index.cjs",
|
|
16
|
+
"import": "./dist/esm/index.js",
|
|
17
|
+
"default": "./dist/esm/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/cjs/index.cjs",
|
|
21
|
+
"module": "./dist/esm/index.js",
|
|
22
|
+
"types": "./dist/esm/index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "rollup --config",
|
|
28
|
+
"format": "npm run format:package && npm run format:lint",
|
|
29
|
+
"format:lint": "eslint --fix .",
|
|
30
|
+
"format:package": "sort-package-json ./package.json",
|
|
31
|
+
"lint": "eslint .",
|
|
32
|
+
"test": "vitest run .",
|
|
33
|
+
"typecheck": "tsc --noEmit"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@aws-sdk/client-dynamodb": "^3.726.1",
|
|
37
|
+
"@aws-sdk/lib-dynamodb": "^3.726.1"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
41
|
+
"@types/node": "^22.13.1",
|
|
42
|
+
"typescript": "^5.3.3"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@jaypie/errors": "^1.2.1",
|
|
46
|
+
"@jaypie/kit": "^1.2.1",
|
|
47
|
+
"@jaypie/logger": "^1.2.1"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
}
|
|
52
|
+
}
|