@opencrvs/toolkit
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -105,4 +105,4 @@ import { z } from 'zod'; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -117,4 +117,4 @@ id: string; | ||
}, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -136,4 +136,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -155,4 +155,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -177,4 +177,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -207,4 +207,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -245,4 +245,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -283,4 +283,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -308,4 +308,2 @@ id: string; | ||
type: z.ZodEnum<[ActionType, ...ActionType[]]>; | ||
createdAt: z.ZodDate; | ||
createdBy: z.ZodString; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
@@ -348,3 +346,2 @@ id: z.ZodString; | ||
type: ActionType; | ||
createdAt: Date; | ||
fields: { | ||
@@ -359,6 +356,4 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
}, { | ||
type: ActionType; | ||
createdAt: Date; | ||
fields: { | ||
@@ -373,8 +368,5 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
}>; | ||
export declare const ActionInput: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{ | ||
type: z.ZodEnum<[ActionType, ...ActionType[]]>; | ||
createdAt: z.ZodDate; | ||
createdBy: z.ZodString; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
@@ -419,3 +411,2 @@ id: z.ZodString; | ||
type: "CREATE"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -430,6 +421,4 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
}, { | ||
type: "CREATE"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -444,7 +433,4 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
type: z.ZodEnum<[ActionType, ...ActionType[]]>; | ||
createdAt: z.ZodDate; | ||
createdBy: z.ZodString; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
@@ -499,3 +485,2 @@ id: z.ZodString; | ||
type: "REGISTER"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -510,3 +495,2 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
identifiers: { | ||
@@ -518,3 +502,2 @@ trackingId: string; | ||
type: "REGISTER"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -529,3 +512,2 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
identifiers: { | ||
@@ -539,4 +521,2 @@ trackingId: string; | ||
type: z.ZodEnum<[ActionType, ...ActionType[]]>; | ||
createdAt: z.ZodDate; | ||
createdBy: z.ZodString; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
@@ -581,3 +561,2 @@ id: z.ZodString; | ||
type: "CREATE"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -592,6 +571,4 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
}, { | ||
type: "CREATE"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -606,7 +583,4 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
type: z.ZodEnum<[ActionType, ...ActionType[]]>; | ||
createdAt: z.ZodDate; | ||
createdBy: z.ZodString; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
@@ -661,3 +635,2 @@ id: z.ZodString; | ||
type: "REGISTER"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -672,3 +645,2 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
identifiers: { | ||
@@ -680,3 +652,2 @@ trackingId: string; | ||
type: "REGISTER"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -691,3 +662,2 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
identifiers: { | ||
@@ -694,0 +664,0 @@ trackingId: string; |
@@ -235,4 +235,4 @@ import { z } from 'zod'; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -247,4 +247,4 @@ id: string; | ||
}, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -266,4 +266,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -285,4 +285,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -307,4 +307,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -337,4 +337,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -375,4 +375,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -413,4 +413,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -473,4 +473,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -533,4 +533,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -574,6 +574,6 @@ id: string; | ||
id: string; | ||
status: "CREATE"; | ||
event: string; | ||
status: "CREATE"; | ||
data: {}; | ||
createdAt: Date; | ||
data: {}; | ||
createdBy: string; | ||
@@ -586,6 +586,6 @@ createdAtLocation: string; | ||
id: string; | ||
status: "CREATE"; | ||
event: string; | ||
status: "CREATE"; | ||
data: {}; | ||
createdAt: Date; | ||
data: {}; | ||
createdBy: string; | ||
@@ -642,4 +642,2 @@ createdAtLocation: string; | ||
type: z.ZodEnum<[ActionType, ...ActionType[]]>; | ||
createdAt: z.ZodDate; | ||
createdBy: z.ZodString; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
@@ -684,3 +682,2 @@ id: z.ZodString; | ||
type: "CREATE"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -695,6 +692,4 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
}, { | ||
type: "CREATE"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -709,7 +704,4 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
type: z.ZodEnum<[ActionType, ...ActionType[]]>; | ||
createdAt: z.ZodDate; | ||
createdBy: z.ZodString; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
@@ -764,3 +756,2 @@ id: z.ZodString; | ||
type: "REGISTER"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -775,3 +766,2 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
identifiers: { | ||
@@ -783,3 +773,2 @@ trackingId: string; | ||
type: "REGISTER"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -794,3 +783,2 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
identifiers: { | ||
@@ -811,6 +799,4 @@ trackingId: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
fields: { | ||
@@ -825,5 +811,5 @@ id: string; | ||
}[]; | ||
createdAt: Date; | ||
actions: (({ | ||
type: "CREATE"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -838,6 +824,4 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
} | { | ||
type: "REGISTER"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -852,3 +836,2 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
identifiers: { | ||
@@ -862,7 +845,6 @@ trackingId: string; | ||
})[]; | ||
updatedAt: Date; | ||
}, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
fields: { | ||
@@ -877,5 +859,5 @@ id: string; | ||
}[]; | ||
createdAt: Date; | ||
actions: (({ | ||
type: "CREATE"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -890,6 +872,4 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
} | { | ||
type: "REGISTER"; | ||
createdAt: Date; | ||
fields: { | ||
@@ -904,3 +884,2 @@ id: string; | ||
}[]; | ||
createdBy: string; | ||
identifiers: { | ||
@@ -914,4 +893,69 @@ trackingId: string; | ||
})[]; | ||
updatedAt: Date; | ||
}>; | ||
export type Event = z.infer<typeof Event>; | ||
/** | ||
* Builds a validated configuration for an event | ||
* @param config - Event specific configuration | ||
*/ | ||
export declare const defineConfig: (config: EventConfig) => { | ||
id: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
summary: { | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
fields: { | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}[]; | ||
}; | ||
actions: { | ||
type: ActionType; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
forms: { | ||
active: boolean; | ||
form: { | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
groups: { | ||
type: string; | ||
id: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
required: boolean; | ||
searchable?: boolean | undefined; | ||
analytics?: boolean | undefined; | ||
}[]; | ||
}[]; | ||
version: { | ||
id: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}; | ||
}[]; | ||
}[]; | ||
}; | ||
//# sourceMappingURL=Event.d.ts.map |
@@ -23,4 +23,4 @@ import { z } from 'zod'; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -35,4 +35,4 @@ id: string; | ||
}, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -82,4 +82,4 @@ id: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -94,4 +94,4 @@ id: string; | ||
}, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -113,4 +113,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -132,4 +132,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -212,4 +212,4 @@ id: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -224,4 +224,4 @@ id: string; | ||
}, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -243,4 +243,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -262,4 +262,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -284,4 +284,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -314,4 +314,4 @@ id: string; | ||
groups: { | ||
type: string; | ||
id: string; | ||
type: string; | ||
label: { | ||
@@ -318,0 +318,0 @@ id: string; |
@@ -93,4 +93,2 @@ "use strict"; | ||
type: import_zod3.z.enum(actionTypes), | ||
createdAt: import_zod3.z.date(), | ||
createdBy: import_zod3.z.string(), | ||
fields: import_zod3.z.array( | ||
@@ -183,2 +181,3 @@ import_zod3.z.object({ | ||
}); | ||
var defineConfig = (config) => EventConfig.parse(config); | ||
})(); |
@@ -171,3 +171,3 @@ import { GetValues } from '../types'; | ||
export type SystemRoleType = GetValues<typeof SystemRoleType>; | ||
export declare const systemRoleTypes: ("LOCAL_REGISTRAR" | "REGISTRATION_AGENT" | "FIELD_AGENT" | "LOCAL_SYSTEM_ADMIN" | "NATIONAL_SYSTEM_ADMIN" | "PERFORMANCE_MANAGEMENT" | "NATIONAL_REGISTRAR")[]; | ||
export declare const systemRoleTypes: ("FIELD_AGENT" | "REGISTRATION_AGENT" | "LOCAL_REGISTRAR" | "LOCAL_SYSTEM_ADMIN" | "NATIONAL_SYSTEM_ADMIN" | "PERFORMANCE_MANAGEMENT" | "NATIONAL_REGISTRAR")[]; | ||
//# sourceMappingURL=utils.d.ts.map |
{ | ||
"name": "@opencrvs/toolkit", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "OpenCRVS toolkit for building country configurations", | ||
@@ -11,9 +11,7 @@ "license": "MPL-2.0", | ||
"scripts": { | ||
"build": "rimraf dist && tsc && yarn build-common-events:js && yarn copy-common-events:ts", | ||
"build": "rimraf dist && tsc --build && yarn build-common-events:js && yarn copy-common-events:ts", | ||
"build-common-events:js": "esbuild src/events/index.ts --bundle --outdir=./dist/events --allow-overwrite --packages=external", | ||
"copy-common-events:ts": "cp -r ../commons/build/dist/events/*.d.ts ./dist/events" | ||
"copy-common-events:ts": "cp -r ../commons/build/dist/common/events/*.d.ts ./dist/events" | ||
}, | ||
"dependencies": { | ||
"@opencrvs/commons": "^1.5.0" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -24,4 +22,4 @@ "esbuild": "^0.24.0", | ||
"moduleNameMapper": { | ||
"@opencrvs/commons/events": "@opencrvs/commons/build/dist/events/index.js" | ||
"@opencrvs/commons/events": "@opencrvs/commons/build/dist/common/events/index.js" | ||
} | ||
} |
# OpenCRVS toolkit | ||
OpenCRVS toolkit for building country configurations. | ||
## File structure | ||
``` | ||
src/ | ||
events/ # re-exports events module from commons package | ||
lib.ts # standard library. currently empty | ||
``` | ||
## Getting started | ||
### Development using yarn link | ||
``` | ||
# tsconfig.json references commons. when `tsc --build` is run, both are built. | ||
> yarn build | ||
# If you miss this part you might face issues with types. | ||
> cd dist | ||
> yarn link | ||
``` | ||
### Releasing and buiding | ||
#### While developing | ||
1. Update version number in `package.json` | ||
2. `yarn build` | ||
3. `npm publish` | ||
#### Through version control | ||
1. Update version number in `package.json` | ||
2. Create a pull request | ||
3. Once merged, github action will get triggered. | ||
#### Gotchas, good to know | ||
- Package is published and should be used without knowledge of rest of the monorepo | ||
- Package exposes `/events` directory, with types, from `packages/commons` through the library, others are excluded. |
@@ -0,1 +1,11 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* OpenCRVS is also distributed under the terms of the Civil Registration | ||
* & Healthcare Disclaimer located at http://opencrvs.org/license. | ||
* | ||
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. | ||
*/ | ||
export * from '@opencrvs/commons/events' |
@@ -16,7 +16,7 @@ { | ||
"@opencrvs/commons/events": ["../commons/src/events/index.ts"] | ||
}, | ||
"composite": true | ||
} | ||
}, | ||
"references": [{ "path": "../commons" }], | ||
"include": ["src/**/*.ts"] | ||
"include": ["src/**/*.ts"], | ||
"exclude": ["**/node_modules/**", "dist"] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
2315
43
0
69032
16
- Removed@opencrvs/commons@^1.5.0