@htilabs/platform-common-models 0.21.0 → 0.22.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/cvcs/index.cjs +449 -50
- package/dist/cvcs/index.cjs.map +1 -1
- package/dist/cvcs/index.d.cts +491 -55
- package/dist/cvcs/index.d.ts +491 -55
- package/dist/cvcs/index.js +449 -50
- package/dist/cvcs/index.js.map +1 -1
- package/dist/enums/index.cjs +36 -1
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.cts +37 -2
- package/dist/enums/index.d.ts +37 -2
- package/dist/enums/index.js +36 -1
- package/dist/enums/index.js.map +1 -1
- package/dist/index.cjs +589 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +580 -51
- package/dist/index.js.map +1 -1
- package/dist/schemas/index.cjs +104 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +240 -1
- package/dist/schemas/index.d.ts +240 -1
- package/dist/schemas/index.js +95 -0
- package/dist/schemas/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__sot__/README.md +1 -0
- package/src/__sot__/coreFunctionFields.ts +121 -0
- package/src/__sot__/coreFunctions.pin.json +1546 -0
- package/src/__sot__/coreFunctions.published.json +233 -0
- package/src/__tests__/__snapshots__/cvc-sot.snap +2 -2
- package/src/__tests__/core-functions-canon.test.ts +308 -24
- package/src/__tests__/cvc-sot-snapshot.test.ts +7 -4
- package/src/__tests__/cvc-status-parser.test.ts +1 -1
- package/src/__tests__/cvc-structural.test.ts +1 -1
- package/src/__tests__/organization-program.test.ts +254 -0
- package/src/cvcs/{coreFunctions.v1.1.0.json → coreFunctions.v1.2.0.json} +446 -47
- package/src/cvcs/index.ts +1 -1
- package/src/generated/cvc-enums.ts +37 -2
- package/src/schemas/index.ts +18 -0
- package/src/schemas/organization-program.ts +297 -0
package/dist/schemas/index.cjs
CHANGED
|
@@ -21,11 +21,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var schemas_exports = {};
|
|
22
22
|
__export(schemas_exports, {
|
|
23
23
|
AGENCY_ORG_TYPE_VALIDATED_UPDATE_OPS: () => AGENCY_ORG_TYPE_VALIDATED_UPDATE_OPS,
|
|
24
|
+
ORGANIZATION_PROGRAM_VALIDATED_UPDATE_OPS: () => ORGANIZATION_PROGRAM_VALIDATED_UPDATE_OPS,
|
|
24
25
|
ORG_TYPE_FIELD_NAMES: () => ORG_TYPE_FIELD_NAMES,
|
|
26
|
+
PROGRAM_REVIEW_STATUS: () => PROGRAM_REVIEW_STATUS,
|
|
27
|
+
PROGRAM_REVIEW_STATUS_VALUES: () => PROGRAM_REVIEW_STATUS_VALUES,
|
|
25
28
|
TEAM_MODEL_NAME: () => TEAM_MODEL_NAME,
|
|
26
29
|
VSP_TWO_STEP_ISSUE: () => VSP_TWO_STEP_ISSUE,
|
|
27
30
|
addAgencyOrgTypeFields: () => addAgencyOrgTypeFields,
|
|
28
31
|
addOrgTypeFields: () => addOrgTypeFields,
|
|
32
|
+
addOrganizationProgramsField: () => addOrganizationProgramsField,
|
|
29
33
|
addTeamDirectoryFields: () => addTeamDirectoryFields,
|
|
30
34
|
addressSchema: () => addressSchema,
|
|
31
35
|
agencyOrgTypeSchemaDefinition: () => agencyOrgTypeSchemaDefinition,
|
|
@@ -33,6 +37,8 @@ __export(schemas_exports, {
|
|
|
33
37
|
buildCvcEntrySchema: () => buildCvcEntrySchema,
|
|
34
38
|
buildCvcRegistrySchema: () => buildCvcRegistrySchema,
|
|
35
39
|
buildFormSchema: () => buildFormSchema,
|
|
40
|
+
buildOrganizationProgramSchema: () => buildOrganizationProgramSchema,
|
|
41
|
+
buildOrganizationProgramsFieldDefinition: () => buildOrganizationProgramsFieldDefinition,
|
|
36
42
|
buildPlatformFunctionSchema: () => buildPlatformFunctionSchema,
|
|
37
43
|
buildPlatformRoleSchema: () => buildPlatformRoleSchema,
|
|
38
44
|
buildQuestionSchema: () => buildQuestionSchema,
|
|
@@ -49,10 +55,13 @@ __export(schemas_exports, {
|
|
|
49
55
|
formSchemaOptions: () => formSchemaOptions,
|
|
50
56
|
formSectionRefSchema: () => formSectionRefSchema,
|
|
51
57
|
guidanceSchema: () => guidanceSchema,
|
|
58
|
+
isLiveOrganizationProgram: () => isLiveOrganizationProgram,
|
|
59
|
+
isProgramReviewStatus: () => isProgramReviewStatus,
|
|
52
60
|
layoutSchema: () => layoutSchema,
|
|
53
61
|
mirrorOrgTypeFields: () => mirrorOrgTypeFields,
|
|
54
62
|
orgTypeFieldsDiffer: () => orgTypeFieldsDiffer,
|
|
55
63
|
orgTypeSchemaDefinition: () => orgTypeSchemaDefinition,
|
|
64
|
+
organizationProgramSchemaDefinition: () => organizationProgramSchemaDefinition,
|
|
56
65
|
personNameSchema: () => personNameSchema,
|
|
57
66
|
phoneSchema: () => phoneSchema,
|
|
58
67
|
platformFunctionSchemaDefinition: () => platformFunctionSchemaDefinition,
|
|
@@ -5862,14 +5871,104 @@ function orgTypeFieldsDiffer(org, agency) {
|
|
|
5862
5871
|
const b = pickOrgTypeFields(agency);
|
|
5863
5872
|
return ORG_TYPE_FIELD_NAMES.filter((k) => a[k] !== b[k]);
|
|
5864
5873
|
}
|
|
5874
|
+
|
|
5875
|
+
// src/schemas/organization-program.ts
|
|
5876
|
+
var import_mongoose12 = require("mongoose");
|
|
5877
|
+
var PROGRAM_REVIEW_STATUS = {
|
|
5878
|
+
PENDING: "pending",
|
|
5879
|
+
CONFIRMED: "confirmed",
|
|
5880
|
+
REJECTED: "rejected"
|
|
5881
|
+
};
|
|
5882
|
+
var PROGRAM_REVIEW_STATUS_VALUES = Object.freeze([
|
|
5883
|
+
PROGRAM_REVIEW_STATUS.PENDING,
|
|
5884
|
+
PROGRAM_REVIEW_STATUS.CONFIRMED,
|
|
5885
|
+
PROGRAM_REVIEW_STATUS.REJECTED
|
|
5886
|
+
]);
|
|
5887
|
+
function isProgramReviewStatus(value) {
|
|
5888
|
+
return typeof value === "string" && PROGRAM_REVIEW_STATUS_VALUES.includes(value);
|
|
5889
|
+
}
|
|
5890
|
+
var organizationProgramSchemaDefinition = {
|
|
5891
|
+
/** Stable identifier for the program within its Organization (server-minted). */
|
|
5892
|
+
programId: { type: String, required: true },
|
|
5893
|
+
/** Human-facing program name (canon `label`). */
|
|
5894
|
+
name: { type: String, required: true },
|
|
5895
|
+
/** Free-text program description. */
|
|
5896
|
+
description: { type: String, required: false },
|
|
5897
|
+
/** Lifecycle code; a `retired` program is not offered to pickers. */
|
|
5898
|
+
status: { type: String, required: false },
|
|
5899
|
+
/** Default sharing-policy code applied when sharing to this program (ADR D13). */
|
|
5900
|
+
defaultSharingPolicy: { type: String, required: false },
|
|
5901
|
+
/**
|
|
5902
|
+
* pending · confirmed · rejected for a program named inside an app; absent on
|
|
5903
|
+
* a steward row. A `rejected` row is never offered and never captures its
|
|
5904
|
+
* name on a later add (a new row is minted).
|
|
5905
|
+
*/
|
|
5906
|
+
reviewStatus: {
|
|
5907
|
+
type: String,
|
|
5908
|
+
required: false,
|
|
5909
|
+
enum: [...PROGRAM_REVIEW_STATUS_VALUES]
|
|
5910
|
+
},
|
|
5911
|
+
/** The seat (user id) that named it inside an app. */
|
|
5912
|
+
addedBy: { type: String, required: false },
|
|
5913
|
+
/** The app it was NAMED in (`pave` · `thread` · `leads` · `platform`). */
|
|
5914
|
+
addedInApp: { type: String, required: false },
|
|
5915
|
+
/** The session it was named in, when there was one. */
|
|
5916
|
+
addedInSession: { type: String, required: false }
|
|
5917
|
+
};
|
|
5918
|
+
function buildOrganizationProgramSchema() {
|
|
5919
|
+
return new import_mongoose12.Schema(organizationProgramSchemaDefinition, { _id: false });
|
|
5920
|
+
}
|
|
5921
|
+
function buildOrganizationProgramsFieldDefinition() {
|
|
5922
|
+
return {
|
|
5923
|
+
programs: {
|
|
5924
|
+
type: [buildOrganizationProgramSchema()],
|
|
5925
|
+
required: false,
|
|
5926
|
+
default: void 0
|
|
5927
|
+
}
|
|
5928
|
+
};
|
|
5929
|
+
}
|
|
5930
|
+
var ORGANIZATION_PROGRAM_VALIDATED_UPDATE_OPS = Object.freeze([
|
|
5931
|
+
"updateOne",
|
|
5932
|
+
"updateMany",
|
|
5933
|
+
"findOneAndUpdate"
|
|
5934
|
+
]);
|
|
5935
|
+
function addOrganizationProgramsField(schema, options = {}) {
|
|
5936
|
+
if (schema.path("programs")) {
|
|
5937
|
+
console.warn(
|
|
5938
|
+
"[platform-common-models] addOrganizationProgramsField: replacing the schema's own `programs` path with the shared fragment; pass `{ select: false }` here if that is the consumer's read posture."
|
|
5939
|
+
);
|
|
5940
|
+
}
|
|
5941
|
+
schema.add({
|
|
5942
|
+
programs: {
|
|
5943
|
+
...buildOrganizationProgramsFieldDefinition().programs,
|
|
5944
|
+
...options.select !== void 0 ? { select: options.select } : {}
|
|
5945
|
+
}
|
|
5946
|
+
});
|
|
5947
|
+
if (options.validateOnUpdate ?? true) {
|
|
5948
|
+
schema.pre(
|
|
5949
|
+
[...ORGANIZATION_PROGRAM_VALIDATED_UPDATE_OPS],
|
|
5950
|
+
function() {
|
|
5951
|
+
applyRunValidatorsIfUnset(this);
|
|
5952
|
+
}
|
|
5953
|
+
);
|
|
5954
|
+
}
|
|
5955
|
+
return schema;
|
|
5956
|
+
}
|
|
5957
|
+
function isLiveOrganizationProgram(row) {
|
|
5958
|
+
return row.status !== "retired" && row.reviewStatus !== PROGRAM_REVIEW_STATUS.REJECTED;
|
|
5959
|
+
}
|
|
5865
5960
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5866
5961
|
0 && (module.exports = {
|
|
5867
5962
|
AGENCY_ORG_TYPE_VALIDATED_UPDATE_OPS,
|
|
5963
|
+
ORGANIZATION_PROGRAM_VALIDATED_UPDATE_OPS,
|
|
5868
5964
|
ORG_TYPE_FIELD_NAMES,
|
|
5965
|
+
PROGRAM_REVIEW_STATUS,
|
|
5966
|
+
PROGRAM_REVIEW_STATUS_VALUES,
|
|
5869
5967
|
TEAM_MODEL_NAME,
|
|
5870
5968
|
VSP_TWO_STEP_ISSUE,
|
|
5871
5969
|
addAgencyOrgTypeFields,
|
|
5872
5970
|
addOrgTypeFields,
|
|
5971
|
+
addOrganizationProgramsField,
|
|
5873
5972
|
addTeamDirectoryFields,
|
|
5874
5973
|
addressSchema,
|
|
5875
5974
|
agencyOrgTypeSchemaDefinition,
|
|
@@ -5877,6 +5976,8 @@ function orgTypeFieldsDiffer(org, agency) {
|
|
|
5877
5976
|
buildCvcEntrySchema,
|
|
5878
5977
|
buildCvcRegistrySchema,
|
|
5879
5978
|
buildFormSchema,
|
|
5979
|
+
buildOrganizationProgramSchema,
|
|
5980
|
+
buildOrganizationProgramsFieldDefinition,
|
|
5880
5981
|
buildPlatformFunctionSchema,
|
|
5881
5982
|
buildPlatformRoleSchema,
|
|
5882
5983
|
buildQuestionSchema,
|
|
@@ -5893,10 +5994,13 @@ function orgTypeFieldsDiffer(org, agency) {
|
|
|
5893
5994
|
formSchemaOptions,
|
|
5894
5995
|
formSectionRefSchema,
|
|
5895
5996
|
guidanceSchema,
|
|
5997
|
+
isLiveOrganizationProgram,
|
|
5998
|
+
isProgramReviewStatus,
|
|
5896
5999
|
layoutSchema,
|
|
5897
6000
|
mirrorOrgTypeFields,
|
|
5898
6001
|
orgTypeFieldsDiffer,
|
|
5899
6002
|
orgTypeSchemaDefinition,
|
|
6003
|
+
organizationProgramSchemaDefinition,
|
|
5900
6004
|
personNameSchema,
|
|
5901
6005
|
phoneSchema,
|
|
5902
6006
|
platformFunctionSchemaDefinition,
|