@mdbase-dev/pickle 0.1.0-beta.25 → 0.1.0-beta.27
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/index.d.ts +6 -1
- package/dist/index.js +6 -2
- package/dist/resources.d.ts +7 -0
- package/dist/resources.js +11 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { CollectionContractDescriptor, CollectionDescription, CollectionTypeDescriptor, JsonObject, RecordDocument } from "@mdbase-dev/connect-protocol";
|
|
2
2
|
import { type MdbaseConnection } from "@mdbase-dev/connect";
|
|
3
|
-
export { PICKLE_ACK_RESPONSE_TYPE_DOCUMENT, PICKLE_APPROVAL_RESPONSE_TYPE_DOCUMENT, PICKLE_REQUEST_CONTRACT_DOCUMENT, PICKLE_TYPE_PACK_PROVISION, PICKLE_REQUEST_TYPE_DOCUMENT } from "./resources.js";
|
|
3
|
+
export { PICKLE_ACK_RESPONSE_TYPE_DOCUMENT, PICKLE_APPROVAL_RESPONSE_TYPE_DOCUMENT, PICKLE_REQUEST_CONTRACT_DOCUMENT, PICKLE_REQUEST_CONTRACT_DIGEST, PICKLE_TYPE_PACK_PROVISION, PICKLE_REQUEST_TYPE_DOCUMENT } from "./resources.js";
|
|
4
4
|
export declare const PICKLE_REQUEST_CONTRACT = "pickle.request";
|
|
5
5
|
export declare const PICKLE_REQUEST_CONTRACT_VERSION = "1.0.0";
|
|
6
6
|
export declare const PICKLE_NOTIFICATION_CRITERION = "pickle.request.created";
|
|
7
|
+
export declare const PICKLE_NOTIFICATION_EVENT: {
|
|
8
|
+
readonly id: "mdbase.record.created";
|
|
9
|
+
readonly version: "1.0.0";
|
|
10
|
+
readonly digest: "sha256:7f3bed6baa356ee9389e977ae7b77a102e2bee871a7c1d9f2026fc21cacdbfc9";
|
|
11
|
+
};
|
|
7
12
|
export type PickleRequestState = "pending" | "answered" | "conflict" | "cancelled";
|
|
8
13
|
export interface PickleFrontmatter extends JsonObject {
|
|
9
14
|
type?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { MDBASE_RECORD_CREATED_CONTRACT } from "@mdbase-dev/connect-protocol";
|
|
1
2
|
import { unwrapConnectOutcome } from "@mdbase-dev/connect";
|
|
2
|
-
|
|
3
|
+
import { PICKLE_REQUEST_CONTRACT_DIGEST } from "./resources.js";
|
|
4
|
+
export { PICKLE_ACK_RESPONSE_TYPE_DOCUMENT, PICKLE_APPROVAL_RESPONSE_TYPE_DOCUMENT, PICKLE_REQUEST_CONTRACT_DOCUMENT, PICKLE_REQUEST_CONTRACT_DIGEST, PICKLE_TYPE_PACK_PROVISION, PICKLE_REQUEST_TYPE_DOCUMENT } from "./resources.js";
|
|
3
5
|
export const PICKLE_REQUEST_CONTRACT = "pickle.request";
|
|
4
6
|
export const PICKLE_REQUEST_CONTRACT_VERSION = "1.0.0";
|
|
5
7
|
export const PICKLE_NOTIFICATION_CRITERION = "pickle.request.created";
|
|
8
|
+
export const PICKLE_NOTIFICATION_EVENT = MDBASE_RECORD_CREATED_CONTRACT;
|
|
6
9
|
const SYSTEM_RESPONSE_FIELDS = new Set([
|
|
7
10
|
"type",
|
|
8
11
|
"types",
|
|
@@ -14,7 +17,8 @@ const SYSTEM_RESPONSE_FIELDS = new Set([
|
|
|
14
17
|
]);
|
|
15
18
|
export function resolvePickleContract(description) {
|
|
16
19
|
const descriptor = description.contracts.find((contract) => contract.id === PICKLE_REQUEST_CONTRACT &&
|
|
17
|
-
contract.version === PICKLE_REQUEST_CONTRACT_VERSION
|
|
20
|
+
contract.version === PICKLE_REQUEST_CONTRACT_VERSION &&
|
|
21
|
+
contract.digest === PICKLE_REQUEST_CONTRACT_DIGEST);
|
|
18
22
|
if (!descriptor) {
|
|
19
23
|
throw new PickleContractError("This collection does not provide the Pickle request contract.");
|
|
20
24
|
}
|
package/dist/resources.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const PICKLE_REQUEST_CONTRACT_DOCUMENT = "---\nkind: mdbase.contract\ncontract_type: record\nid: pickle.request\nversion: 1.0.0\nname: Pickle request\ndescription: A portable asynchronous request that needs a human response.\nrecord_schema:\n dialect: json-schema-2020-12\n value:\n $schema: \"https://json-schema.org/draft/2020-12/schema\"\n type: object\n additionalProperties: true\n required: [title, response_type]\n properties:\n id: { type: string }\n title: { type: string, minLength: 1 }\n source: { type: string }\n message: { type: string }\n kind: { enum: [approval, choice, input, notice, message] }\n status: { enum: [pending, answered, cancelled] }\n priority: { enum: [low, normal, high, urgent] }\n response_type: { type: string }\n created_at: { type: string, format: date-time }\n tags:\n type: array\n items: { type: string }\n links:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n label: { type: string }\n url: { type: string }\n path: { type: string }\n attachment_paths:\n type: array\n items: { type: string }\n metadata:\n type: object\n additionalProperties: true\n---\n";
|
|
2
|
+
/** Semantic digest of the resolved Pickle request contract, pinned by consumers. */
|
|
3
|
+
export declare const PICKLE_REQUEST_CONTRACT_DIGEST = "sha256:5a96bbda301de6ec2f71a5083f62769463b4e613ed8ba860d62170b8c810db61";
|
|
2
4
|
export declare const PICKLE_REQUEST_TYPE_DOCUMENT = "---\nkind: mdbase.type\nname: pickle_request\nversion: 1\ndescription: Async request that needs a human response.\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: \"https://json-schema.org/draft/2020-12/schema\"\n type: object\n additionalProperties: true\n required: [title, response_type]\n properties:\n type: { const: pickle_request }\n id: { type: string }\n title: { type: string, minLength: 1 }\n source: { type: string }\n message: { type: string }\n kind: { enum: [approval, choice, input, notice, message] }\n status:\n enum: [pending, answered, cancelled]\n description: Legacy lifecycle marker. Response links are authoritative for answered state.\n priority: { enum: [low, normal, high, urgent] }\n response_type: { type: string }\n created_at: { type: string, format: date-time }\n due_at: { type: string, format: date-time }\n dedupe_key: { type: string }\n tags:\n type: array\n items: { type: string }\n links:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n label: { type: string }\n url: { type: string }\n path: { type: string }\n attachment_paths:\n type: array\n items: { type: string }\n metadata:\n type: object\n additionalProperties: true\n context:\n type: object\n additionalProperties: false\n properties:\n cwd: { type: string }\n repo: { type: string }\n task: { type: string }\ncollection:\n display:\n name_field: title\n unique:\n - field: id\n scope: collection\nlifecycle:\n on_create:\n set:\n created_at: { now: true }\nimplements:\n - contract: pickle.request\n version: 1.0.0\n fields:\n id: id\n title: title\n source: source\n message: message\n kind: kind\n status: status\n priority: priority\n response_type: response_type\n created_at: created_at\n tags: tags\n links: links\n attachment_paths: attachment_paths\n metadata: metadata\n---\n";
|
|
3
5
|
export declare const PICKLE_APPROVAL_RESPONSE_TYPE_DOCUMENT = "---\nkind: mdbase.type\nname: pickle_response_approval\nversion: 1\ndescription: Approve, reject, or request revision for a Pickle request.\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: \"https://json-schema.org/draft/2020-12/schema\"\n type: object\n additionalProperties: true\n required: [request, decision]\n properties:\n type: { const: pickle_response_approval }\n id: { type: string }\n request: { type: string }\n decision: { enum: [approve, reject, revise] }\n comment: { type: string }\n responded_at: { type: string, format: date-time }\n responder: { type: string }\n attachment_paths:\n type: array\n items: { type: string }\ncollection:\n display:\n name_field: decision\n links:\n request:\n target_type: pickle_request\n validate_exists: true\n unique:\n - field: id\n scope: collection\nlifecycle:\n on_create:\n set:\n id: { ulid: true }\n responded_at: { now: true }\n---\n";
|
|
4
6
|
export declare const PICKLE_ACK_RESPONSE_TYPE_DOCUMENT = "---\nkind: mdbase.type\nname: pickle_response_ack\nversion: 1\ndescription: Acknowledge that a Pickle message was read.\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: \"https://json-schema.org/draft/2020-12/schema\"\n type: object\n additionalProperties: true\n required: [request]\n properties:\n type: { const: pickle_response_ack }\n id: { type: string }\n request: { type: string }\n message: { type: string }\n responded_at: { type: string, format: date-time }\n responder: { type: string }\n attachment_paths:\n type: array\n items: { type: string }\ncollection:\n display:\n name_field: message\n links:\n request:\n target_type: pickle_request\n validate_exists: true\n unique:\n - field: id\n scope: collection\nlifecycle:\n on_create:\n set:\n id: { ulid: true }\n responded_at: { now: true }\n---\n";
|
|
@@ -11,21 +13,25 @@ export declare const PICKLE_TYPE_PACK_PROVISION: {
|
|
|
11
13
|
readonly description: "Pickle request and response record types.";
|
|
12
14
|
readonly resources: readonly [{
|
|
13
15
|
readonly kind: "contract";
|
|
16
|
+
readonly mode: "managed";
|
|
14
17
|
readonly source: "contracts/pickle.request.md";
|
|
15
18
|
readonly target: "_contracts/pickle.request.md";
|
|
16
19
|
readonly digest: "sha256:caf9ee290e98ef51f871a1237b38531168aa1b74640241ce6edece4c2bff66f1";
|
|
17
20
|
}, {
|
|
18
21
|
readonly kind: "type";
|
|
22
|
+
readonly mode: "seed";
|
|
19
23
|
readonly source: "types/pickle_request.md";
|
|
20
24
|
readonly target: "_types/pickle_request.md";
|
|
21
25
|
readonly digest: "sha256:7f84e359a5a3b7d23dd3471c7557f67cb8a80eb553184db83c4750b2af5761e4";
|
|
22
26
|
}, {
|
|
23
27
|
readonly kind: "type";
|
|
28
|
+
readonly mode: "seed";
|
|
24
29
|
readonly source: "types/pickle_response_approval.md";
|
|
25
30
|
readonly target: "_types/pickle_response_approval.md";
|
|
26
31
|
readonly digest: "sha256:944d2b68c158297f5d2a035fa6ff3c81a7098531f77a9bc3342dc9435ffcb8b8";
|
|
27
32
|
}, {
|
|
28
33
|
readonly kind: "type";
|
|
34
|
+
readonly mode: "seed";
|
|
29
35
|
readonly source: "types/pickle_response_ack.md";
|
|
30
36
|
readonly target: "_types/pickle_response_ack.md";
|
|
31
37
|
readonly digest: "sha256:2530c8d21bb711889f20e0d096045cb6c9a7618583b1e2afff7ada72367de41f";
|
|
@@ -47,5 +53,6 @@ export declare const PICKLE_TYPE_PACK_PROVISION: {
|
|
|
47
53
|
readonly provides: readonly [{
|
|
48
54
|
readonly id: "pickle.request";
|
|
49
55
|
readonly version: "1.0.0";
|
|
56
|
+
readonly digest: "sha256:5a96bbda301de6ec2f71a5083f62769463b4e613ed8ba860d62170b8c810db61";
|
|
50
57
|
}];
|
|
51
58
|
};
|
package/dist/resources.js
CHANGED
|
@@ -42,6 +42,8 @@ record_schema:
|
|
|
42
42
|
additionalProperties: true
|
|
43
43
|
---
|
|
44
44
|
`;
|
|
45
|
+
/** Semantic digest of the resolved Pickle request contract, pinned by consumers. */
|
|
46
|
+
export const PICKLE_REQUEST_CONTRACT_DIGEST = "sha256:5a96bbda301de6ec2f71a5083f62769463b4e613ed8ba860d62170b8c810db61";
|
|
45
47
|
export const PICKLE_REQUEST_TYPE_DOCUMENT = `---
|
|
46
48
|
kind: mdbase.type
|
|
47
49
|
name: pickle_request
|
|
@@ -212,24 +214,28 @@ export const PICKLE_TYPE_PACK_PROVISION = {
|
|
|
212
214
|
resources: [
|
|
213
215
|
{
|
|
214
216
|
kind: "contract",
|
|
217
|
+
mode: "managed",
|
|
215
218
|
source: "contracts/pickle.request.md",
|
|
216
219
|
target: "_contracts/pickle.request.md",
|
|
217
220
|
digest: "sha256:caf9ee290e98ef51f871a1237b38531168aa1b74640241ce6edece4c2bff66f1"
|
|
218
221
|
},
|
|
219
222
|
{
|
|
220
223
|
kind: "type",
|
|
224
|
+
mode: "seed",
|
|
221
225
|
source: "types/pickle_request.md",
|
|
222
226
|
target: "_types/pickle_request.md",
|
|
223
227
|
digest: "sha256:7f84e359a5a3b7d23dd3471c7557f67cb8a80eb553184db83c4750b2af5761e4"
|
|
224
228
|
},
|
|
225
229
|
{
|
|
226
230
|
kind: "type",
|
|
231
|
+
mode: "seed",
|
|
227
232
|
source: "types/pickle_response_approval.md",
|
|
228
233
|
target: "_types/pickle_response_approval.md",
|
|
229
234
|
digest: "sha256:944d2b68c158297f5d2a035fa6ff3c81a7098531f77a9bc3342dc9435ffcb8b8"
|
|
230
235
|
},
|
|
231
236
|
{
|
|
232
237
|
kind: "type",
|
|
238
|
+
mode: "seed",
|
|
233
239
|
source: "types/pickle_response_ack.md",
|
|
234
240
|
target: "_types/pickle_response_ack.md",
|
|
235
241
|
digest: "sha256:2530c8d21bb711889f20e0d096045cb6c9a7618583b1e2afff7ada72367de41f"
|
|
@@ -254,5 +260,9 @@ export const PICKLE_TYPE_PACK_PROVISION = {
|
|
|
254
260
|
document: PICKLE_ACK_RESPONSE_TYPE_DOCUMENT
|
|
255
261
|
}
|
|
256
262
|
],
|
|
257
|
-
provides: [{
|
|
263
|
+
provides: [{
|
|
264
|
+
id: "pickle.request",
|
|
265
|
+
version: "1.0.0",
|
|
266
|
+
digest: PICKLE_REQUEST_CONTRACT_DIGEST
|
|
267
|
+
}]
|
|
258
268
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdbase-dev/pickle",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.27",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@mdbase-dev/connect": "0.1.0-beta.
|
|
26
|
-
"@mdbase-dev/connect-protocol": "0.1.0-beta.
|
|
25
|
+
"@mdbase-dev/connect": "0.1.0-beta.27",
|
|
26
|
+
"@mdbase-dev/connect-protocol": "0.1.0-beta.27"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"typescript": "^7.0.2",
|
|
30
30
|
"vitest": "^4.1.10",
|
|
31
|
-
"@mdbase-dev/connect-dev": "0.1.0-beta.
|
|
31
|
+
"@mdbase-dev/connect-dev": "0.1.0-beta.27"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",
|