@stacksjs/orm 0.70.87 → 0.70.88
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/package.json +4 -4
- package/dist/auto-crud.d.ts +0 -234
- package/dist/batch-loader.d.ts +0 -19
- package/dist/db.d.ts +0 -7
- package/dist/define-model.d.ts +0 -180
- package/dist/generate-database-schema.d.ts +0 -23
- package/dist/index.d.ts +0 -232
- package/dist/index.js +0 -31
- package/dist/model-types.d.ts +0 -87
- package/dist/paginator-request.d.ts +0 -68
- package/dist/paginator.d.ts +0 -99
- package/dist/subquery.d.ts +0 -22
- package/dist/traits/audit.d.ts +0 -62
- package/dist/traits/billable.d.ts +0 -37
- package/dist/traits/categorizable.d.ts +0 -5
- package/dist/traits/commentable.d.ts +0 -1
- package/dist/traits/likeable.d.ts +0 -1
- package/dist/traits/soft-deletes.d.ts +0 -68
- package/dist/traits/taggable.d.ts +0 -1
- package/dist/traits/two-factor.d.ts +0 -1
- package/dist/transaction.d.ts +0 -67
- package/dist/types.d.ts +0 -59
- package/dist/utils/encrypted.d.ts +0 -81
- package/dist/utils/prunable.d.ts +0 -17
- package/dist/utils.d.ts +0 -22
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal escape hatch for tests / key-rotation flows that need to force
|
|
3
|
-
* the next read to re-derive the key from APP_KEY. Not exported from the
|
|
4
|
-
* package barrel on purpose.
|
|
5
|
-
*/
|
|
6
|
-
export declare function _clearEncryptedKeyCache(): void;
|
|
7
|
-
/**
|
|
8
|
-
* Returns true iff `value` is a string that already carries the
|
|
9
|
-
* `enc:` envelope. Used by both the encrypt and decrypt paths to make
|
|
10
|
-
* each idempotent.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* isEncrypted('enc:AAA:BBB:CCC') // → true
|
|
15
|
-
* isEncrypted('plain string') // → false
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare function isEncrypted(value: unknown): value is string;
|
|
19
|
-
/**
|
|
20
|
-
* Encrypt a value with AES-256-GCM under the app key. Idempotent: an
|
|
21
|
-
* already-prefixed value is returned untouched, so backfill jobs that
|
|
22
|
-
* run twice don't double-encrypt.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* const ciphertext = await encryptValue('123-45-6789')
|
|
27
|
-
* // → 'enc:<iv>:<tag>:<ciphertext>'
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare function encryptValue(value: unknown): Promise<unknown>;
|
|
31
|
-
/**
|
|
32
|
-
* Decrypt an `enc:`-prefixed value. Plaintext (no prefix) passes through
|
|
33
|
-
* unchanged so the trait works against rows written before the column
|
|
34
|
-
* was marked encrypted.
|
|
35
|
-
*
|
|
36
|
-
* Returns `null` on any decrypt failure (after logging) so a corrupted /
|
|
37
|
-
* key-rotated row doesn't bring down the whole read path.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* const ssn = await decryptValue(row.ssn) // null if undecryptable
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export declare function decryptValue(value: unknown): Promise<unknown>;
|
|
45
|
-
/**
|
|
46
|
-
* Walk a row's attributes, encrypting each key listed in `encryptedKeys`
|
|
47
|
-
* before write. Mutates a shallow copy of the row, not the original — so
|
|
48
|
-
* caller-side debug dumps still see the plaintext value.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```ts
|
|
52
|
-
* const safe = await encryptRowForWrite({ name, ssn: '...' }, ['ssn'])
|
|
53
|
-
* await db.insertInto('users').values(safe).execute()
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
export declare function encryptRowForWrite(row: Record<string, unknown>, encryptedKeys: ReadonlyArray<string>): Promise<Record<string, unknown>>;
|
|
57
|
-
/**
|
|
58
|
-
* Walk a row's attributes, decrypting each key listed in `encryptedKeys`
|
|
59
|
-
* after read. Mirror of `encryptRowForWrite()`.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```ts
|
|
63
|
-
* const row = await db.selectFrom('users').selectAll().executeTakeFirst()
|
|
64
|
-
* const decrypted = await decryptRowForRead(row, ['ssn'])
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export declare function decryptRowForRead(row: Record<string, unknown>, encryptedKeys: ReadonlyArray<string>): Promise<Record<string, unknown>>;
|
|
68
|
-
/**
|
|
69
|
-
* Extract the list of attribute names that have `encrypted: true` from a
|
|
70
|
-
* model definition's `attributes` block. Returns `[]` for models without
|
|
71
|
-
* any encrypted columns so callers don't need to guard.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* const keys = collectEncryptedAttributes({
|
|
76
|
-
* attributes: { ssn: { type: 'string', encrypted: true }, name: { type: 'string' } },
|
|
77
|
-
* })
|
|
78
|
-
* // → ['ssn']
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
export declare function collectEncryptedAttributes(definition: { attributes?: Record<string, { encrypted?: boolean } & Record<string, unknown>> }): string[];
|
package/dist/utils/prunable.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prune old records from a table, firing model events for each deleted record.
|
|
3
|
-
*/
|
|
4
|
-
export declare function prunable(tableName: string, options?: PrunableOptions): Promise<number>;
|
|
5
|
-
/**
|
|
6
|
-
* Mass prune old records from a table using a bulk delete (no model events).
|
|
7
|
-
*/
|
|
8
|
-
export declare function massPrunable(tableName: string, options?: PrunableOptions): Promise<number>;
|
|
9
|
-
/**
|
|
10
|
-
* Get prunable configuration from a model's traits.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getPrunableConfig(traits: Record<string, any>): PrunableOptions | null;
|
|
13
|
-
export declare interface PrunableOptions {
|
|
14
|
-
olderThanDays?: number
|
|
15
|
-
column?: string
|
|
16
|
-
query?: (qb: any) => any
|
|
17
|
-
}
|
package/dist/utils.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { AttributesElements, Model, ModelElement, RelationConfig, TableNames } from '@stacksjs/types';
|
|
2
|
-
export declare function modelTableName(model: Model | ModelPath): Promise<string>;
|
|
3
|
-
export declare function getModelName(model: Model, modelPath: string): string;
|
|
4
|
-
export declare function getTableName(model: Model, modelPath: string): TableNames;
|
|
5
|
-
export declare function getPivotTableName(formattedModelName: string, modelRelationTable: string): string;
|
|
6
|
-
export declare function hasRelations(obj: any, key: string): boolean;
|
|
7
|
-
export declare function getRelations(model: Model, modelName: string): Promise<RelationConfig[]>;
|
|
8
|
-
export declare function getRelationType(relation: string): string;
|
|
9
|
-
export declare function getRelationCount(relation: string): string;
|
|
10
|
-
export declare function getPivotTables(model: Model, modelPath: string): Promise<{ table: string, firstForeignKey?: string, secondForeignKey?: string }[]>;
|
|
11
|
-
export declare function fetchOtherModelRelations(modelName?: string): Promise<RelationConfig[]>;
|
|
12
|
-
export declare function getHiddenAttributes(attributes: AttributesElements | undefined): string[];
|
|
13
|
-
export declare function getGuardedAttributes(model: Model): string[];
|
|
14
|
-
export declare function getFillableAttributes(model: Model, otherModelRelations: RelationConfig[]): string[];
|
|
15
|
-
export declare function extractFields(model: Model, modelFile: string): Promise<ModelElement[]>;
|
|
16
|
-
export declare function mapEntity(attribute: ModelElement): string | undefined;
|
|
17
|
-
export declare function findCoreModel(modelName: string): string;
|
|
18
|
-
export declare function findUserModel(modelName: string): string;
|
|
19
|
-
export declare function formatDate(date: Date | number | string): string;
|
|
20
|
-
export declare function extractDate(date: Date): string;
|
|
21
|
-
export declare function toTimestamp(date: Date): number;
|
|
22
|
-
declare type ModelPath = string;
|