@mastra/pg 1.9.3 → 1.9.4-alpha.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 +20 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +202 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +203 -5
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/channels/index.d.ts +25 -0
- package/dist/storage/domains/channels/index.d.ts.map +1 -0
- package/dist/storage/domains/workflows/index.d.ts +10 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ChannelsStorage } from '@mastra/core/storage';
|
|
2
|
+
import type { CreateIndexOptions, ChannelInstallation, ChannelConfig } from '@mastra/core/storage';
|
|
3
|
+
import type { PgDomainConfig } from '../../db/index.js';
|
|
4
|
+
export declare class ChannelsPG extends ChannelsStorage {
|
|
5
|
+
#private;
|
|
6
|
+
static readonly MANAGED_TABLES: readonly ["mastra_channel_installations", "mastra_channel_config"];
|
|
7
|
+
constructor(config: PgDomainConfig);
|
|
8
|
+
init(): Promise<void>;
|
|
9
|
+
static getDefaultIndexDefs(schemaPrefix: string): CreateIndexOptions[];
|
|
10
|
+
static getExportDDL(schemaName?: string): string[];
|
|
11
|
+
getDefaultIndexDefinitions(): CreateIndexOptions[];
|
|
12
|
+
createDefaultIndexes(): Promise<void>;
|
|
13
|
+
createCustomIndexes(): Promise<void>;
|
|
14
|
+
dangerouslyClearAll(): Promise<void>;
|
|
15
|
+
saveInstallation(installation: ChannelInstallation): Promise<void>;
|
|
16
|
+
getInstallation(id: string): Promise<ChannelInstallation | null>;
|
|
17
|
+
getInstallationByAgent(platform: string, agentId: string): Promise<ChannelInstallation | null>;
|
|
18
|
+
getInstallationByWebhookId(webhookId: string): Promise<ChannelInstallation | null>;
|
|
19
|
+
listInstallations(platform: string): Promise<ChannelInstallation[]>;
|
|
20
|
+
deleteInstallation(id: string): Promise<void>;
|
|
21
|
+
saveConfig(config: ChannelConfig): Promise<void>;
|
|
22
|
+
getConfig(platform: string): Promise<ChannelConfig | null>;
|
|
23
|
+
deleteConfig(platform: string): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/channels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAInG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,qBAAa,UAAW,SAAQ,eAAe;;IAM7C,MAAM,CAAC,QAAQ,CAAC,cAAc,qEAAgE;gBAElF,MAAM,EAAE,cAAc;IAS5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAa3B,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAgBtE,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE;IAuBlD,0BAA0B,IAAI,kBAAkB,EAAE;IAK5C,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAWrC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAWpC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKpC,gBAAgB,CAAC,YAAY,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgClE,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAOhE,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAU9F,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAOlF,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAUnE,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7C,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAchD,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAY1D,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAoBpD"}
|
|
@@ -2,6 +2,16 @@ import { WorkflowsStorage } from '@mastra/core/storage';
|
|
|
2
2
|
import type { UpdateWorkflowStateOptions, StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns, CreateIndexOptions } from '@mastra/core/storage';
|
|
3
3
|
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
4
4
|
import type { PgDomainConfig } from '../../db/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Sanitizes JSON string for PostgreSQL jsonb:
|
|
7
|
+
* - Removes problematic Unicode sequences:
|
|
8
|
+
* - \u0000 (null character) - causes error 22P05 "unsupported Unicode escape sequence"
|
|
9
|
+
* - \uD800-\uDFFF (unpaired surrogates) - causes "Unicode low surrogate must follow a high surrogate"
|
|
10
|
+
* - \\uD800 (escaped-backslash + surrogate, e.g. from JS regex literals like [^\ud800-\udfff]):
|
|
11
|
+
* removing just \uXXXX would leave a dangling backslash that creates a new invalid escape (e.g. \-)
|
|
12
|
+
* - Escapes any remaining invalid JSON escape sequences (e.g. \v, \k, \-)
|
|
13
|
+
*/
|
|
14
|
+
export declare function sanitizeJsonForPg(jsonString: string): string;
|
|
5
15
|
export declare class WorkflowsPG extends WorkflowsStorage {
|
|
6
16
|
#private;
|
|
7
17
|
/** Tables managed by this domain */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,gBAAgB,EAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,WAAW,EACX,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,gBAAgB,EAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,WAAW,EACX,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAW/C;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAa5D;AAED,qBAAa,WAAY,SAAQ,gBAAgB;;IAM/C,oCAAoC;IACpC,MAAM,CAAC,QAAQ,CAAC,cAAc,wCAAsC;gBAExD,MAAM,EAAE,cAAc;IAUlC,yBAAyB,IAAI,OAAO;IAIpC,OAAO,CAAC,gBAAgB;IAmBxB;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,MAAM,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,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BX,oBAAoB,CAAC,EACzB,YAAY,EACZ,KAAK,GACN,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAoB9B,kBAAkB,CAAC,EACvB,KAAK,EACL,YAAY,GACb,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAmDzB,qBAAqB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBtG,gBAAgB,CAAC,EACrB,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,EACJ,UAAU,EACV,MAAM,GACP,GAAE,4BAAiC,GAAG,OAAO,CAAC,YAAY,CAAC;CA6F7D"}
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { DbClient } from './client.js';
|
|
|
6
6
|
import { AgentsPG } from './domains/agents/index.js';
|
|
7
7
|
import { BackgroundTasksPG } from './domains/background-tasks/index.js';
|
|
8
8
|
import { BlobsPG } from './domains/blobs/index.js';
|
|
9
|
+
import { ChannelsPG } from './domains/channels/index.js';
|
|
9
10
|
import { DatasetsPG } from './domains/datasets/index.js';
|
|
10
11
|
import { ExperimentsPG } from './domains/experiments/index.js';
|
|
11
12
|
import { MCPClientsPG } from './domains/mcp-clients/index.js';
|
|
@@ -24,7 +25,7 @@ import { WorkspacesPG } from './domains/workspaces/index.js';
|
|
|
24
25
|
* via a static getExportDDL method, ensuring a single source of truth.
|
|
25
26
|
*/
|
|
26
27
|
export declare function exportSchemas(schemaName?: string): string;
|
|
27
|
-
export { AgentsPG, BackgroundTasksPG, BlobsPG, DatasetsPG, ExperimentsPG, MCPClientsPG, MCPServersPG, MemoryPG, ObservabilityPG, PromptBlocksPG, ScorerDefinitionsPG, ScoresPG, SkillsPG, WorkflowsPG, WorkspacesPG, };
|
|
28
|
+
export { AgentsPG, BackgroundTasksPG, BlobsPG, ChannelsPG, DatasetsPG, ExperimentsPG, MCPClientsPG, MCPServersPG, MemoryPG, ObservabilityPG, PromptBlocksPG, ScorerDefinitionsPG, ScoresPG, SkillsPG, WorkflowsPG, WorkspacesPG, };
|
|
28
29
|
export { PoolAdapter } from './client.js';
|
|
29
30
|
export type { DbClient, TxClient, QueryValues, Pool, PoolClient, QueryResult } from './client.js';
|
|
30
31
|
export type { PgDomainConfig, PgDomainClientConfig, PgDomainPoolConfig, PgDomainRestConfig } from './db/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAQ1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAA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,CAExB;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,IAAI,CAEtB;IAED;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAK7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/pg",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.4-alpha.1",
|
|
4
4
|
"description": "Postgres provider for Mastra - includes both vector and db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"tsup": "^8.5.1",
|
|
34
34
|
"typescript": "^6.0.3",
|
|
35
35
|
"vitest": "4.1.5",
|
|
36
|
-
"@internal/
|
|
37
|
-
"@internal/
|
|
38
|
-
"@mastra/core": "1.
|
|
39
|
-
"@internal/types-builder": "0.0.
|
|
36
|
+
"@internal/storage-test-utils": "0.0.85",
|
|
37
|
+
"@internal/lint": "0.0.89",
|
|
38
|
+
"@mastra/core": "1.31.0-alpha.3",
|
|
39
|
+
"@internal/types-builder": "0.0.64"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@mastra/core": ">=1.
|
|
42
|
+
"@mastra/core": ">=1.31.0-0 <2.0.0-0"
|
|
43
43
|
},
|
|
44
44
|
"files": [
|
|
45
45
|
"dist",
|