@awell-health/awell-extensions 2.0.235 → 2.0.236
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/extensions/dateHelpers/actions/getNextWorkday/config/dataPoints.d.ts +4 -0
- package/dist/extensions/dateHelpers/actions/getNextWorkday/config/dataPoints.js +4 -0
- package/dist/extensions/dateHelpers/actions/getNextWorkday/config/dataPoints.js.map +1 -1
- package/dist/extensions/dateHelpers/actions/getNextWorkday/config/fields.d.ts +10 -0
- package/dist/extensions/dateHelpers/actions/getNextWorkday/config/fields.js +9 -1
- package/dist/extensions/dateHelpers/actions/getNextWorkday/config/fields.js.map +1 -1
- package/dist/extensions/dateHelpers/actions/getNextWorkday/getNextWorkday.js +12 -6
- package/dist/extensions/dateHelpers/actions/getNextWorkday/getNextWorkday.js.map +1 -1
- package/dist/extensions/dateHelpers/actions/index.d.ts +8 -1
- package/dist/extensions/markdown.json +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/dateHelpers/actions/getNextWorkday/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,MAAM;KAClB;CAC4C,CAAA"}
|
1
|
+
{"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/dateHelpers/actions/getNextWorkday/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,MAAM;KAClB;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,wBAAwB;QAC7B,SAAS,EAAE,SAAS;KACrB;CAC4C,CAAA"}
|
@@ -8,11 +8,21 @@ export declare const fields: {
|
|
8
8
|
type: FieldType.DATE;
|
9
9
|
required: false;
|
10
10
|
};
|
11
|
+
includeReferenceDate: {
|
12
|
+
id: string;
|
13
|
+
label: string;
|
14
|
+
description: string;
|
15
|
+
type: FieldType.BOOLEAN;
|
16
|
+
required: false;
|
17
|
+
};
|
11
18
|
};
|
12
19
|
export declare const FieldsValidationSchema: z.ZodObject<{
|
13
20
|
referenceDate: z.ZodOptional<z.ZodDate>;
|
21
|
+
includeReferenceDate: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
14
22
|
}, "strip", z.ZodTypeAny, {
|
23
|
+
includeReferenceDate: boolean;
|
15
24
|
referenceDate?: Date | undefined;
|
16
25
|
}, {
|
17
26
|
referenceDate?: Date | undefined;
|
27
|
+
includeReferenceDate?: boolean | undefined;
|
18
28
|
}>;
|
@@ -7,12 +7,20 @@ exports.fields = {
|
|
7
7
|
referenceDate: {
|
8
8
|
id: 'referenceDate',
|
9
9
|
label: 'Reference date',
|
10
|
-
description: 'Set the reference date to calculate the next workday from. If not specified, the current date will be used.',
|
10
|
+
description: 'Set the reference date to calculate the next workday from. If not specified, the current date (today) will be used.',
|
11
11
|
type: extensions_core_1.FieldType.DATE,
|
12
12
|
required: false,
|
13
13
|
},
|
14
|
+
includeReferenceDate: {
|
15
|
+
id: 'includeReferenceDate',
|
16
|
+
label: 'Include reference date',
|
17
|
+
description: 'If this option is enabled and the reference date is a weekday (Monday to Friday), that date will be returned. If it is disabled, the next weekday after the reference date will be returned.',
|
18
|
+
type: extensions_core_1.FieldType.BOOLEAN,
|
19
|
+
required: false,
|
20
|
+
},
|
14
21
|
};
|
15
22
|
exports.FieldsValidationSchema = zod_1.z.object({
|
16
23
|
referenceDate: zod_1.z.optional(zod_1.z.coerce.date()),
|
24
|
+
includeReferenceDate: zod_1.z.boolean().optional().default(true),
|
17
25
|
});
|
18
26
|
//# sourceMappingURL=fields.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/dateHelpers/actions/getNextWorkday/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAAqE;AAExD,QAAA,MAAM,GAAG;IACpB,aAAa,EAAE;QACb,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/dateHelpers/actions/getNextWorkday/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAAqE;AAExD,QAAA,MAAM,GAAG;IACpB,aAAa,EAAE;QACb,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,qHAAqH;QACvH,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,KAAK;KAChB;IACD,oBAAoB,EAAE;QACpB,EAAE,EAAE,sBAAsB;QAC1B,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,8LAA8L;QAChM,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,aAAa,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC1C,oBAAoB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CACT,CAAC,CAAA"}
|
@@ -12,21 +12,27 @@ exports.getNextWorkday = {
|
|
12
12
|
dataPoints: config_1.dataPoints,
|
13
13
|
previewable: true,
|
14
14
|
onActivityCreated: async (payload, onComplete, onError) => {
|
15
|
-
const { referenceDate: referenceDateInput } = config_1.FieldsValidationSchema.parse(payload.fields);
|
15
|
+
const { referenceDate: referenceDateInput, includeReferenceDate } = config_1.FieldsValidationSchema.parse(payload.fields);
|
16
16
|
const referenceDate = referenceDateInput !== null && referenceDateInput !== void 0 ? referenceDateInput : new Date();
|
17
|
-
const SUNDAY = 0;
|
18
|
-
const SATURDAY = 6;
|
19
17
|
// Normalize to start of day to avoid timezone issues
|
20
18
|
referenceDate.setUTCHours(0, 0, 0, 0);
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
const SUNDAY = 0;
|
20
|
+
const SATURDAY = 6;
|
21
|
+
const isWeekend = (date) => date.getDay() === SUNDAY || date.getDay() === SATURDAY;
|
22
|
+
const referenceDateIsWeekday = !isWeekend(referenceDate);
|
23
|
+
// If reference date is a weekday and we should *not* include it, move forward by one day
|
24
|
+
if (!includeReferenceDate && !isWeekend(referenceDate)) {
|
25
|
+
referenceDate.setDate(referenceDate.getDate() + 1);
|
26
|
+
}
|
27
|
+
// If resultDate is a weekend, keep moving forward to the next weekday
|
28
|
+
while (isWeekend(referenceDate)) {
|
24
29
|
referenceDate.setDate(referenceDate.getDate() + 1);
|
25
30
|
}
|
26
31
|
const nextWorkday = referenceDate.toISOString();
|
27
32
|
await onComplete({
|
28
33
|
data_points: {
|
29
34
|
nextWorkday,
|
35
|
+
referenceDateIsWeekday: String(referenceDateIsWeekday),
|
30
36
|
},
|
31
37
|
});
|
32
38
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getNextWorkday.js","sourceRoot":"","sources":["../../../../../extensions/dateHelpers/actions/getNextWorkday/getNextWorkday.ts"],"names":[],"mappings":";;;AACA,mEAAwD;AAExD,qCAAqE;AAExD,QAAA,cAAc,GAIvB;IACF,GAAG,EAAE,gBAAgB;IACrB,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,sBAAsB;IACnC,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,WAAW,EAAE,IAAI;IACjB,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;QACxD,MAAM,EAAE,aAAa,EAAE,kBAAkB,EAAE,
|
1
|
+
{"version":3,"file":"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AAE,CAAC;YAChC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;QACpD,CAAC;QAED,MAAM,WAAW,GAAG,aAAa,CAAC,WAAW,EAAE,CAAA;QAE/C,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,WAAW;gBACX,sBAAsB,EAAE,MAAM,CAAC,sBAAsB,CAAC;aACvD;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -7,5 +7,12 @@ export declare const actions: {
|
|
7
7
|
type: import("@awell-health/extensions-core").FieldType.DATE;
|
8
8
|
required: false;
|
9
9
|
};
|
10
|
-
|
10
|
+
includeReferenceDate: {
|
11
|
+
id: string;
|
12
|
+
label: string;
|
13
|
+
description: string;
|
14
|
+
type: import("@awell-health/extensions-core").FieldType.BOOLEAN;
|
15
|
+
required: false;
|
16
|
+
};
|
17
|
+
}, {}, "nextWorkday" | "referenceDateIsWeekday">;
|
11
18
|
};
|
@@ -48,7 +48,7 @@
|
|
48
48
|
"changelog": "# Collect Data changelog\n"
|
49
49
|
},
|
50
50
|
"dateHelpers": {
|
51
|
-
"readme": "---\ntitle: Date helpers\ndescription: A set of utility actions to help with common and useful date and time operations.\n---\n\n# Date helpers\n\nA set of utility actions to help with common and useful date and time operations.\n\n## Actions\n\n### Get next workday\n\
|
51
|
+
"readme": "---\ntitle: Date helpers\ndescription: A set of utility actions to help with common and useful date and time operations.\n---\n\n# Date helpers\n\nA set of utility actions to help with common and useful date and time operations.\n\n## Actions\n\n### Get next workday\n\nReturns the next workday (Monday to Friday) based on a reference date.\n\nIf the reference date is a weekday and \"Include reference date\" is enabled, the reference date is returned. If it's a weekend or \"Include reference date\" is disabled, the next weekday is returned instead.\n\n**Examples:**\n\n- Reference date: Thursday, April 17\n - Include reference date enabled → returns Thursday, April 17\n - Include reference date disabled → returns Friday, April 18\n- Reference date: Sunday, April 20\n - Include reference date enabled → returns Monday, April 21\n - Include reference date disabled → returns Monday, April 21\n\n✅ Include reference date enabled or disabled → returns Monday, April 21\n\nThis action does not account for holidays.",
|
52
52
|
"changelog": "# Date helopers\n"
|
53
53
|
},
|
54
54
|
"dockHealth": {
|