@kelpie/schemas 0.7.0 → 0.9.0
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/account.d.ts +35 -0
- package/dist/account.d.ts.map +1 -1
- package/dist/account.js +18 -0
- package/dist/account.js.map +1 -1
- package/dist/company.d.ts +11 -0
- package/dist/company.d.ts.map +1 -1
- package/dist/company.js +7 -0
- package/dist/company.js.map +1 -1
- package/dist/consentPurpose.d.ts +49 -0
- package/dist/consentPurpose.d.ts.map +1 -0
- package/dist/consentPurpose.js +40 -0
- package/dist/consentPurpose.js.map +1 -0
- package/dist/customField.d.ts +99 -0
- package/dist/customField.d.ts.map +1 -0
- package/dist/customField.js +133 -0
- package/dist/customField.js.map +1 -0
- package/dist/deal.d.ts +8 -0
- package/dist/deal.d.ts.map +1 -1
- package/dist/deal.js +4 -0
- package/dist/deal.js.map +1 -1
- package/dist/emailDomainLinker.d.ts +16 -0
- package/dist/emailDomainLinker.d.ts.map +1 -0
- package/dist/emailDomainLinker.js +11 -0
- package/dist/emailDomainLinker.js.map +1 -0
- package/dist/enquiry.d.ts +43 -0
- package/dist/enquiry.d.ts.map +1 -0
- package/dist/enquiry.js +47 -0
- package/dist/enquiry.js.map +1 -0
- package/dist/form.d.ts +117 -2
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +102 -1
- package/dist/form.js.map +1 -1
- package/dist/formSubmission.d.ts +29 -0
- package/dist/formSubmission.d.ts.map +1 -1
- package/dist/formSubmission.js +34 -0
- package/dist/formSubmission.js.map +1 -1
- package/dist/importExport.d.ts +28 -4
- package/dist/importExport.d.ts.map +1 -1
- package/dist/importExport.js +25 -2
- package/dist/importExport.js.map +1 -1
- package/dist/index.d.ts +27 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/list.d.ts +44 -0
- package/dist/list.d.ts.map +1 -0
- package/dist/list.js +41 -0
- package/dist/list.js.map +1 -0
- package/dist/listMember.d.ts +24 -0
- package/dist/listMember.d.ts.map +1 -0
- package/dist/listMember.js +27 -0
- package/dist/listMember.js.map +1 -0
- package/dist/listMembership.d.ts +20 -0
- package/dist/listMembership.d.ts.map +1 -0
- package/dist/listMembership.js +23 -0
- package/dist/listMembership.js.map +1 -0
- package/dist/names.d.ts +43 -0
- package/dist/names.d.ts.map +1 -0
- package/dist/names.js +35 -0
- package/dist/names.js.map +1 -0
- package/dist/opportunity.d.ts +10 -0
- package/dist/opportunity.d.ts.map +1 -1
- package/dist/opportunity.js +7 -0
- package/dist/opportunity.js.map +1 -1
- package/dist/partnership.d.ts +8 -0
- package/dist/partnership.d.ts.map +1 -1
- package/dist/partnership.js +4 -0
- package/dist/partnership.js.map +1 -1
- package/dist/person.d.ts +42 -1
- package/dist/person.d.ts.map +1 -1
- package/dist/person.js +23 -0
- package/dist/person.js.map +1 -1
- package/dist/personConsent.d.ts +31 -0
- package/dist/personConsent.d.ts.map +1 -0
- package/dist/personConsent.js +27 -0
- package/dist/personConsent.js.map +1 -0
- package/dist/raise.d.ts +8 -0
- package/dist/raise.d.ts.map +1 -1
- package/dist/raise.js +4 -0
- package/dist/raise.js.map +1 -1
- package/dist/sampleData.d.ts +23 -0
- package/dist/sampleData.d.ts.map +1 -0
- package/dist/sampleData.js +31 -0
- package/dist/sampleData.js.map +1 -0
- package/dist/values.d.ts +88 -8
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +150 -3
- package/dist/values.js.map +1 -1
- package/package.json +1 -1
- package/src/account.ts +56 -0
- package/src/company.ts +19 -0
- package/src/consentPurpose.ts +95 -0
- package/src/customField.ts +211 -0
- package/src/deal.ts +13 -0
- package/src/emailDomainLinker.ts +28 -0
- package/src/enquiry.ts +94 -0
- package/src/form.ts +230 -2
- package/src/formSubmission.ts +63 -0
- package/src/importExport.ts +45 -6
- package/src/index.ts +86 -2
- package/src/list.ts +89 -0
- package/src/listMember.ts +54 -0
- package/src/listMembership.ts +45 -0
- package/src/names.ts +49 -0
- package/src/opportunity.ts +18 -0
- package/src/partnership.ts +13 -0
- package/src/person.ts +69 -1
- package/src/personConsent.ts +60 -0
- package/src/raise.ts +13 -0
- package/src/sampleData.ts +55 -0
- package/src/values.ts +180 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { RecordTargetType } from './values.ts';
|
|
3
|
+
/**
|
|
4
|
+
* "Which lists is this record on?" — a membership joined with its list.
|
|
5
|
+
*
|
|
6
|
+
* Returned by `GET /v1/list-memberships?target_type=X&target_id=Y`. The joined
|
|
7
|
+
* list fields (`listName`, `listTargetType`) come along because a record's
|
|
8
|
+
* detail page wants to render its chips without a follow-up call per list.
|
|
9
|
+
*/
|
|
10
|
+
export interface ListMembership {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly listId: string;
|
|
13
|
+
readonly listName: string;
|
|
14
|
+
readonly listTargetType: RecordTargetType;
|
|
15
|
+
readonly targetType: RecordTargetType;
|
|
16
|
+
readonly targetId: string;
|
|
17
|
+
readonly addedAt: Date;
|
|
18
|
+
}
|
|
19
|
+
export declare const listMembershipSchema: z.ZodType<ListMembership, unknown>;
|
|
20
|
+
//# sourceMappingURL=listMembership.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listMembership.d.ts","sourceRoot":"","sources":["../src/listMembership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAGnD;;;;;;GAMG;AAEH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,cAAc,EAAE,gBAAgB,CAAA;IACzC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAA;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAA;CACvB;AAED,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAoBjE,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { RECORD_TARGET_TYPES } from './values.js';
|
|
3
|
+
import { idSchema, timestampSchema } from './wire.js';
|
|
4
|
+
export const listMembershipSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
id: idSchema,
|
|
7
|
+
list_id: idSchema,
|
|
8
|
+
list_name: z.string(),
|
|
9
|
+
list_target_type: z.enum(RECORD_TARGET_TYPES),
|
|
10
|
+
target_type: z.enum(RECORD_TARGET_TYPES),
|
|
11
|
+
target_id: idSchema,
|
|
12
|
+
added_at: timestampSchema,
|
|
13
|
+
})
|
|
14
|
+
.transform((wire) => ({
|
|
15
|
+
id: wire.id,
|
|
16
|
+
listId: wire.list_id,
|
|
17
|
+
listName: wire.list_name,
|
|
18
|
+
listTargetType: wire.list_target_type,
|
|
19
|
+
targetType: wire.target_type,
|
|
20
|
+
targetId: wire.target_id,
|
|
21
|
+
addedAt: wire.added_at,
|
|
22
|
+
}));
|
|
23
|
+
//# sourceMappingURL=listMembership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listMembership.js","sourceRoot":"","sources":["../src/listMembership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAoBrD,MAAM,CAAC,MAAM,oBAAoB,GAAuC,CAAC;KACtE,MAAM,CAAC;IACN,EAAE,EAAE,QAAQ;IACZ,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC;IAC7C,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC;IACxC,SAAS,EAAE,QAAQ;IACnB,QAAQ,EAAE,eAAe;CAC1B,CAAC;KACD,SAAS,CACR,CAAC,IAAI,EAAkB,EAAE,CAAC,CAAC;IACzB,EAAE,EAAE,IAAI,CAAC,EAAE;IACX,MAAM,EAAE,IAAI,CAAC,OAAO;IACpB,QAAQ,EAAE,IAAI,CAAC,SAAS;IACxB,cAAc,EAAE,IAAI,CAAC,gBAAgB;IACrC,UAAU,EAAE,IAAI,CAAC,WAAW;IAC5B,QAAQ,EAAE,IAAI,CAAC,SAAS;IACxB,OAAO,EAAE,IAAI,CAAC,QAAQ;CACvB,CAAC,CACH,CAAA"}
|
package/dist/names.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Building a person's display name out of its parts.
|
|
3
|
+
*
|
|
4
|
+
* One direction only. A name is composed when a caller supplied parts and no
|
|
5
|
+
* name; parts are never derived by splitting a name. Splitting is a guess, and a
|
|
6
|
+
* stored guess is indistinguishable from something a person typed: "van der
|
|
7
|
+
* Berg" is one surname written as three words, "Ursula K. Le Guin" is four
|
|
8
|
+
* tokens over two names, a mononym is neither a first nor a last name, and half
|
|
9
|
+
* the world writes the family name first. `name` stays the record's canonical
|
|
10
|
+
* display string, which is why every consumer that renders a person keeps
|
|
11
|
+
* reading it and nothing else.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The parts a display name is built from, in the order they are written.
|
|
15
|
+
*
|
|
16
|
+
* Each accepts `undefined` as well as `null` so that a caller holding either
|
|
17
|
+
* shape — a nullable column, an absent CSV cell, an omitted request field — can
|
|
18
|
+
* pass what it has without first flattening the two. Both mean the same thing
|
|
19
|
+
* here: nothing to contribute.
|
|
20
|
+
*/
|
|
21
|
+
export interface NameParts {
|
|
22
|
+
readonly firstName?: string | null | undefined;
|
|
23
|
+
readonly lastName?: string | null | undefined;
|
|
24
|
+
readonly suffix?: string | null | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The parts joined, single-spaced.
|
|
28
|
+
*
|
|
29
|
+
* `salutation` is deliberately not a parameter. "Mr" is a form of address rather
|
|
30
|
+
* than part of the name, and a list of people reading "Mr John Smith" is a list
|
|
31
|
+
* nobody asked for. vCard draws the same line: honorific prefixes sit in `N`,
|
|
32
|
+
* away from the `FN` a client displays.
|
|
33
|
+
*
|
|
34
|
+
* The order is fixed rather than per-locale, because this composes a *fallback*
|
|
35
|
+
* for a record that arrived without a display name. A workspace that writes the
|
|
36
|
+
* family name first sets `name` itself, which is the whole reason that field is
|
|
37
|
+
* the canonical one.
|
|
38
|
+
*
|
|
39
|
+
* @returns The composed name, or `''` when no part carried anything. An empty
|
|
40
|
+
* answer is the caller's signal that there is nothing here to fall back to.
|
|
41
|
+
*/
|
|
42
|
+
export declare function composeName(parts: NameParts): string;
|
|
43
|
+
//# sourceMappingURL=names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../src/names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAC5C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAKpD"}
|
package/dist/names.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Building a person's display name out of its parts.
|
|
3
|
+
*
|
|
4
|
+
* One direction only. A name is composed when a caller supplied parts and no
|
|
5
|
+
* name; parts are never derived by splitting a name. Splitting is a guess, and a
|
|
6
|
+
* stored guess is indistinguishable from something a person typed: "van der
|
|
7
|
+
* Berg" is one surname written as three words, "Ursula K. Le Guin" is four
|
|
8
|
+
* tokens over two names, a mononym is neither a first nor a last name, and half
|
|
9
|
+
* the world writes the family name first. `name` stays the record's canonical
|
|
10
|
+
* display string, which is why every consumer that renders a person keeps
|
|
11
|
+
* reading it and nothing else.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The parts joined, single-spaced.
|
|
15
|
+
*
|
|
16
|
+
* `salutation` is deliberately not a parameter. "Mr" is a form of address rather
|
|
17
|
+
* than part of the name, and a list of people reading "Mr John Smith" is a list
|
|
18
|
+
* nobody asked for. vCard draws the same line: honorific prefixes sit in `N`,
|
|
19
|
+
* away from the `FN` a client displays.
|
|
20
|
+
*
|
|
21
|
+
* The order is fixed rather than per-locale, because this composes a *fallback*
|
|
22
|
+
* for a record that arrived without a display name. A workspace that writes the
|
|
23
|
+
* family name first sets `name` itself, which is the whole reason that field is
|
|
24
|
+
* the canonical one.
|
|
25
|
+
*
|
|
26
|
+
* @returns The composed name, or `''` when no part carried anything. An empty
|
|
27
|
+
* answer is the caller's signal that there is nothing here to fall back to.
|
|
28
|
+
*/
|
|
29
|
+
export function composeName(parts) {
|
|
30
|
+
return [parts.firstName, parts.lastName, parts.suffix]
|
|
31
|
+
.map((part) => (part ?? '').trim())
|
|
32
|
+
.filter((part) => part.length > 0)
|
|
33
|
+
.join(' ');
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.js","sourceRoot":"","sources":["../src/names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAgBH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgB;IAC1C,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;SACnD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;SAClC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC"}
|
package/dist/opportunity.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { CustomFieldValue, CustomFieldValues } from './customField.ts';
|
|
2
3
|
import type { RecordTimestamps } from './wire.ts';
|
|
3
4
|
/** Wire and write shapes for `/v1/opportunities`. */
|
|
4
5
|
export interface Opportunity extends RecordTimestamps {
|
|
@@ -12,8 +13,11 @@ export interface Opportunity extends RecordTimestamps {
|
|
|
12
13
|
readonly ownerId: string | null;
|
|
13
14
|
/** `YYYY-MM-DD`, per `api.md` date-only fields. */
|
|
14
15
|
readonly expectedClose: string | null;
|
|
16
|
+
readonly personIds: readonly string[];
|
|
15
17
|
readonly summary: string;
|
|
16
18
|
readonly tags: readonly string[];
|
|
19
|
+
/** Workspace-defined fields, keyed by definition key. Always present (default `{}`). */
|
|
20
|
+
readonly customFields: CustomFieldValues;
|
|
17
21
|
}
|
|
18
22
|
export declare const opportunitySchema: z.ZodType<Opportunity, unknown>;
|
|
19
23
|
export interface OpportunityInput {
|
|
@@ -23,8 +27,14 @@ export interface OpportunityInput {
|
|
|
23
27
|
readonly companyId?: string | null;
|
|
24
28
|
readonly ownerId?: string | null;
|
|
25
29
|
readonly expectedClose?: string | null;
|
|
30
|
+
readonly personIds?: readonly string[];
|
|
26
31
|
readonly summary?: string;
|
|
27
32
|
readonly tags?: readonly string[];
|
|
33
|
+
/**
|
|
34
|
+
* Partial merge patch: sent keys change, `null` clears a key, absent keys are
|
|
35
|
+
* left alone. Unknown keys are rejected at `422`.
|
|
36
|
+
*/
|
|
37
|
+
readonly customFields?: Readonly<Record<string, CustomFieldValue | null>>;
|
|
28
38
|
}
|
|
29
39
|
export declare function opportunityBody(input: OpportunityInput): Record<string, unknown>;
|
|
30
40
|
//# sourceMappingURL=opportunity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opportunity.d.ts","sourceRoot":"","sources":["../src/opportunity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD,qDAAqD;AAErD,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACnD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,kGAAkG;IAClG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"opportunity.d.ts","sourceRoot":"","sources":["../src/opportunity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAE3E,OA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AC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAA;CAC1E;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAchF"}
|
package/dist/opportunity.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { customFieldValuesBody, customFieldValuesSchema } from './customField.js';
|
|
2
3
|
import { definedFields, idSchema, recordTimestamps } from './wire.js';
|
|
3
4
|
export const opportunitySchema = z
|
|
4
5
|
.object({
|
|
@@ -9,8 +10,10 @@ export const opportunitySchema = z
|
|
|
9
10
|
company_id: idSchema.nullable(),
|
|
10
11
|
owner_id: idSchema.nullable(),
|
|
11
12
|
expected_close: z.string().nullable(),
|
|
13
|
+
person_ids: z.array(idSchema),
|
|
12
14
|
summary: z.string(),
|
|
13
15
|
tags: z.array(z.string()),
|
|
16
|
+
custom_fields: customFieldValuesSchema,
|
|
14
17
|
...recordTimestamps,
|
|
15
18
|
})
|
|
16
19
|
.transform((wire) => ({
|
|
@@ -21,8 +24,10 @@ export const opportunitySchema = z
|
|
|
21
24
|
companyId: wire.company_id,
|
|
22
25
|
ownerId: wire.owner_id,
|
|
23
26
|
expectedClose: wire.expected_close,
|
|
27
|
+
personIds: wire.person_ids,
|
|
24
28
|
summary: wire.summary,
|
|
25
29
|
tags: wire.tags,
|
|
30
|
+
customFields: wire.custom_fields,
|
|
26
31
|
createdAt: wire.created_at,
|
|
27
32
|
updatedAt: wire.updated_at,
|
|
28
33
|
}));
|
|
@@ -34,8 +39,10 @@ export function opportunityBody(input) {
|
|
|
34
39
|
company_id: input.companyId,
|
|
35
40
|
owner_id: input.ownerId,
|
|
36
41
|
expected_close: input.expectedClose,
|
|
42
|
+
person_ids: input.personIds,
|
|
37
43
|
summary: input.summary,
|
|
38
44
|
tags: input.tags,
|
|
45
|
+
custom_fields: input.customFields === undefined ? undefined : customFieldValuesBody(input.customFields),
|
|
39
46
|
});
|
|
40
47
|
}
|
|
41
48
|
//# sourceMappingURL=opportunity.js.map
|
package/dist/opportunity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opportunity.js","sourceRoot":"","sources":["../src/opportunity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"opportunity.js","sourceRoot":"","sources":["../src/opportunity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAEjF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAuBrE,MAAM,CAAC,MAAM,iBAAiB,GAAoC,CAAC;KAChE,MAAM,CAAC;IACN,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,QAAQ,CAAC,QAAQ,EAAE;IAC/B,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE;IAC7B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC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ED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { CustomFieldValue, CustomFieldValues } from './customField.ts';
|
|
2
3
|
import type { RecordTimestamps } from './wire.ts';
|
|
3
4
|
/** Wire and write shapes for `/v1/partnerships`. */
|
|
4
5
|
export interface Partnership extends RecordTimestamps {
|
|
@@ -17,6 +18,8 @@ export interface Partnership extends RecordTimestamps {
|
|
|
17
18
|
readonly personIds: readonly string[];
|
|
18
19
|
readonly summary: string;
|
|
19
20
|
readonly tags: readonly string[];
|
|
21
|
+
/** Workspace-defined fields, keyed by definition key. Always present (default `{}`). */
|
|
22
|
+
readonly customFields: CustomFieldValues;
|
|
20
23
|
}
|
|
21
24
|
export declare const partnershipSchema: z.ZodType<Partnership, unknown>;
|
|
22
25
|
export interface PartnershipInput {
|
|
@@ -31,6 +34,11 @@ export interface PartnershipInput {
|
|
|
31
34
|
readonly personIds?: readonly string[];
|
|
32
35
|
readonly summary?: string;
|
|
33
36
|
readonly tags?: readonly string[];
|
|
37
|
+
/**
|
|
38
|
+
* Partial merge patch: sent keys change, `null` clears a key, absent keys are
|
|
39
|
+
* left alone. Unknown keys are rejected at `422`.
|
|
40
|
+
*/
|
|
41
|
+
readonly customFields?: Readonly<Record<string, CustomFieldValue | null>>;
|
|
34
42
|
}
|
|
35
43
|
export declare function partnershipBody(input: PartnershipInput): Record<string, unknown>;
|
|
36
44
|
//# sourceMappingURL=partnership.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partnership.d.ts","sourceRoot":"","sources":["../src/partnership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD,oDAAoD;AAEpD,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACnD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,I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,EAAE,OAAO,CAAC,CAgBhF"}
|
package/dist/partnership.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { customFieldValuesBody, customFieldValuesSchema } from './customField.js';
|
|
2
3
|
import { definedFields, idSchema, recordTimestamps } from './wire.js';
|
|
3
4
|
export const partnershipSchema = z
|
|
4
5
|
.object({
|
|
@@ -14,6 +15,7 @@ export const partnershipSchema = z
|
|
|
14
15
|
person_ids: z.array(idSchema),
|
|
15
16
|
summary: z.string(),
|
|
16
17
|
tags: z.array(z.string()),
|
|
18
|
+
custom_fields: customFieldValuesSchema,
|
|
17
19
|
...recordTimestamps,
|
|
18
20
|
})
|
|
19
21
|
.transform((wire) => ({
|
|
@@ -29,6 +31,7 @@ export const partnershipSchema = z
|
|
|
29
31
|
personIds: wire.person_ids,
|
|
30
32
|
summary: wire.summary,
|
|
31
33
|
tags: wire.tags,
|
|
34
|
+
customFields: wire.custom_fields,
|
|
32
35
|
createdAt: wire.created_at,
|
|
33
36
|
updatedAt: wire.updated_at,
|
|
34
37
|
}));
|
|
@@ -45,6 +48,7 @@ export function partnershipBody(input) {
|
|
|
45
48
|
person_ids: input.personIds,
|
|
46
49
|
summary: input.summary,
|
|
47
50
|
tags: input.tags,
|
|
51
|
+
custom_fields: input.customFields === undefined ? undefined : customFieldValuesBody(input.customFields),
|
|
48
52
|
});
|
|
49
53
|
}
|
|
50
54
|
//# sourceMappingURL=partnership.js.map
|
package/dist/partnership.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partnership.js","sourceRoot":"","sources":["../src/partnership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"partnership.js","sourceRoot":"","sources":["../src/partnership.ts"],"names":[],"mappings":"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,SAAS,EAAE,IAAI,CAAC,UAAU;IAC1B,OAAO,EAAE,IAAI,CAAC,OAAO;IACrB,IAAI,EAAE,IAAI,CAAC,IAAI;IACf,YAAY,EAAE,IAAI,CAAC,aAAa;IAChC,SAAS,EAAE,IAAI,CAAC,UAAU;IAC1B,SAAS,EAAE,IAAI,CAAC,UAAU;CAC3B,CAAC,CACH,CAAA;AAqBH,MAAM,UAAU,eAAe,CAAC,KAAuB;IACrD,OAAO,aAAa,CAAC;QACnB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,UAAU,EAAE,KAAK,CAAC,SAAS;QAC3B,QAAQ,EAAE,KAAK,CAAC,OAAO;QACvB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,eAAe,EAAE,KAAK,CAAC,cAAc;QACrC,QAAQ,EAAE,KAAK,CAAC,OAAO;QACvB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,kBAAkB,EAAE,KAAK,CAAC,gBAAgB;QAC1C,UAAU,EAAE,KAAK,CAAC,SAAS;QAC3B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,aAAa,EACX,KAAK,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,YAAY,CAAC;KAC3F,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/person.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { CustomFieldValue, CustomFieldValues } from './customField.ts';
|
|
3
|
+
import type { PersonConsent, PersonConsentInput } from './personConsent.ts';
|
|
2
4
|
import type { Influence, PreferredChannel, Relationship, SocialNetworkId } from './values.ts';
|
|
3
5
|
import type { RecordTimestamps } from './wire.ts';
|
|
4
6
|
/** Wire and write shapes for `/v1/people`. Job title is not here: it lives on Position. */
|
|
@@ -8,7 +10,19 @@ export interface SocialProfile {
|
|
|
8
10
|
}
|
|
9
11
|
export interface Person extends RecordTimestamps {
|
|
10
12
|
readonly id: string;
|
|
13
|
+
/**
|
|
14
|
+
* What to call this person: the canonical display string, and the only name
|
|
15
|
+
* field every consumer reads. The parts below are optional detail beside it,
|
|
16
|
+
* never a replacement for it, so a mononym and a four-part name are both just
|
|
17
|
+
* a `name`.
|
|
18
|
+
*/
|
|
11
19
|
readonly name: string;
|
|
20
|
+
/** A form of address — "Dr", "Ms". Not a job title: that is on Position. */
|
|
21
|
+
readonly salutation: string | null;
|
|
22
|
+
readonly firstName: string | null;
|
|
23
|
+
readonly lastName: string | null;
|
|
24
|
+
/** A generational or post-nominal suffix — "Jr", "III", "PhD". */
|
|
25
|
+
readonly suffix: string | null;
|
|
12
26
|
readonly email: string | null;
|
|
13
27
|
readonly phones: readonly string[];
|
|
14
28
|
readonly socialProfiles: readonly SocialProfile[];
|
|
@@ -20,15 +34,30 @@ export interface Person extends RecordTimestamps {
|
|
|
20
34
|
readonly summary: string;
|
|
21
35
|
readonly tags: readonly string[];
|
|
22
36
|
readonly lastContactedAt: Date | null;
|
|
37
|
+
/** The Article 21 objection. Global, independent of consent purposes. */
|
|
38
|
+
readonly doNotContact: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* One entry per workspace consent purpose, with the effective status
|
|
41
|
+
* (an explicit `person_consents` row if one exists, else the purpose's
|
|
42
|
+
* `default_status`). Ordered by the purpose's `sort_order`.
|
|
43
|
+
*/
|
|
44
|
+
readonly consents: readonly PersonConsent[];
|
|
45
|
+
/** Workspace-defined fields, keyed by definition key. Always present (default `{}`). */
|
|
46
|
+
readonly customFields: CustomFieldValues;
|
|
23
47
|
}
|
|
24
48
|
export declare const personSchema: z.ZodType<Person, unknown>;
|
|
25
49
|
/**
|
|
26
50
|
* A create or update body. Every field is optional because `POST` defaults all
|
|
27
51
|
* but `name` server-side and `PATCH` sends only what changed; `name` is required
|
|
28
|
-
* on create by the route, not by this type
|
|
52
|
+
* on create by the route, not by this type — and a create may send `first_name`
|
|
53
|
+
* and `last_name` instead, which the route composes a `name` from.
|
|
29
54
|
*/
|
|
30
55
|
export interface PersonInput {
|
|
31
56
|
readonly name?: string;
|
|
57
|
+
readonly salutation?: string | null;
|
|
58
|
+
readonly firstName?: string | null;
|
|
59
|
+
readonly lastName?: string | null;
|
|
60
|
+
readonly suffix?: string | null;
|
|
32
61
|
readonly email?: string | null;
|
|
33
62
|
readonly phones?: readonly string[];
|
|
34
63
|
readonly socialProfiles?: readonly SocialProfile[];
|
|
@@ -40,6 +69,18 @@ export interface PersonInput {
|
|
|
40
69
|
readonly summary?: string;
|
|
41
70
|
readonly tags?: readonly string[];
|
|
42
71
|
readonly lastContactedAt?: Date | null;
|
|
72
|
+
readonly doNotContact?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Manual override of one or more consent purposes. Each entry upserts a
|
|
75
|
+
* `person_consents` row (`source: manual`); `status: null` clears the row
|
|
76
|
+
* and inherits the purpose's default. Absent purposes are left alone.
|
|
77
|
+
*/
|
|
78
|
+
readonly consents?: readonly PersonConsentInput[];
|
|
79
|
+
/**
|
|
80
|
+
* Partial merge patch: sent keys change, `null` clears a key, absent keys are
|
|
81
|
+
* left alone. Unknown keys are rejected at `422`.
|
|
82
|
+
*/
|
|
83
|
+
readonly customFields?: Readonly<Record<string, CustomFieldValue | null>>;
|
|
43
84
|
}
|
|
44
85
|
export declare function personBody(input: PersonInput): Record<string, unknown>;
|
|
45
86
|
//# sourceMappingURL=person.d.ts.map
|
package/dist/person.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.d.ts","sourceRoot":"","sources":["../src/person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"person.d.ts","sourceRoot":"","sources":["../src/person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,OAAO,KAAK,EAA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;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,QAAQ,CAAC,eAAe,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IACjD;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAA;CAC1E;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0BtE"}
|
package/dist/person.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { customFieldValuesBody, customFieldValuesSchema, } from './customField.js';
|
|
3
|
+
import { personConsentSchema, personConsentWriteBody } from './personConsent.js';
|
|
2
4
|
import { INFLUENCE_LEVELS, PREFERRED_CHANNELS, RELATIONSHIP_LEVELS, SOCIAL_NETWORK_IDS, } from './values.js';
|
|
3
5
|
import { definedFields, idSchema, nullableTimestampSchema, recordTimestamps } from './wire.js';
|
|
4
6
|
const socialProfileSchema = z.object({
|
|
@@ -9,6 +11,10 @@ export const personSchema = z
|
|
|
9
11
|
.object({
|
|
10
12
|
id: idSchema,
|
|
11
13
|
name: z.string(),
|
|
14
|
+
salutation: z.string().nullable(),
|
|
15
|
+
first_name: z.string().nullable(),
|
|
16
|
+
last_name: z.string().nullable(),
|
|
17
|
+
suffix: z.string().nullable(),
|
|
12
18
|
email: z.string().nullable(),
|
|
13
19
|
phones: z.array(z.string()),
|
|
14
20
|
social_profiles: z.array(socialProfileSchema),
|
|
@@ -20,11 +26,18 @@ export const personSchema = z
|
|
|
20
26
|
summary: z.string(),
|
|
21
27
|
tags: z.array(z.string()),
|
|
22
28
|
last_contacted_at: nullableTimestampSchema,
|
|
29
|
+
do_not_contact: z.boolean(),
|
|
30
|
+
consents: z.array(personConsentSchema),
|
|
31
|
+
custom_fields: customFieldValuesSchema,
|
|
23
32
|
...recordTimestamps,
|
|
24
33
|
})
|
|
25
34
|
.transform((wire) => ({
|
|
26
35
|
id: wire.id,
|
|
27
36
|
name: wire.name,
|
|
37
|
+
salutation: wire.salutation,
|
|
38
|
+
firstName: wire.first_name,
|
|
39
|
+
lastName: wire.last_name,
|
|
40
|
+
suffix: wire.suffix,
|
|
28
41
|
email: wire.email,
|
|
29
42
|
phones: wire.phones,
|
|
30
43
|
socialProfiles: wire.social_profiles,
|
|
@@ -36,12 +49,19 @@ export const personSchema = z
|
|
|
36
49
|
summary: wire.summary,
|
|
37
50
|
tags: wire.tags,
|
|
38
51
|
lastContactedAt: wire.last_contacted_at,
|
|
52
|
+
doNotContact: wire.do_not_contact,
|
|
53
|
+
consents: wire.consents,
|
|
54
|
+
customFields: wire.custom_fields,
|
|
39
55
|
createdAt: wire.created_at,
|
|
40
56
|
updatedAt: wire.updated_at,
|
|
41
57
|
}));
|
|
42
58
|
export function personBody(input) {
|
|
43
59
|
return definedFields({
|
|
44
60
|
name: input.name,
|
|
61
|
+
salutation: input.salutation,
|
|
62
|
+
first_name: input.firstName,
|
|
63
|
+
last_name: input.lastName,
|
|
64
|
+
suffix: input.suffix,
|
|
45
65
|
email: input.email,
|
|
46
66
|
phones: input.phones,
|
|
47
67
|
social_profiles: input.socialProfiles,
|
|
@@ -55,6 +75,9 @@ export function personBody(input) {
|
|
|
55
75
|
last_contacted_at: input.lastContactedAt === undefined || input.lastContactedAt === null
|
|
56
76
|
? input.lastContactedAt
|
|
57
77
|
: input.lastContactedAt.toISOString(),
|
|
78
|
+
do_not_contact: input.doNotContact,
|
|
79
|
+
consents: input.consents?.map(personConsentWriteBody),
|
|
80
|
+
custom_fields: input.customFields === undefined ? undefined : customFieldValuesBody(input.customFields),
|
|
58
81
|
});
|
|
59
82
|
}
|
|
60
83
|
//# sourceMappingURL=person.js.map
|
package/dist/person.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.js","sourceRoot":"","sources":["../src/person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"person.js","sourceRoot":"","sources":["../src/person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAEhF,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAgD9F,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC;IACnC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,YAAY,GAA+B,CAAC;KACtD,MAAM,CAAC;IACN,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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tB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,iBAAiB,EACf,KAAK,CAAC,eAAe,KAAK,SAAS,IAAI,KAAK,CAAC,eAAe,KAAK,IAAI;YACnE,CAAC,CAAC,KAAK,CAAC,eAAe;YACvB,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,WAAW,EAAE;QACzC,cAAc,EAAE,KAAK,CAAC,YAAY;QAClC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC;QACrD,aAAa,EACX,KAAK,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,YAAY,CAAC;KAC3F,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ConsentPurposeStatus, ConsentStatus } from './values.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The effective consent status for a (person, purpose) pair.
|
|
5
|
+
*
|
|
6
|
+
* `inherited: true` means the person has no explicit `person_consents` row for
|
|
7
|
+
* the purpose and the reader is looking at the purpose's `default_status`. In
|
|
8
|
+
* that case `source` and `notedAt` are null. `inherited: false` means the row
|
|
9
|
+
* exists and carries its own `granted | withdrawn`, `source`, and `notedAt`.
|
|
10
|
+
*/
|
|
11
|
+
export interface PersonConsent {
|
|
12
|
+
/** The purpose's slug — the identity that survives a rename of its label. */
|
|
13
|
+
readonly purposeSlug: string;
|
|
14
|
+
readonly purposeLabel: string;
|
|
15
|
+
readonly status: ConsentPurposeStatus;
|
|
16
|
+
readonly source: string | null;
|
|
17
|
+
readonly notedAt: Date | null;
|
|
18
|
+
readonly inherited: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const personConsentSchema: z.ZodType<PersonConsent, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* What a manual override writes for one (person, purpose) pair. A `status` of
|
|
23
|
+
* `granted` or `withdrawn` upserts the row (`source: manual`); a `null` status
|
|
24
|
+
* clears the row and falls the pair back to the purpose's default.
|
|
25
|
+
*/
|
|
26
|
+
export interface PersonConsentInput {
|
|
27
|
+
readonly purposeSlug: string;
|
|
28
|
+
readonly status: ConsentStatus | null;
|
|
29
|
+
}
|
|
30
|
+
export declare function personConsentWriteBody(input: PersonConsentInput): Record<string, unknown>;
|
|
31
|
+
//# sourceMappingURL=personConsent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personConsent.d.ts","sourceRoot":"","sources":["../src/personConsent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAGtE;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAA;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,OAAO,EAAE,IAAI,GAAG,IAAI,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AAED,eAAO,MAAM,mBAAmB,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAkB/D,CAAA;AAEH;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAA;CACtC;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKzF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CONSENT_PURPOSE_STATUSES } from './values.js';
|
|
3
|
+
import { definedFields, nullableTimestampSchema } from './wire.js';
|
|
4
|
+
export const personConsentSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
purpose_slug: z.string(),
|
|
7
|
+
purpose_label: z.string(),
|
|
8
|
+
status: z.enum(CONSENT_PURPOSE_STATUSES),
|
|
9
|
+
source: z.string().nullable(),
|
|
10
|
+
noted_at: nullableTimestampSchema,
|
|
11
|
+
inherited: z.boolean(),
|
|
12
|
+
})
|
|
13
|
+
.transform((wire) => ({
|
|
14
|
+
purposeSlug: wire.purpose_slug,
|
|
15
|
+
purposeLabel: wire.purpose_label,
|
|
16
|
+
status: wire.status,
|
|
17
|
+
source: wire.source,
|
|
18
|
+
notedAt: wire.noted_at,
|
|
19
|
+
inherited: wire.inherited,
|
|
20
|
+
}));
|
|
21
|
+
export function personConsentWriteBody(input) {
|
|
22
|
+
return definedFields({
|
|
23
|
+
purpose_slug: input.purposeSlug,
|
|
24
|
+
status: input.status,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=personConsent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personConsent.js","sourceRoot":"","sources":["../src/personConsent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAEtD,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAoBlE,MAAM,CAAC,MAAM,mBAAmB,GAAsC,CAAC;KACpE,MAAM,CAAC;IACN,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,uBAAuB;IACjC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC;KACD,SAAS,CACR,CAAC,IAAI,EAAiB,EAAE,CAAC,CAAC;IACxB,WAAW,EAAE,IAAI,CAAC,YAAY;IAC9B,YAAY,EAAE,IAAI,CAAC,aAAa;IAChC,MAAM,EAAE,IAAI,CAAC,MAAM;IACnB,MAAM,EAAE,IAAI,CAAC,MAAM;IACnB,OAAO,EAAE,IAAI,CAAC,QAAQ;IACtB,SAAS,EAAE,IAAI,CAAC,SAAS;CAC1B,CAAC,CACH,CAAA;AAYH,MAAM,UAAU,sBAAsB,CAAC,KAAyB;IAC9D,OAAO,aAAa,CAAC;QACnB,YAAY,EAAE,KAAK,CAAC,WAAW;QAC/B,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/raise.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { CustomFieldValue, CustomFieldValues } from './customField.ts';
|
|
2
3
|
import type { RecordTimestamps } from './wire.ts';
|
|
3
4
|
/** Wire and write shapes for `/v1/raises`. */
|
|
4
5
|
export interface Raise extends RecordTimestamps {
|
|
@@ -18,6 +19,8 @@ export interface Raise extends RecordTimestamps {
|
|
|
18
19
|
readonly personIds: readonly string[];
|
|
19
20
|
readonly summary: string;
|
|
20
21
|
readonly tags: readonly string[];
|
|
22
|
+
/** Workspace-defined fields, keyed by definition key. Always present (default `{}`). */
|
|
23
|
+
readonly customFields: CustomFieldValues;
|
|
21
24
|
}
|
|
22
25
|
export declare const raiseSchema: z.ZodType<Raise, unknown>;
|
|
23
26
|
export interface RaiseInput {
|
|
@@ -33,6 +36,11 @@ export interface RaiseInput {
|
|
|
33
36
|
readonly personIds?: readonly string[];
|
|
34
37
|
readonly summary?: string;
|
|
35
38
|
readonly tags?: readonly string[];
|
|
39
|
+
/**
|
|
40
|
+
* Partial merge patch: sent keys change, `null` clears a key, absent keys are
|
|
41
|
+
* left alone. Unknown keys are rejected at `422`.
|
|
42
|
+
*/
|
|
43
|
+
readonly customFields?: Readonly<Record<string, CustomFieldValue | null>>;
|
|
36
44
|
}
|
|
37
45
|
export declare function raiseBody(input: RaiseInput): Record<string, unknown>;
|
|
38
46
|
//# sourceMappingURL=raise.d.ts.map
|
package/dist/raise.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raise.d.ts","sourceRoot":"","sources":["../src/raise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD,8CAA8C;AAE9C,MAAM,WAAW,KAAM,SAAQ,gBAAgB;IAC7C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAA;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;
|
|
1
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,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAA;CAC1E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBpE"}
|
package/dist/raise.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { customFieldValuesBody, customFieldValuesSchema } from './customField.js';
|
|
2
3
|
import { definedFields, idSchema, recordTimestamps } from './wire.js';
|
|
3
4
|
export const raiseSchema = z
|
|
4
5
|
.object({
|
|
@@ -15,6 +16,7 @@ export const raiseSchema = z
|
|
|
15
16
|
person_ids: z.array(idSchema),
|
|
16
17
|
summary: z.string(),
|
|
17
18
|
tags: z.array(z.string()),
|
|
19
|
+
custom_fields: customFieldValuesSchema,
|
|
18
20
|
...recordTimestamps,
|
|
19
21
|
})
|
|
20
22
|
.transform((wire) => ({
|
|
@@ -31,6 +33,7 @@ export const raiseSchema = z
|
|
|
31
33
|
personIds: wire.person_ids,
|
|
32
34
|
summary: wire.summary,
|
|
33
35
|
tags: wire.tags,
|
|
36
|
+
customFields: wire.custom_fields,
|
|
34
37
|
createdAt: wire.created_at,
|
|
35
38
|
updatedAt: wire.updated_at,
|
|
36
39
|
}));
|
|
@@ -48,6 +51,7 @@ export function raiseBody(input) {
|
|
|
48
51
|
person_ids: input.personIds,
|
|
49
52
|
summary: input.summary,
|
|
50
53
|
tags: input.tags,
|
|
54
|
+
custom_fields: input.customFields === undefined ? undefined : customFieldValuesBody(input.customFields),
|
|
51
55
|
});
|
|
52
56
|
}
|
|
53
57
|
//# sourceMappingURL=raise.js.map
|
package/dist/raise.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raise.js","sourceRoot":"","sources":["../src/raise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"raise.js","sourceRoot":"","sources":["../src/raise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAEjF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AA0BrE,MAAM,CAAC,MAAM,WAAW,GAA8B,CAAC;KACpD,MAAM,CAAC;IACN,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,QAAQ;IACpB,QAAQ,EAAE,QAAQ;IAClB,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,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