@composable-os/pack-lifecycle 0.0.0-stage → 0.1.0-beta.7
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/LICENSE +109 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.js +94 -0
- package/package.json +31 -4
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
> This licence covers the repository except the directories listed in NOTICE. In particular, the
|
|
4
|
+
> assistant packages `packages/agent-*` (agent-core, agent-a2ui, agent-voice, agent-plugins) are
|
|
5
|
+
> licensed under the MIT License; see the LICENSE file in each of those directories (ADR 0350).
|
|
6
|
+
|
|
7
|
+
## Abbreviation
|
|
8
|
+
|
|
9
|
+
FSL-1.1-ALv2
|
|
10
|
+
|
|
11
|
+
## Notice
|
|
12
|
+
|
|
13
|
+
Copyright 2026 Tim O'Connell
|
|
14
|
+
|
|
15
|
+
## Terms and Conditions
|
|
16
|
+
|
|
17
|
+
### Licensor ("We")
|
|
18
|
+
|
|
19
|
+
The party offering the Software under these Terms and Conditions.
|
|
20
|
+
|
|
21
|
+
### The Software
|
|
22
|
+
|
|
23
|
+
The "Software" is each version of the software that we make available under
|
|
24
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
25
|
+
Conditions with the Software.
|
|
26
|
+
|
|
27
|
+
### License Grant
|
|
28
|
+
|
|
29
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
30
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
31
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
32
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
33
|
+
|
|
34
|
+
### Permitted Purpose
|
|
35
|
+
|
|
36
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
37
|
+
means making the Software available to others in a commercial product or
|
|
38
|
+
service that:
|
|
39
|
+
|
|
40
|
+
1. substitutes for the Software;
|
|
41
|
+
|
|
42
|
+
2. substitutes for any other product or service we offer using the Software
|
|
43
|
+
that exists as of the date we make the Software available; or
|
|
44
|
+
|
|
45
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
46
|
+
|
|
47
|
+
Permitted Purposes specifically include using the Software:
|
|
48
|
+
|
|
49
|
+
1. for your internal use and access;
|
|
50
|
+
|
|
51
|
+
2. for non-commercial education;
|
|
52
|
+
|
|
53
|
+
3. for non-commercial research; and
|
|
54
|
+
|
|
55
|
+
4. in connection with professional services that you provide to a licensee
|
|
56
|
+
using the Software in accordance with these Terms and Conditions.
|
|
57
|
+
|
|
58
|
+
### Patents
|
|
59
|
+
|
|
60
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
61
|
+
patents, the license grant above includes a license under our patents. If you
|
|
62
|
+
make a claim against any party that the Software infringes or contributes to
|
|
63
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
64
|
+
immediately.
|
|
65
|
+
|
|
66
|
+
### Redistribution
|
|
67
|
+
|
|
68
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
69
|
+
the Software.
|
|
70
|
+
|
|
71
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
72
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
73
|
+
remove any copyright notices provided in or with the Software.
|
|
74
|
+
|
|
75
|
+
### Disclaimer
|
|
76
|
+
|
|
77
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
78
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
79
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
80
|
+
|
|
81
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
82
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
83
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
84
|
+
|
|
85
|
+
### Trademarks
|
|
86
|
+
|
|
87
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
88
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
89
|
+
trademarks, trade names, service marks or product names.
|
|
90
|
+
|
|
91
|
+
## Grant of Future License
|
|
92
|
+
|
|
93
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
94
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
95
|
+
the date we make the Software available. On or after that date, you may use the
|
|
96
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
97
|
+
will apply:
|
|
98
|
+
|
|
99
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
100
|
+
this file except in compliance with the License.
|
|
101
|
+
|
|
102
|
+
You may obtain a copy of the License at
|
|
103
|
+
|
|
104
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
105
|
+
|
|
106
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
107
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
108
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
109
|
+
specific language governing permissions and limitations under the License.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare const LIFECYCLE_STAGES: ({
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
color?: undefined;
|
|
5
|
+
} | {
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
color: string;
|
|
9
|
+
})[];
|
|
10
|
+
declare const _default: import("@composable-os/sdk").Extension<{
|
|
11
|
+
readonly id: "lifecycle";
|
|
12
|
+
readonly version: "1.0.0";
|
|
13
|
+
readonly contractVersion: 1;
|
|
14
|
+
readonly label: "Lifecycle stage";
|
|
15
|
+
readonly description: string;
|
|
16
|
+
readonly permissions: {
|
|
17
|
+
readonly write: ["person"];
|
|
18
|
+
readonly modules: ["ops"];
|
|
19
|
+
};
|
|
20
|
+
readonly fields: {
|
|
21
|
+
readonly person: {
|
|
22
|
+
readonly lifecycleStage: {
|
|
23
|
+
readonly type: "select";
|
|
24
|
+
readonly label: "Lifecycle stage";
|
|
25
|
+
readonly track: "timeline";
|
|
26
|
+
readonly description: "Where the person is in their relationship with you, as HubSpot names it.";
|
|
27
|
+
readonly options: ({
|
|
28
|
+
value: string;
|
|
29
|
+
label: string;
|
|
30
|
+
color?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
value: string;
|
|
33
|
+
label: string;
|
|
34
|
+
color: string;
|
|
35
|
+
})[];
|
|
36
|
+
};
|
|
37
|
+
readonly lifecycleStageChangedAt: {
|
|
38
|
+
readonly type: "date";
|
|
39
|
+
readonly label: "Stage changed on";
|
|
40
|
+
readonly readOnly: true;
|
|
41
|
+
readonly description: "The date the lifecycle stage last changed.";
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly views: {
|
|
46
|
+
readonly peopleByStage: {
|
|
47
|
+
readonly label: "People by lifecycle stage";
|
|
48
|
+
readonly type: "board";
|
|
49
|
+
readonly object: "person";
|
|
50
|
+
readonly groupBy: "lifecycle.lifecycleStage";
|
|
51
|
+
readonly cardFields: ["jobTitle", "organisationName", "ownerId"];
|
|
52
|
+
readonly sort: {
|
|
53
|
+
readonly field: "displayName";
|
|
54
|
+
readonly direction: "asc";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
readonly automations: {
|
|
59
|
+
readonly stageChangedOn: import("@composable-os/sdk").AutomationSpec<{
|
|
60
|
+
readonly type: "fieldChanged";
|
|
61
|
+
readonly object: "person";
|
|
62
|
+
readonly field: "lifecycle.lifecycleStage";
|
|
63
|
+
readonly includeBulk: true;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
export default _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Lifecycle stage (stage 15, ADR 0246): an opt-in shipped extension that adds a lifecycle stage to
|
|
2
|
+
// every person, named as HubSpot names them, tracked on the timeline, with a board of people by
|
|
3
|
+
// stage. Installing it is the opt-in (Settings → Extensions → Available); without it people are
|
|
4
|
+
// unchanged. Nothing moves a person's stage automatically except converting a lead (Leads sets
|
|
5
|
+
// the person to opportunity); a person can describe an automation for anything else.
|
|
6
|
+
import { defineAutomation, defineExtension, OpsCallError } from "@composable-os/sdk";
|
|
7
|
+
export const LIFECYCLE_STAGES = [
|
|
8
|
+
{ value: "subscriber", label: "Subscriber" },
|
|
9
|
+
{ value: "lead", label: "Lead" },
|
|
10
|
+
{ value: "marketingQualified", label: "Marketing qualified" },
|
|
11
|
+
{ value: "salesQualified", label: "Sales qualified" },
|
|
12
|
+
{ value: "opportunity", label: "Opportunity" },
|
|
13
|
+
{ value: "customer", label: "Customer", color: "green" },
|
|
14
|
+
{ value: "evangelist", label: "Evangelist", color: "green" },
|
|
15
|
+
{ value: "other", label: "Other" },
|
|
16
|
+
];
|
|
17
|
+
/** Keeps "Stage changed on" true: the date a person's lifecycle stage last changed. */
|
|
18
|
+
const stageChangedOn = defineAutomation({
|
|
19
|
+
label: "Record when a lifecycle stage changes",
|
|
20
|
+
description: "When a person's lifecycle stage changes, sets their Stage changed on date to today. Turn " +
|
|
21
|
+
"it off to stop keeping the date.",
|
|
22
|
+
trigger: {
|
|
23
|
+
type: "fieldChanged",
|
|
24
|
+
object: "person",
|
|
25
|
+
field: "lifecycle.lifecycleStage",
|
|
26
|
+
includeBulk: true,
|
|
27
|
+
},
|
|
28
|
+
steps: [
|
|
29
|
+
{
|
|
30
|
+
name: "setDate",
|
|
31
|
+
label: "Set the stage changed date",
|
|
32
|
+
writes: [{ object: "person", action: "update", linkedToTrigger: true }],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
async run(event, step, ctx) {
|
|
36
|
+
const person = event.record;
|
|
37
|
+
if (!person)
|
|
38
|
+
return { skipped: "no person" };
|
|
39
|
+
return step.do("setDate", async () => {
|
|
40
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
41
|
+
try {
|
|
42
|
+
await ctx.ops.call("record.update", {
|
|
43
|
+
object: "person",
|
|
44
|
+
id: person.id,
|
|
45
|
+
values: { "lifecycle.lifecycleStageChangedAt": today },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
// A person deleted meanwhile has no date to keep.
|
|
50
|
+
if (!(error instanceof OpsCallError && error.code === "not_found"))
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
return { date: today };
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
export default defineExtension({
|
|
58
|
+
id: "lifecycle",
|
|
59
|
+
version: "1.0.0",
|
|
60
|
+
contractVersion: 1,
|
|
61
|
+
label: "Lifecycle stage",
|
|
62
|
+
description: "A lifecycle stage on every person (subscriber, lead, marketing qualified, sales qualified, " +
|
|
63
|
+
"opportunity, customer, evangelist, other), tracked on the timeline, with a board of people " +
|
|
64
|
+
"by stage.",
|
|
65
|
+
permissions: { write: ["person"], modules: ["ops"] },
|
|
66
|
+
fields: {
|
|
67
|
+
person: {
|
|
68
|
+
lifecycleStage: {
|
|
69
|
+
type: "select",
|
|
70
|
+
label: "Lifecycle stage",
|
|
71
|
+
track: "timeline",
|
|
72
|
+
description: "Where the person is in their relationship with you, as HubSpot names it.",
|
|
73
|
+
options: LIFECYCLE_STAGES,
|
|
74
|
+
},
|
|
75
|
+
lifecycleStageChangedAt: {
|
|
76
|
+
type: "date",
|
|
77
|
+
label: "Stage changed on",
|
|
78
|
+
readOnly: true,
|
|
79
|
+
description: "The date the lifecycle stage last changed.",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
views: {
|
|
84
|
+
peopleByStage: {
|
|
85
|
+
label: "People by lifecycle stage",
|
|
86
|
+
type: "board",
|
|
87
|
+
object: "person",
|
|
88
|
+
groupBy: "lifecycle.lifecycleStage",
|
|
89
|
+
cardFields: ["jobTitle", "organisationName", "ownerId"],
|
|
90
|
+
sort: { field: "displayName", direction: "asc" },
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
automations: { stageChangedOn },
|
|
94
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composable-os/pack-lifecycle",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-beta.7",
|
|
4
|
+
"license": "FSL-1.1-ALv2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/timoconnellaus/composable-os.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://composableos.dev",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"provenance": true
|
|
14
|
+
},
|
|
15
|
+
"description": "Lifecycle stage on people (stage 15, ADR 0246): opt-in, installed by an admin. Bundled as source into cos-runner.",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"composableOs": {
|
|
26
|
+
"optional": true,
|
|
27
|
+
"label": "Lifecycle stage",
|
|
28
|
+
"description": "A lifecycle stage on every person (subscriber, lead, marketing qualified, sales qualified, opportunity, customer, evangelist, other), tracked on the timeline, with a board of people by stage."
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@composable-os/sdk": "0.1.0-beta.7"
|
|
32
|
+
}
|
|
33
|
+
}
|
package/README.md
DELETED