@jini-ai/capability-providers 0.7.3-next.1 → 0.7.3-next.3
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 +6 -0
- package/dist/adapters/sqlite/index.d.ts +2 -2
- package/dist/comments/definitions.d.ts +1 -20
- package/dist/comments/index.d.ts +1 -1
- package/dist/comments/index.js +1 -1
- package/dist/comments/registry.d.ts +1 -36
- package/dist/comments/tokens.d.ts +1 -2
- package/dist/unsafe-reference/db.d.ts +1 -1
- package/package.json +4 -4
- package/dist/comments/ports.d.ts +0 -127
- package/dist/comments/ports.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@jini-ai/capability-providers/adapters/sqlite` — the one real,
|
|
3
3
|
* production-quality `DbProvider` adapter this package ships, backed directly
|
|
4
|
-
* by `better-sqlite3`, following `@jini-ai/sqlite
|
|
4
|
+
* by `better-sqlite3`, following `@jini-ai/daemon/store/event-log/sqlite`'s `createSqliteEventLog`
|
|
5
5
|
* DI/schema conventions (an injected, already-open `Database` handle;
|
|
6
6
|
* idempotent `CREATE TABLE IF NOT EXISTS`; multi-statement writes wrapped in
|
|
7
7
|
* `db.transaction()`).
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import type Database from 'better-sqlite3';
|
|
22
22
|
import type { DbProvider, DbQuery, DbRecord } from '../../db.js';
|
|
23
|
-
/** Alias for a `better-sqlite3` `Database` handle, matching `@jini-ai/
|
|
23
|
+
/** Alias for a `better-sqlite3` `Database` handle, matching `@jini-ai/core/contracts/storage`'s own `SqliteDb` alias. */
|
|
24
24
|
type SqliteDatabase = Database.Database;
|
|
25
25
|
/**
|
|
26
26
|
* `DbProvider` adapter backed by an injected, already-open `better-sqlite3` `Database` handle.
|
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
readonly key: string;
|
|
3
|
-
readonly label: string;
|
|
4
|
-
readonly kind: 'public' | 'secret';
|
|
5
|
-
readonly required: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface CommentsProviderDefinition {
|
|
8
|
-
readonly id: string;
|
|
9
|
-
readonly label: string;
|
|
10
|
-
readonly kind: 'stored' | 'embedded';
|
|
11
|
-
readonly consentCategory: 'functional' | 'marketing';
|
|
12
|
-
readonly csp: {
|
|
13
|
-
readonly scriptSrc: readonly string[];
|
|
14
|
-
readonly frameSrc: readonly string[];
|
|
15
|
-
readonly connectSrc: readonly string[];
|
|
16
|
-
readonly styleSrc: readonly string[];
|
|
17
|
-
};
|
|
18
|
-
readonly settingsSchema: readonly CommentsSettingField[];
|
|
19
|
-
readonly implementation: 'metadata-only' | 'adapter';
|
|
20
|
-
}
|
|
1
|
+
import type { CommentsProviderDefinition } from '@jini-ai/core/contracts/site/comments-providers';
|
|
21
2
|
/** Returns an immutable, isolated definition; malformed metadata is refused before registration. */
|
|
22
3
|
export declare function freezeCommentsDefinition({ definition }: {
|
|
23
4
|
definition: CommentsProviderDefinition;
|
package/dist/comments/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Neutral comments contracts, metadata and site-scoped resolution. Hosts bind their own adapters. */
|
|
2
|
+
/** Contract types live in `@jini-ai/core/contracts/site/comments-providers`; this entry keeps the metadata and site-scoped resolution runtime. */
|
|
2
3
|
export * from './definitions.js';
|
|
3
|
-
export * from './ports.js';
|
|
4
4
|
export * from './registry.js';
|
|
5
5
|
export * from './tokens.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/comments/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Neutral comments contracts, metadata and site-scoped resolution. Hosts bind their own adapters. */
|
|
2
|
+
/** Contract types live in `@jini-ai/core/contracts/site/comments-providers`; this entry keeps the metadata and site-scoped resolution runtime. */
|
|
2
3
|
export * from './definitions.js';
|
|
3
|
-
export * from './ports.js';
|
|
4
4
|
export * from './registry.js';
|
|
5
5
|
export * from './tokens.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,39 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { CommentsProviderAdapter, CommentsSelectionStorePort } from './ports.js';
|
|
3
|
-
export interface CommentsProviderBinding {
|
|
4
|
-
definition: CommentsProviderDefinition;
|
|
5
|
-
/** Resolves only this site's adapter; undefined explicitly means not ready. No executable metadata loading. */
|
|
6
|
-
resolve(required: {
|
|
7
|
-
siteId: string;
|
|
8
|
-
}, optional?: Record<string, never>): Promise<CommentsProviderAdapter | undefined>;
|
|
9
|
-
}
|
|
10
|
-
export interface CommentsProviderRegistry {
|
|
11
|
-
register(required: CommentsProviderBinding, optional?: Record<string, never>): void;
|
|
12
|
-
get(required: {
|
|
13
|
-
providerId: string;
|
|
14
|
-
}, optional?: Record<string, never>): CommentsProviderDefinition | undefined;
|
|
15
|
-
has(required: {
|
|
16
|
-
providerId: string;
|
|
17
|
-
}, optional?: Record<string, never>): boolean;
|
|
18
|
-
list(required: Record<string, never>, optional?: Record<string, never>): readonly CommentsProviderDefinition[];
|
|
19
|
-
resolve(required: {
|
|
20
|
-
siteId: string;
|
|
21
|
-
providerId: string;
|
|
22
|
-
}, optional?: Record<string, never>): Promise<CommentsProviderAdapter | undefined>;
|
|
23
|
-
active(required: {
|
|
24
|
-
siteId: string;
|
|
25
|
-
}, optional?: Record<string, never>): Promise<{
|
|
26
|
-
providerId: string | null;
|
|
27
|
-
revision: number;
|
|
28
|
-
adapter: CommentsProviderAdapter | undefined;
|
|
29
|
-
}>;
|
|
30
|
-
select(required: {
|
|
31
|
-
siteId: string;
|
|
32
|
-
providerId: string | null;
|
|
33
|
-
expectedRevision: number;
|
|
34
|
-
actorPrincipalId: string;
|
|
35
|
-
}, optional?: Record<string, never>): Promise<void>;
|
|
36
|
-
}
|
|
1
|
+
import type { CommentsProviderRegistry, CommentsSelectionStorePort } from '@jini-ai/core/contracts/site/comments-providers';
|
|
37
2
|
/** Definition registry plus site-scoped executable resolution; core bindings still own DI.
|
|
38
3
|
* Selection commits only after readiness, with storage CAS refusing stale confirmations.
|
|
39
4
|
* @complexity O(1) lookups; list is O(p) for p registered providers. */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { CommentThreadRendererPort, CommentModerationPort, CommentSubmissionPort, CommentsSelectionStorePort } from '
|
|
2
|
-
import type { CommentsProviderRegistry } from './registry.js';
|
|
1
|
+
import type { CommentThreadRendererPort, CommentModerationPort, CommentSubmissionPort, CommentsSelectionStorePort, CommentsProviderRegistry } from '@jini-ai/core/contracts/site/comments-providers';
|
|
3
2
|
export declare const CommentsProviderRegistryToken: import("@jini-ai/core").Token<CommentsProviderRegistry, string>;
|
|
4
3
|
export declare const CommentThreadRendererToken: import("@jini-ai/core").Token<CommentThreadRendererPort, string>;
|
|
5
4
|
export declare const CommentModerationToken: import("@jini-ai/core").Token<CommentModerationPort, string>;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* `DbProvider` (defined in `../db.ts`) is implementable and unit-testable.
|
|
7
7
|
* Never wire this into anything that handles real user data.
|
|
8
8
|
*
|
|
9
|
-
* A real adapter (`@jini-ai/sqlite
|
|
9
|
+
* A real adapter (`SqliteDbProvider` from `@jini-ai/capability-providers/adapters/sqlite`, Supabase Postgres) implements the same
|
|
10
10
|
* `DbProvider` interface without importing this file — this is
|
|
11
11
|
* deliberately not that adapter (see the scope note in `archived provenance ledger`).
|
|
12
12
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/capability-providers",
|
|
3
|
-
"version": "0.7.3-next.
|
|
3
|
+
"version": "0.7.3-next.3",
|
|
4
4
|
"description": "Swappable capability-provider ports (auth, storage, payments, db, realtime) as interfaces and DI tokens only; concrete adapters live behind ./adapters/* subpaths.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"registry": "https://registry.npmjs.org"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
|
-
"@jini-ai/core": "^0.7.3-next.
|
|
101
|
+
"@jini-ai/core": "^0.7.3-next.3"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
104
|
"better-sqlite3": "^13.0.0",
|
|
@@ -107,10 +107,10 @@
|
|
|
107
107
|
"devDependencies": {
|
|
108
108
|
"@types/better-sqlite3": "^7.6.11",
|
|
109
109
|
"@types/ws": "^8.18.0",
|
|
110
|
-
"@vitest/coverage-v8": "^2.
|
|
110
|
+
"@vitest/coverage-v8": "^3.2.6",
|
|
111
111
|
"better-sqlite3": "^13.0.0",
|
|
112
112
|
"ws": "^8.18.0",
|
|
113
|
-
"@jini-ai/core": "0.7.3-next.
|
|
113
|
+
"@jini-ai/core": "0.7.3-next.3"
|
|
114
114
|
},
|
|
115
115
|
"peerDependenciesMeta": {
|
|
116
116
|
"better-sqlite3": {
|
package/dist/comments/ports.d.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/** Provider-neutral comments boundaries. Private moderation data never enters thread rendering. */
|
|
2
|
-
export type CommentStatus = 'pending' | 'approved' | 'spam' | 'trash';
|
|
3
|
-
/** Optional executable assets are declared separately; ordinary thread HTML remains visible. */
|
|
4
|
-
export interface CommentThreadScript {
|
|
5
|
-
readonly src: string;
|
|
6
|
-
}
|
|
7
|
-
export interface CommentThreadRendererPort {
|
|
8
|
-
renderThread(required: {
|
|
9
|
-
siteId: string;
|
|
10
|
-
entry: {
|
|
11
|
-
id: string;
|
|
12
|
-
slug: string;
|
|
13
|
-
title: string;
|
|
14
|
-
canonicalUrl: string;
|
|
15
|
-
};
|
|
16
|
-
locale: string;
|
|
17
|
-
}, optional?: {
|
|
18
|
-
nonce?: string;
|
|
19
|
-
cursor?: string;
|
|
20
|
-
}): Promise<{
|
|
21
|
-
html: string;
|
|
22
|
-
scripts?: readonly CommentThreadScript[];
|
|
23
|
-
}>;
|
|
24
|
-
}
|
|
25
|
-
export interface CommentModerationPort {
|
|
26
|
-
listQueue(required: {
|
|
27
|
-
siteId: string;
|
|
28
|
-
status: CommentStatus;
|
|
29
|
-
limit: number;
|
|
30
|
-
cursor?: string | null;
|
|
31
|
-
}, optional?: Record<string, never>): Promise<{
|
|
32
|
-
items: readonly {
|
|
33
|
-
id: string;
|
|
34
|
-
entryId: string;
|
|
35
|
-
status: CommentStatus;
|
|
36
|
-
authorName: string;
|
|
37
|
-
bodyText: string;
|
|
38
|
-
version: number;
|
|
39
|
-
}[];
|
|
40
|
-
nextCursor: string | null;
|
|
41
|
-
}>;
|
|
42
|
-
get(required: {
|
|
43
|
-
siteId: string;
|
|
44
|
-
id: string;
|
|
45
|
-
}, optional?: Record<string, never>): Promise<{
|
|
46
|
-
id: string;
|
|
47
|
-
entryId: string;
|
|
48
|
-
status: CommentStatus;
|
|
49
|
-
authorName: string;
|
|
50
|
-
bodyText: string;
|
|
51
|
-
version: number;
|
|
52
|
-
} | null>;
|
|
53
|
-
apply(required: {
|
|
54
|
-
siteId: string;
|
|
55
|
-
id: string;
|
|
56
|
-
expectedVersion: number;
|
|
57
|
-
action: 'approve' | 'mark_spam' | 'trash' | 'restore';
|
|
58
|
-
actorPrincipalId: string;
|
|
59
|
-
actorPluginId?: string | null;
|
|
60
|
-
note: string | null;
|
|
61
|
-
}, optional?: Record<string, never>): Promise<{
|
|
62
|
-
ok: true;
|
|
63
|
-
} | {
|
|
64
|
-
ok: false;
|
|
65
|
-
reason: 'not-found' | 'conflict';
|
|
66
|
-
currentVersion?: number;
|
|
67
|
-
}>;
|
|
68
|
-
purge(required: {
|
|
69
|
-
siteId: string;
|
|
70
|
-
id: string;
|
|
71
|
-
actorPrincipalId: string;
|
|
72
|
-
note: string | null;
|
|
73
|
-
}, optional?: Record<string, never>): Promise<{
|
|
74
|
-
ok: true;
|
|
75
|
-
} | {
|
|
76
|
-
ok: false;
|
|
77
|
-
reason: 'not-found' | 'conflict';
|
|
78
|
-
}>;
|
|
79
|
-
}
|
|
80
|
-
export interface CommentSubmissionPort {
|
|
81
|
-
submit(required: {
|
|
82
|
-
siteId: string;
|
|
83
|
-
entryId: string;
|
|
84
|
-
parentId: string | null;
|
|
85
|
-
authorName: string;
|
|
86
|
-
authorEmail: string | null;
|
|
87
|
-
authorUrl: string | null;
|
|
88
|
-
bodyRaw: string;
|
|
89
|
-
authorIpHash: string;
|
|
90
|
-
honeypotValue: string;
|
|
91
|
-
}, optional?: Record<string, never>): Promise<{
|
|
92
|
-
ok: true;
|
|
93
|
-
id: string;
|
|
94
|
-
status: CommentStatus;
|
|
95
|
-
} | {
|
|
96
|
-
ok: false;
|
|
97
|
-
reason: string;
|
|
98
|
-
}>;
|
|
99
|
-
}
|
|
100
|
-
/** Separate bindings preserve the difference between stored and embedded providers. */
|
|
101
|
-
export type CommentsProviderAdapter = {
|
|
102
|
-
kind: 'stored';
|
|
103
|
-
renderer: CommentThreadRendererPort;
|
|
104
|
-
moderation: CommentModerationPort;
|
|
105
|
-
submission: CommentSubmissionPort;
|
|
106
|
-
} | {
|
|
107
|
-
kind: 'embedded';
|
|
108
|
-
renderer: CommentThreadRendererPort;
|
|
109
|
-
dashboardUrl: string;
|
|
110
|
-
};
|
|
111
|
-
export interface CommentsSelection {
|
|
112
|
-
providerId: string | null;
|
|
113
|
-
revision: number;
|
|
114
|
-
}
|
|
115
|
-
/** compareAndSet must compare and persist inside ONE storage transaction, including the revision. */
|
|
116
|
-
export interface CommentsSelectionStorePort {
|
|
117
|
-
read(required: {
|
|
118
|
-
siteId: string;
|
|
119
|
-
}, optional?: Record<string, never>): Promise<CommentsSelection>;
|
|
120
|
-
compareAndSet(required: {
|
|
121
|
-
siteId: string;
|
|
122
|
-
expectedRevision: number;
|
|
123
|
-
providerId: string | null;
|
|
124
|
-
actorPrincipalId: string;
|
|
125
|
-
}, optional?: Record<string, never>): Promise<boolean>;
|
|
126
|
-
}
|
|
127
|
-
//# sourceMappingURL=ports.d.ts.map
|
package/dist/comments/ports.js
DELETED