@oxygen-agent/cli 1.720.7 → 1.739.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/README.md +1 -1
- package/dist/command-manifest.js +27 -12
- package/dist/index.js +227 -63
- package/dist/skills.js +2 -2
- package/node_modules/@oxygen/shared/dist/cli-result.js +2 -0
- package/node_modules/@oxygen/shared/dist/crm-activity-events.d.ts +20 -0
- package/node_modules/@oxygen/shared/dist/crm-activity-events.js +5 -0
- package/node_modules/@oxygen/shared/dist/future-signup-events.d.ts +27 -0
- package/node_modules/@oxygen/shared/dist/future-signup-events.js +90 -0
- package/node_modules/@oxygen/shared/dist/future-signup-lifecycle-projection.d.ts +320 -0
- package/node_modules/@oxygen/shared/dist/future-signup-lifecycle-projection.js +1233 -0
- package/node_modules/@oxygen/shared/dist/index.d.ts +6 -0
- package/node_modules/@oxygen/shared/dist/index.js +6 -0
- package/node_modules/@oxygen/shared/dist/notetaker-events.d.ts +4 -0
- package/node_modules/@oxygen/shared/dist/notetaker-events.js +23 -0
- package/node_modules/@oxygen/shared/dist/plain-support-events.d.ts +40 -0
- package/node_modules/@oxygen/shared/dist/plain-support-events.js +43 -0
- package/node_modules/@oxygen/shared/dist/redaction.js +6 -1
- package/node_modules/@oxygen/shared/dist/user-capability-routing.d.ts +2 -0
- package/node_modules/@oxygen/shared/dist/user-capability-routing.js +23 -0
- package/node_modules/@oxygen/shared/dist/version.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/version.js +1 -1
- package/node_modules/@oxygen/shared/dist/webhook-headers.d.ts +10 -0
- package/node_modules/@oxygen/shared/dist/webhook-headers.js +48 -0
- package/node_modules/@oxygen/shared/dist/workspace-event-catalog.d.ts +31 -1
- package/node_modules/@oxygen/shared/dist/workspace-event-catalog.js +112 -1
- package/node_modules/@oxygen/workflows/dist/graph/expression.js +7 -5
- package/node_modules/@oxygen/workflows/dist/graph/lint.d.ts +9 -0
- package/node_modules/@oxygen/workflows/dist/graph/lint.js +409 -7
- package/node_modules/@oxygen/workflows/dist/graph/manifest-schema.d.ts +513 -0
- package/node_modules/@oxygen/workflows/dist/graph/manifest-schema.js +104 -1
- package/node_modules/@oxygen/workflows/dist/graph/params.d.ts +2 -0
- package/node_modules/@oxygen/workflows/dist/graph/params.js +15 -0
- package/node_modules/@oxygen/workflows/dist/graph/remap.js +12 -3
- package/node_modules/@oxygen/workflows/dist/graph/topology.d.ts +9 -0
- package/node_modules/@oxygen/workflows/dist/graph/topology.js +33 -1
- package/node_modules/@oxygen/workflows/dist/graph/types.d.ts +123 -16
- package/node_modules/@oxygen/workflows/dist/graph/types.js +45 -0
- package/node_modules/@oxygen/workflows/dist/index.d.ts +94 -2
- package/node_modules/@oxygen/workflows/dist/index.js +169 -26
- package/node_modules/@oxygen/workflows/dist/portable.js +3 -1
- package/package.json +1 -1
|
@@ -74,6 +74,26 @@ export declare const CRM_ACTIVITY_EVENT_DEFINITIONS: readonly [{
|
|
|
74
74
|
readonly key: "signup";
|
|
75
75
|
readonly label: "Signup";
|
|
76
76
|
readonly group: "Signals";
|
|
77
|
+
}, {
|
|
78
|
+
readonly key: "product_activated";
|
|
79
|
+
readonly label: "Product activated";
|
|
80
|
+
readonly group: "Product lifecycle";
|
|
81
|
+
}, {
|
|
82
|
+
readonly key: "trial_started";
|
|
83
|
+
readonly label: "Free trial started";
|
|
84
|
+
readonly group: "Product lifecycle";
|
|
85
|
+
}, {
|
|
86
|
+
readonly key: "plan_paid";
|
|
87
|
+
readonly label: "Paid plan started";
|
|
88
|
+
readonly group: "Product lifecycle";
|
|
89
|
+
}, {
|
|
90
|
+
readonly key: "customer_lost";
|
|
91
|
+
readonly label: "Customer lost";
|
|
92
|
+
readonly group: "Product lifecycle";
|
|
93
|
+
}, {
|
|
94
|
+
readonly key: "workspace_deleted";
|
|
95
|
+
readonly label: "Workspace deleted";
|
|
96
|
+
readonly group: "Product lifecycle";
|
|
77
97
|
}, {
|
|
78
98
|
readonly key: "website_visit";
|
|
79
99
|
readonly label: "Website visit";
|
|
@@ -24,6 +24,11 @@ export const CRM_ACTIVITY_EVENT_DEFINITIONS = [
|
|
|
24
24
|
{ key: "sync_pushed", label: "CRM sync pushed", group: "CRM operations" },
|
|
25
25
|
{ key: "sync_pulled", label: "CRM sync pulled", group: "CRM operations" },
|
|
26
26
|
{ key: "signup", label: "Signup", group: "Signals" },
|
|
27
|
+
{ key: "product_activated", label: "Product activated", group: "Product lifecycle" },
|
|
28
|
+
{ key: "trial_started", label: "Free trial started", group: "Product lifecycle" },
|
|
29
|
+
{ key: "plan_paid", label: "Paid plan started", group: "Product lifecycle" },
|
|
30
|
+
{ key: "customer_lost", label: "Customer lost", group: "Product lifecycle" },
|
|
31
|
+
{ key: "workspace_deleted", label: "Workspace deleted", group: "Product lifecycle" },
|
|
27
32
|
{ key: "website_visit", label: "Website visit", group: "Signals" },
|
|
28
33
|
{ key: "profile_view", label: "Profile view", group: "Signals" },
|
|
29
34
|
{ key: "post_reaction", label: "Post reaction", group: "Signals" },
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const FUTURE_SIGNUP_CONTRACT_VERSION = "future_signup_crm_activation.v1";
|
|
2
|
+
export declare const FUTURE_SIGNUP_ACTIVATION_TAXONOMY_VERSION = "activation_commands.v1";
|
|
3
|
+
export declare const FUTURE_SIGNUP_LIFECYCLE_CONTRACT_VERSION = "future_signup_lifecycle.v1";
|
|
4
|
+
export declare const FUTURE_SIGNUP_LIFECYCLE_PROJECTION_CONTRACT_VERSION = "future_signup_lifecycle_projection.v1";
|
|
5
|
+
export declare const FUTURE_SIGNUP_CRM_DESTINATION = "oxygen_company_crm";
|
|
6
|
+
export declare const FUTURE_SIGNUP_ACTIVATION_COMMANDS: readonly ["agent create", "crm activity log", "crm assert", "crm object add-attr", "crm object create", "crm relationships define", "crm relationships upsert", "knowledge page upsert", "publishing posts create", "sequences create", "tables create", "tables duplicate", "tables import-csv", "tables import-file", "tables import-staged", "tables import-url", "tables insert", "tables relate", "tables update", "tables upsert", "workflows apply"];
|
|
7
|
+
export declare function isFutureSignupActivationCommand(command: string): boolean;
|
|
8
|
+
export declare function futureSignupJourneyId(clerkUserId: string): string;
|
|
9
|
+
export declare function futureSignupFactId(clerkUserId: string): string;
|
|
10
|
+
export declare function futureSignupOperationFactId(operationEventId: string): string;
|
|
11
|
+
export declare function futureSignupActivationFactId(clerkUserId: string): string;
|
|
12
|
+
export declare function futureSignupTrialStartedFactId(stripeSubscriptionId: string): string;
|
|
13
|
+
export declare function futureSignupPaidFactId(stripeInvoiceId: string): string;
|
|
14
|
+
export declare function futureSignupLostFactId(stripeSubscriptionId: string, lossKind: "paid_churn" | "trial_non_conversion"): string;
|
|
15
|
+
export declare function futureSignupSubscriptionEndedFactId(stripeSubscriptionId: string, terminationKind: "replaced" | "duplicate" | "unqualified"): string;
|
|
16
|
+
export declare function futureSignupWorkspaceDeletedFactId(clerkOrgId: string): string;
|
|
17
|
+
/** Immutable cause for membership, completeness, or Company-identity projection changes. */
|
|
18
|
+
export declare function futureSignupLifecycleProjectionRefreshFactId(clerkOrgId: string, sourceEventId: string): string;
|
|
19
|
+
export declare function futureSignupLifecycleProjectionFactId(sourceFactId: string): string;
|
|
20
|
+
export declare function futureSignupLifecycleAggregateId(clerkOrgId: string): string;
|
|
21
|
+
export declare function futureSignupLifecycleEventId(factId: string, factRevision: number): string;
|
|
22
|
+
export declare function isAtOrAfterFutureSignupCutover(input: {
|
|
23
|
+
clerkUserId: string;
|
|
24
|
+
signupAt: Date;
|
|
25
|
+
cutoverAt: Date;
|
|
26
|
+
clerkUserIdTiebreaker?: string;
|
|
27
|
+
}): boolean;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export const FUTURE_SIGNUP_CONTRACT_VERSION = "future_signup_crm_activation.v1";
|
|
2
|
+
export const FUTURE_SIGNUP_ACTIVATION_TAXONOMY_VERSION = "activation_commands.v1";
|
|
3
|
+
export const FUTURE_SIGNUP_LIFECYCLE_CONTRACT_VERSION = "future_signup_lifecycle.v1";
|
|
4
|
+
export const FUTURE_SIGNUP_LIFECYCLE_PROJECTION_CONTRACT_VERSION = "future_signup_lifecycle_projection.v1";
|
|
5
|
+
export const FUTURE_SIGNUP_CRM_DESTINATION = "oxygen_company_crm";
|
|
6
|
+
export const FUTURE_SIGNUP_ACTIVATION_COMMANDS = [
|
|
7
|
+
"agent create",
|
|
8
|
+
"crm activity log",
|
|
9
|
+
"crm assert",
|
|
10
|
+
"crm object add-attr",
|
|
11
|
+
"crm object create",
|
|
12
|
+
"crm relationships define",
|
|
13
|
+
"crm relationships upsert",
|
|
14
|
+
"knowledge page upsert",
|
|
15
|
+
"publishing posts create",
|
|
16
|
+
"sequences create",
|
|
17
|
+
"tables create",
|
|
18
|
+
"tables duplicate",
|
|
19
|
+
"tables import-csv",
|
|
20
|
+
"tables import-file",
|
|
21
|
+
"tables import-staged",
|
|
22
|
+
"tables import-url",
|
|
23
|
+
"tables insert",
|
|
24
|
+
"tables relate",
|
|
25
|
+
"tables update",
|
|
26
|
+
"tables upsert",
|
|
27
|
+
"workflows apply",
|
|
28
|
+
];
|
|
29
|
+
const ACTIVATION_COMMAND_SET = new Set(FUTURE_SIGNUP_ACTIVATION_COMMANDS);
|
|
30
|
+
export function isFutureSignupActivationCommand(command) {
|
|
31
|
+
return ACTIVATION_COMMAND_SET.has(command.trim().toLowerCase());
|
|
32
|
+
}
|
|
33
|
+
export function futureSignupJourneyId(clerkUserId) {
|
|
34
|
+
return `future_signup:v1:clerk_user:${requiredId(clerkUserId, "clerkUserId")}`;
|
|
35
|
+
}
|
|
36
|
+
export function futureSignupFactId(clerkUserId) {
|
|
37
|
+
return futureSignupJourneyId(clerkUserId);
|
|
38
|
+
}
|
|
39
|
+
export function futureSignupOperationFactId(operationEventId) {
|
|
40
|
+
return `product_operation:v1:${requiredId(operationEventId, "operationEventId")}`;
|
|
41
|
+
}
|
|
42
|
+
export function futureSignupActivationFactId(clerkUserId) {
|
|
43
|
+
return `product_activated:v1:${futureSignupFactId(clerkUserId)}`;
|
|
44
|
+
}
|
|
45
|
+
export function futureSignupTrialStartedFactId(stripeSubscriptionId) {
|
|
46
|
+
return `future_signup_lifecycle:trial_started:v1:${requiredId(stripeSubscriptionId, "stripeSubscriptionId")}`;
|
|
47
|
+
}
|
|
48
|
+
export function futureSignupPaidFactId(stripeInvoiceId) {
|
|
49
|
+
return `future_signup_lifecycle:paid:v1:${requiredId(stripeInvoiceId, "stripeInvoiceId")}`;
|
|
50
|
+
}
|
|
51
|
+
export function futureSignupLostFactId(stripeSubscriptionId, lossKind) {
|
|
52
|
+
return `future_signup_lifecycle:lost:v1:${requiredId(stripeSubscriptionId, "stripeSubscriptionId")}:${lossKind}`;
|
|
53
|
+
}
|
|
54
|
+
export function futureSignupSubscriptionEndedFactId(stripeSubscriptionId, terminationKind) {
|
|
55
|
+
return `future_signup_lifecycle:subscription_ended:v1:${requiredId(stripeSubscriptionId, "stripeSubscriptionId")}:${terminationKind}`;
|
|
56
|
+
}
|
|
57
|
+
export function futureSignupWorkspaceDeletedFactId(clerkOrgId) {
|
|
58
|
+
return `future_signup_lifecycle:workspace_deleted:v1:${requiredId(clerkOrgId, "clerkOrgId")}`;
|
|
59
|
+
}
|
|
60
|
+
/** Immutable cause for membership, completeness, or Company-identity projection changes. */
|
|
61
|
+
export function futureSignupLifecycleProjectionRefreshFactId(clerkOrgId, sourceEventId) {
|
|
62
|
+
return `future_signup_lifecycle:projection_refreshed:v1:${requiredId(clerkOrgId, "clerkOrgId")}:${requiredId(sourceEventId, "sourceEventId")}`;
|
|
63
|
+
}
|
|
64
|
+
export function futureSignupLifecycleProjectionFactId(sourceFactId) {
|
|
65
|
+
return `lifecycle_projection:v1:${requiredId(sourceFactId, "sourceFactId")}`;
|
|
66
|
+
}
|
|
67
|
+
export function futureSignupLifecycleAggregateId(clerkOrgId) {
|
|
68
|
+
return `lifecycle_aggregate:v1:clerk_org:${requiredId(clerkOrgId, "clerkOrgId")}`;
|
|
69
|
+
}
|
|
70
|
+
export function futureSignupLifecycleEventId(factId, factRevision) {
|
|
71
|
+
if (!Number.isInteger(factRevision) || factRevision < 1) {
|
|
72
|
+
throw new TypeError("factRevision must be a positive integer.");
|
|
73
|
+
}
|
|
74
|
+
return `${requiredId(factId, "factId")}:r${factRevision}`;
|
|
75
|
+
}
|
|
76
|
+
export function isAtOrAfterFutureSignupCutover(input) {
|
|
77
|
+
const signupMs = input.signupAt.getTime();
|
|
78
|
+
const cutoverMs = input.cutoverAt.getTime();
|
|
79
|
+
if (!Number.isFinite(signupMs) || !Number.isFinite(cutoverMs))
|
|
80
|
+
return false;
|
|
81
|
+
if (signupMs !== cutoverMs)
|
|
82
|
+
return signupMs > cutoverMs;
|
|
83
|
+
return input.clerkUserId.localeCompare(input.clerkUserIdTiebreaker ?? "") >= 0;
|
|
84
|
+
}
|
|
85
|
+
function requiredId(value, field) {
|
|
86
|
+
const normalized = value.trim();
|
|
87
|
+
if (!normalized)
|
|
88
|
+
throw new TypeError(`${field} is required.`);
|
|
89
|
+
return normalized;
|
|
90
|
+
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { FUTURE_SIGNUP_LIFECYCLE_CONTRACT_VERSION, FUTURE_SIGNUP_LIFECYCLE_PROJECTION_CONTRACT_VERSION } from "./future-signup-events.js";
|
|
2
|
+
/** Fixed destination-head authority. Contract upgrades cannot reset this stream. */
|
|
3
|
+
export declare const FUTURE_SIGNUP_LIFECYCLE_PROJECTION_AUTHORITY: "oxygen_product_lifecycle";
|
|
4
|
+
export declare const FUTURE_SIGNUP_LIFECYCLE_PROJECTION_FACT_TYPES: readonly ["trial_started", "paid", "lost", "subscription_ended", "workspace_deleted", "projection_refreshed"];
|
|
5
|
+
export declare const FUTURE_SIGNUP_LIFECYCLE_PROJECTION_BILLING_STAGES: readonly ["free_trial", "paid", "lost"];
|
|
6
|
+
export declare const FUTURE_SIGNUP_LIFECYCLE_PROJECTION_PREBILLING_STAGES: readonly ["lead", "interested", "demo_booked"];
|
|
7
|
+
export declare const FUTURE_SIGNUP_LIFECYCLE_PROJECTION_SEMANTIC_STAGES: readonly ["lead", "interested", "demo_booked", "free_trial", "paid", "lost"];
|
|
8
|
+
export declare const FUTURE_SIGNUP_LIFECYCLE_PROJECTION_ALIAS_TYPES: readonly ["clerk_organization", "clerk_user", "domain", "email", "stripe_customer"];
|
|
9
|
+
export declare const FUTURE_SIGNUP_LIFECYCLE_PROJECTION_ACTIVITY_TYPES: readonly ["trial_started", "plan_paid", "customer_lost", "workspace_deleted"];
|
|
10
|
+
export type FutureSignupLifecycleProjectionFactType = (typeof FUTURE_SIGNUP_LIFECYCLE_PROJECTION_FACT_TYPES)[number];
|
|
11
|
+
export type FutureSignupLifecycleProjectionBillingStage = (typeof FUTURE_SIGNUP_LIFECYCLE_PROJECTION_BILLING_STAGES)[number];
|
|
12
|
+
export type FutureSignupLifecycleProjectionPrebillingStage = (typeof FUTURE_SIGNUP_LIFECYCLE_PROJECTION_PREBILLING_STAGES)[number];
|
|
13
|
+
export type FutureSignupLifecycleProjectionSemanticStage = (typeof FUTURE_SIGNUP_LIFECYCLE_PROJECTION_SEMANTIC_STAGES)[number];
|
|
14
|
+
export type FutureSignupLifecycleProjectionAliasType = (typeof FUTURE_SIGNUP_LIFECYCLE_PROJECTION_ALIAS_TYPES)[number];
|
|
15
|
+
export type FutureSignupLifecycleProjectionActivityType = (typeof FUTURE_SIGNUP_LIFECYCLE_PROJECTION_ACTIVITY_TYPES)[number];
|
|
16
|
+
export type FutureSignupLifecycleProjectionSubjectKind = "company" | "person";
|
|
17
|
+
export type FutureSignupLifecycleProjectionAction = "upsert" | "neutralize";
|
|
18
|
+
export type FutureSignupLifecycleProjectionLossKind = "paid_churn" | "trial_non_conversion";
|
|
19
|
+
export type FutureSignupLifecycleProjectionTerminationKind = "replaced" | "duplicate" | "unqualified";
|
|
20
|
+
export type FutureSignupLifecycleProjectionMembershipRemovalReason = "member_removed" | "user_deleted" | "workspace_deleted";
|
|
21
|
+
export type FutureSignupLifecycleProjectionMembershipContributor = {
|
|
22
|
+
clerk_membership_id: string;
|
|
23
|
+
clerk_org_id: string;
|
|
24
|
+
role: string;
|
|
25
|
+
is_creator: boolean;
|
|
26
|
+
active: boolean;
|
|
27
|
+
removed_reason: FutureSignupLifecycleProjectionMembershipRemovalReason | null;
|
|
28
|
+
};
|
|
29
|
+
/** Exact subject shape already emitted by the shipped v1 control builder. */
|
|
30
|
+
export type FutureSignupLifecycleProjectionSubject = {
|
|
31
|
+
kind: FutureSignupLifecycleProjectionSubjectKind;
|
|
32
|
+
key: string;
|
|
33
|
+
billing_stage: FutureSignupLifecycleProjectionBillingStage | null;
|
|
34
|
+
stage_since: string | null;
|
|
35
|
+
aggregate_revision: number;
|
|
36
|
+
aggregate_fingerprint: string;
|
|
37
|
+
winning_clerk_org_id: string | null;
|
|
38
|
+
winning_fact_id: string | null;
|
|
39
|
+
winning_fact_revision: number | null;
|
|
40
|
+
source_state_revision: number;
|
|
41
|
+
membership_set_revision: number;
|
|
42
|
+
members_complete: true;
|
|
43
|
+
projection_action: FutureSignupLifecycleProjectionAction;
|
|
44
|
+
replacement_company_key: string | null;
|
|
45
|
+
departed_clerk_org_ids: string[];
|
|
46
|
+
oxygen_product_lifecycle: {
|
|
47
|
+
revision: number;
|
|
48
|
+
fingerprint: string;
|
|
49
|
+
};
|
|
50
|
+
external_identities: Array<{
|
|
51
|
+
provider: "clerk";
|
|
52
|
+
object: "user" | "organization";
|
|
53
|
+
id: string;
|
|
54
|
+
}>;
|
|
55
|
+
natural_identity: {
|
|
56
|
+
email: string | null;
|
|
57
|
+
domain: string | null;
|
|
58
|
+
};
|
|
59
|
+
display: {
|
|
60
|
+
first_name: string | null;
|
|
61
|
+
last_name: string | null;
|
|
62
|
+
company_name: string | null;
|
|
63
|
+
};
|
|
64
|
+
represented_clerk_org_ids: string[];
|
|
65
|
+
represented_company_keys: string[];
|
|
66
|
+
membership_ids: string[];
|
|
67
|
+
membership_contributors: FutureSignupLifecycleProjectionMembershipContributor[];
|
|
68
|
+
};
|
|
69
|
+
export type FutureSignupLifecycleProjectionOrganizationState = {
|
|
70
|
+
clerk_org_id: string;
|
|
71
|
+
company_key: string;
|
|
72
|
+
company_key_history: string[];
|
|
73
|
+
normalized_domain: string | null;
|
|
74
|
+
billing_stage: FutureSignupLifecycleProjectionBillingStage | null;
|
|
75
|
+
stage_since: string | null;
|
|
76
|
+
loss_kind: FutureSignupLifecycleProjectionLossKind | null;
|
|
77
|
+
winning_fact_id: string | null;
|
|
78
|
+
winning_fact_revision: number | null;
|
|
79
|
+
organization_revision: number;
|
|
80
|
+
billing_revision: number;
|
|
81
|
+
state_revision: number;
|
|
82
|
+
membership_set_revision: number;
|
|
83
|
+
members_complete: boolean;
|
|
84
|
+
state_fingerprint: string;
|
|
85
|
+
membership_set_fingerprint: string;
|
|
86
|
+
workspace_deleted_at: string | null;
|
|
87
|
+
workspace_deleted_fact_id: string | null;
|
|
88
|
+
workspace_deleted_fact_revision: number | null;
|
|
89
|
+
};
|
|
90
|
+
export type FutureSignupLifecycleProjectionMembershipState = {
|
|
91
|
+
clerk_membership_id: string;
|
|
92
|
+
journey_id: string | null;
|
|
93
|
+
clerk_user_id: string;
|
|
94
|
+
clerk_org_id: string;
|
|
95
|
+
role: string;
|
|
96
|
+
is_creator: boolean;
|
|
97
|
+
contributes_to_lifecycle: boolean;
|
|
98
|
+
membership_created_at: string;
|
|
99
|
+
membership_revision: number;
|
|
100
|
+
state_fingerprint: string;
|
|
101
|
+
removed_at: string | null;
|
|
102
|
+
removed_reason: FutureSignupLifecycleProjectionMembershipRemovalReason | null;
|
|
103
|
+
};
|
|
104
|
+
export type FutureSignupLifecycleProjectionSourceFact = {
|
|
105
|
+
fact_id: string;
|
|
106
|
+
fact_revision: number;
|
|
107
|
+
contract_version: typeof FUTURE_SIGNUP_LIFECYCLE_CONTRACT_VERSION;
|
|
108
|
+
fact_type: FutureSignupLifecycleProjectionFactType;
|
|
109
|
+
clerk_org_id: string;
|
|
110
|
+
occurred_at: string;
|
|
111
|
+
source: "clerk" | "clerk_org_deletion" | "stripe";
|
|
112
|
+
source_event_id: string;
|
|
113
|
+
source_revision: number;
|
|
114
|
+
stripe_customer_id: string | null;
|
|
115
|
+
stripe_subscription_id: string | null;
|
|
116
|
+
stripe_invoice_id: string | null;
|
|
117
|
+
stripe_period_start: string | null;
|
|
118
|
+
stripe_period_end: string | null;
|
|
119
|
+
amount_paid_cents: number | null;
|
|
120
|
+
currency: string | null;
|
|
121
|
+
loss_kind: FutureSignupLifecycleProjectionLossKind | null;
|
|
122
|
+
termination_kind: FutureSignupLifecycleProjectionTerminationKind | null;
|
|
123
|
+
};
|
|
124
|
+
export type FutureSignupLifecycleProjectionSnapshot = {
|
|
125
|
+
complete: true;
|
|
126
|
+
causal_clerk_org_id: string;
|
|
127
|
+
organization_states: FutureSignupLifecycleProjectionOrganizationState[];
|
|
128
|
+
membership_states: FutureSignupLifecycleProjectionMembershipState[];
|
|
129
|
+
subjects: FutureSignupLifecycleProjectionSubject[];
|
|
130
|
+
subject_set_fingerprint: string;
|
|
131
|
+
snapshot_fingerprint: string;
|
|
132
|
+
};
|
|
133
|
+
export type FutureSignupLifecycleProjectionActivity = {
|
|
134
|
+
type: FutureSignupLifecycleProjectionActivityType | "note";
|
|
135
|
+
source_provider: typeof FUTURE_SIGNUP_LIFECYCLE_PROJECTION_AUTHORITY;
|
|
136
|
+
provider_event_id: string;
|
|
137
|
+
occurred_at: string;
|
|
138
|
+
summary: string;
|
|
139
|
+
subject_keys: string[];
|
|
140
|
+
metadata: {
|
|
141
|
+
source_fact_id: string;
|
|
142
|
+
source_fact_revision: number;
|
|
143
|
+
causal_clerk_org_id: string;
|
|
144
|
+
loss_kind: FutureSignupLifecycleProjectionLossKind | null;
|
|
145
|
+
termination_kind: FutureSignupLifecycleProjectionTerminationKind | null;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
/** Exact plaintext envelope already emitted by the shipped v1 control builder. */
|
|
149
|
+
export type FutureSignupLifecycleProjectionEnvelope = {
|
|
150
|
+
contract_version: typeof FUTURE_SIGNUP_LIFECYCLE_PROJECTION_CONTRACT_VERSION;
|
|
151
|
+
event_id: string;
|
|
152
|
+
event_type: "lifecycle_projection";
|
|
153
|
+
fact_id: string;
|
|
154
|
+
fact_revision: number;
|
|
155
|
+
occurred_at: string;
|
|
156
|
+
provider: "oxygen";
|
|
157
|
+
provider_event_id: string;
|
|
158
|
+
upstream: {
|
|
159
|
+
provider: FutureSignupLifecycleProjectionSourceFact["source"];
|
|
160
|
+
provider_event_id: string;
|
|
161
|
+
source_revision: number;
|
|
162
|
+
};
|
|
163
|
+
source_fact: FutureSignupLifecycleProjectionSourceFact;
|
|
164
|
+
snapshot: FutureSignupLifecycleProjectionSnapshot;
|
|
165
|
+
activity: FutureSignupLifecycleProjectionActivity;
|
|
166
|
+
producer: {
|
|
167
|
+
environment: "dev" | "production";
|
|
168
|
+
version: string;
|
|
169
|
+
commitSha: string;
|
|
170
|
+
};
|
|
171
|
+
validation: {
|
|
172
|
+
synthetic: false;
|
|
173
|
+
no_send: true;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
export type FutureSignupLifecycleProjectionAlias = {
|
|
177
|
+
type: FutureSignupLifecycleProjectionAliasType;
|
|
178
|
+
value: string;
|
|
179
|
+
};
|
|
180
|
+
export type FutureSignupLifecycleProjectionLookupIdentity = {
|
|
181
|
+
type: "domain";
|
|
182
|
+
value: string;
|
|
183
|
+
};
|
|
184
|
+
export type FutureSignupLifecycleProjectionPrebillingCandidate = {
|
|
185
|
+
stage: FutureSignupLifecycleProjectionPrebillingStage;
|
|
186
|
+
occurred_at: string;
|
|
187
|
+
source_event_id: string;
|
|
188
|
+
};
|
|
189
|
+
/** Closed destination view derived from, but not confused with, the shipped v1. */
|
|
190
|
+
export type FutureSignupLifecycleProjectionNormalizedSubject = {
|
|
191
|
+
kind: FutureSignupLifecycleProjectionSubjectKind;
|
|
192
|
+
key: string;
|
|
193
|
+
/** Identities the apply layer may assert or attach to the destination record. */
|
|
194
|
+
aliases: FutureSignupLifecycleProjectionAlias[];
|
|
195
|
+
/** Lookup-only identity for a historical tombstone; never asserted or moved. */
|
|
196
|
+
lookup_identities: FutureSignupLifecycleProjectionLookupIdentity[];
|
|
197
|
+
display: FutureSignupLifecycleProjectionSubject["display"];
|
|
198
|
+
aggregate_revision: number;
|
|
199
|
+
aggregate_fingerprint: string;
|
|
200
|
+
source_state_revision: number;
|
|
201
|
+
membership_set_revision: number;
|
|
202
|
+
members_complete: true;
|
|
203
|
+
projection_action: FutureSignupLifecycleProjectionAction;
|
|
204
|
+
replacement_company_key: string | null;
|
|
205
|
+
departed_clerk_org_ids: string[];
|
|
206
|
+
billing_stage: FutureSignupLifecycleProjectionBillingStage | null;
|
|
207
|
+
stage_since: string | null;
|
|
208
|
+
loss_kind: FutureSignupLifecycleProjectionLossKind | null;
|
|
209
|
+
winning_clerk_org_id: string | null;
|
|
210
|
+
winning_fact_id: string | null;
|
|
211
|
+
winning_fact_revision: number | null;
|
|
212
|
+
/** v1 carries no prebilling evidence, so normalization never invents one. */
|
|
213
|
+
prebilling_candidate: FutureSignupLifecycleProjectionPrebillingCandidate | null;
|
|
214
|
+
membership_contributors: FutureSignupLifecycleProjectionMembershipContributor[];
|
|
215
|
+
};
|
|
216
|
+
export type FutureSignupLifecycleProjectionParticipant = {
|
|
217
|
+
kind: FutureSignupLifecycleProjectionSubjectKind;
|
|
218
|
+
key: string;
|
|
219
|
+
role: "primary" | "related";
|
|
220
|
+
};
|
|
221
|
+
export type FutureSignupLifecycleProjectionNormalizedActivity = {
|
|
222
|
+
emit: true;
|
|
223
|
+
type: FutureSignupLifecycleProjectionActivityType;
|
|
224
|
+
source_provider: typeof FUTURE_SIGNUP_LIFECYCLE_PROJECTION_AUTHORITY;
|
|
225
|
+
provider_event_id: string;
|
|
226
|
+
occurred_at: string;
|
|
227
|
+
summary: string;
|
|
228
|
+
participants: FutureSignupLifecycleProjectionParticipant[];
|
|
229
|
+
} | {
|
|
230
|
+
emit: false;
|
|
231
|
+
type: null;
|
|
232
|
+
source_provider: null;
|
|
233
|
+
provider_event_id: null;
|
|
234
|
+
occurred_at: null;
|
|
235
|
+
summary: null;
|
|
236
|
+
participants: [];
|
|
237
|
+
};
|
|
238
|
+
export type FutureSignupLifecycleProjectionFingerprintSet = {
|
|
239
|
+
source_fact_fingerprint: string;
|
|
240
|
+
subject_set_fingerprint: string;
|
|
241
|
+
snapshot_fingerprint: string;
|
|
242
|
+
projection_fingerprint: string;
|
|
243
|
+
};
|
|
244
|
+
export type FutureSignupLifecycleProjectionIdempotencyKeys = {
|
|
245
|
+
delivery_receipt: string;
|
|
246
|
+
activity: string | null;
|
|
247
|
+
subjects: Array<{
|
|
248
|
+
kind: FutureSignupLifecycleProjectionSubjectKind;
|
|
249
|
+
key: string;
|
|
250
|
+
idempotency_key: string;
|
|
251
|
+
}>;
|
|
252
|
+
};
|
|
253
|
+
export type FutureSignupLifecycleProjectionNormalizedProjection = {
|
|
254
|
+
contract_version: typeof FUTURE_SIGNUP_LIFECYCLE_PROJECTION_CONTRACT_VERSION;
|
|
255
|
+
authority: typeof FUTURE_SIGNUP_LIFECYCLE_PROJECTION_AUTHORITY;
|
|
256
|
+
event_id: string;
|
|
257
|
+
occurred_at: string;
|
|
258
|
+
source_fact: FutureSignupLifecycleProjectionSourceFact;
|
|
259
|
+
snapshot: {
|
|
260
|
+
complete: true;
|
|
261
|
+
causal_clerk_org_id: string;
|
|
262
|
+
subjects: FutureSignupLifecycleProjectionNormalizedSubject[];
|
|
263
|
+
};
|
|
264
|
+
activity: FutureSignupLifecycleProjectionNormalizedActivity;
|
|
265
|
+
validation: {
|
|
266
|
+
synthetic: false;
|
|
267
|
+
no_send: true;
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
export type NormalizedFutureSignupLifecycleProjectionEnvelope = {
|
|
271
|
+
/** Canonical clone of the exact shipped v1 plaintext. */
|
|
272
|
+
envelope: FutureSignupLifecycleProjectionEnvelope;
|
|
273
|
+
/** Closed destination-facing projection derived from that plaintext. */
|
|
274
|
+
projection: FutureSignupLifecycleProjectionNormalizedProjection;
|
|
275
|
+
fingerprints: FutureSignupLifecycleProjectionFingerprintSet;
|
|
276
|
+
idempotency_keys: FutureSignupLifecycleProjectionIdempotencyKeys;
|
|
277
|
+
};
|
|
278
|
+
export type FutureSignupLifecycleProjectionStageMapping = Record<FutureSignupLifecycleProjectionSemanticStage, string>;
|
|
279
|
+
export type FutureSignupLifecycleProjectionDestinationApplyOptions = {
|
|
280
|
+
objects: {
|
|
281
|
+
people: "people";
|
|
282
|
+
companies: "companies";
|
|
283
|
+
};
|
|
284
|
+
stage_tokens: {
|
|
285
|
+
people: FutureSignupLifecycleProjectionStageMapping;
|
|
286
|
+
companies: FutureSignupLifecycleProjectionStageMapping;
|
|
287
|
+
};
|
|
288
|
+
/** Destination-only exact member identity. Never appears in the control envelope. */
|
|
289
|
+
owner_if_blank: {
|
|
290
|
+
workspace_user_id: string;
|
|
291
|
+
} | null;
|
|
292
|
+
activity_policy: {
|
|
293
|
+
customer_lifecycle_facts: "emit_envelope_activity";
|
|
294
|
+
projection_refreshed: "suppress";
|
|
295
|
+
subscription_ended: "suppress";
|
|
296
|
+
participants: "envelope_subjects_only";
|
|
297
|
+
idempotency: "event_id";
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
export type NormalizedFutureSignupLifecycleProjectionDestinationApplyOptions = {
|
|
301
|
+
apply_options: FutureSignupLifecycleProjectionDestinationApplyOptions;
|
|
302
|
+
apply_options_fingerprint: string;
|
|
303
|
+
};
|
|
304
|
+
/** Typed, PII-free parse failure. Raw values are intentionally never reflected. */
|
|
305
|
+
export declare class FutureSignupLifecycleProjectionContractError extends TypeError {
|
|
306
|
+
readonly path: string;
|
|
307
|
+
readonly rule: string;
|
|
308
|
+
readonly code = "future_signup_lifecycle_projection_invalid";
|
|
309
|
+
constructor(path: string, rule: string);
|
|
310
|
+
}
|
|
311
|
+
/** Exact fingerprint algorithm used by the shipped v1 control builder. */
|
|
312
|
+
export declare function futureSignupLifecycleProjectionFingerprints(input: {
|
|
313
|
+
eventId: string;
|
|
314
|
+
sourceFact: FutureSignupLifecycleProjectionSourceFact;
|
|
315
|
+
snapshot: Omit<FutureSignupLifecycleProjectionSnapshot, "subject_set_fingerprint" | "snapshot_fingerprint">;
|
|
316
|
+
}): FutureSignupLifecycleProjectionFingerprintSet;
|
|
317
|
+
export declare function parseFutureSignupLifecycleProjectionJson(body: string): NormalizedFutureSignupLifecycleProjectionEnvelope;
|
|
318
|
+
/** Validate shipped v1 and derive the closed destination view. No writes or sends. */
|
|
319
|
+
export declare function normalizeFutureSignupLifecycleProjectionEnvelope(value: unknown): NormalizedFutureSignupLifecycleProjectionEnvelope;
|
|
320
|
+
export declare function normalizeFutureSignupLifecycleProjectionDestinationApplyOptions(value: unknown): NormalizedFutureSignupLifecycleProjectionDestinationApplyOptions;
|