New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@opencrvs/toolkit

Package Overview
Dependencies
Maintainers
0
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencrvs/toolkit - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

dist/events/ActionConfig.d.ts

8

dist/events/index.d.ts

@@ -1,5 +0,5 @@

export * from './Action';
export * from './Event';
export * from './Form';
export * from './utils';
export * from './ActionConfig';
export * from './EventConfig';
export * from './FieldConfig';
export * from './FormConfig';
//# sourceMappingURL=index.d.ts.map
"use strict";
(() => {
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// ../commons/src/events/Action.ts
var import_zod3 = __require("zod");
// src/events/index.ts
var events_exports = {};
__export(events_exports, {
ActionConfig: () => ActionConfig,
ActionConfigBase: () => ActionConfigBase,
ActionType: () => ActionType,
EventConfig: () => EventConfig,
FieldConfig: () => FieldConfig,
FormConfig: () => FormConfig,
defineConfig: () => defineConfig
});
module.exports = __toCommonJS(events_exports);
// ../commons/src/events/Form.ts
var import_zod2 = __require("zod");
// ../commons/src/events/ActionConfig.ts
var import_zod4 = require("zod");
// ../commons/src/events/utils.ts
var import_zod = __require("zod");
var Label = import_zod.z.object({
defaultMessage: import_zod.z.string(),
description: import_zod.z.string(),
id: import_zod.z.string()
});
var Field = import_zod.z.object({
label: Label
});
var Summary = import_zod.z.object({
title: Label,
fields: import_zod.z.array(Field)
});
var Query = import_zod.z.object({
requester: import_zod.z.object({
phone: import_zod.z.object({
check: import_zod.z.string()
}),
name: import_zod.z.object({
check: import_zod.z.string()
})
})
});
var SystemRoleType = {
FieldAgent: "FIELD_AGENT",
LocalRegistrar: "LOCAL_REGISTRAR",
LocalSystemAdmin: "LOCAL_SYSTEM_ADMIN",
NationalRegistrar: "NATIONAL_REGISTRAR",
NationalSystemAdmin: "NATIONAL_SYSTEM_ADMIN",
PerformanceManagement: "PERFORMANCE_MANAGEMENT",
RegistrationAgent: "REGISTRATION_AGENT"
};
var systemRoleTypes = Object.values(SystemRoleType);
// ../commons/src/events/FormConfig.ts
var import_zod3 = require("zod");
// ../commons/src/events/Form.ts
var FormGroupField = Field.extend({
id: import_zod2.z.string(),
type: import_zod2.z.string(),
// @TODO: Get enums from somewhere, field types
required: import_zod2.z.boolean(),
searchable: import_zod2.z.boolean().optional(),
analytics: import_zod2.z.boolean().optional()
});
var FormSection = import_zod2.z.object({
title: Label,
groups: import_zod2.z.array(FormGroupField)
});
var Form = import_zod2.z.object({
active: import_zod2.z.boolean(),
version: import_zod2.z.object({
id: import_zod2.z.string(),
label: Label
}),
form: import_zod2.z.array(FormSection)
});
// ../commons/src/events/FieldConfig.ts
var import_zod2 = require("zod");
// ../commons/src/events/Action.ts
var ActionType = {
CREATE: "CREATE",
ASSIGN: "ASSIGN",
UNASSIGN: "UNASSIGN",
REGISTER: "REGISTER",
VALIDATE: "VALIDATE",
CORRECT: "CORRECT",
DETECT_DUPLICATE: "DETECT_DUPLICATE",
NOTIFY: "NOTIFY",
DECLARE: "DECLARE"
};
var actionTypes = Object.values(ActionType);
var ActionConfig = import_zod3.z.object({
type: import_zod3.z.enum(actionTypes),
label: Label,
forms: import_zod3.z.array(Form)
});
var ActionInputBase = import_zod3.z.object({
type: import_zod3.z.enum(actionTypes),
fields: import_zod3.z.array(
import_zod3.z.object({
id: import_zod3.z.string(),
value: import_zod3.z.union([
import_zod3.z.string(),
import_zod3.z.number(),
import_zod3.z.array(
import_zod3.z.object({
optionValues: import_zod3.z.array(import_zod3.z.string()),
type: import_zod3.z.string(),
data: import_zod3.z.string(),
fileSize: import_zod3.z.number()
})
)
])
})
// ../commons/src/events/TranslationConfig.ts
var import_zod = require("zod");
var TranslationConfig = import_zod.z.object({
id: import_zod.z.string().describe(
"The identifier of the translation referred in translation CSV files"
),
defaultMessage: import_zod.z.string().describe("Default translation message"),
description: import_zod.z.string().describe(
"Describe the translation for a translator to be able to identify it."
)
});
// ../commons/src/events/FieldConfig.ts
var BaseField = import_zod2.z.object({
id: import_zod2.z.string(),
required: import_zod2.z.boolean(),
label: TranslationConfig
});
var TextField = BaseField.describe("Text input").merge(
import_zod2.z.object({
type: import_zod2.z.literal("TEXT"),
options: import_zod2.z.object({
maxLength: import_zod2.z.number().describe("Maximum length of the text")
}).optional()
})
);
var DateField = BaseField.describe("A single date input (dd-mm-YYYY)").merge(
import_zod2.z.object({
type: import_zod2.z.literal("DATE"),
options: import_zod2.z.object({
notice: TranslationConfig.describe(
"Text to display above the date input"
)
}).optional()
})
);
var Paragraph = BaseField.describe("A read-only HTML <p> paragraph").merge(
import_zod2.z.object({ type: import_zod2.z.literal("PARAGRAPH") })
);
var FieldConfig = import_zod2.z.discriminatedUnion("type", [
TextField,
DateField,
Paragraph
]);
// ../commons/src/events/FormConfig.ts
var FormConfig = import_zod3.z.object({
label: TranslationConfig.describe("Human readable description of the form"),
version: import_zod3.z.object({
id: import_zod3.z.string().describe(
"Form version. Semantic versioning recommended. Example: 0.0.1"
),
label: TranslationConfig.describe(
"Human readable description of the version"
)
});
var ActionInput = import_zod3.z.union([
ActionInputBase.extend({
type: import_zod3.z.enum([ActionType.CREATE])
}),
ActionInputBase.extend({
type: import_zod3.z.enum([ActionType.REGISTER]),
identifiers: import_zod3.z.object({
trackingId: import_zod3.z.string(),
registrationNumber: import_zod3.z.string()
})
})
]);
var Action = ActionInput.and(
}),
active: import_zod3.z.boolean().default(false).describe("Whether the form is active"),
pages: import_zod3.z.array(
import_zod3.z.object({
createdAt: import_zod3.z.date(),
createdBy: import_zod3.z.string()
id: import_zod3.z.string().describe("Unique identifier for the page"),
title: TranslationConfig.describe("Header title of the page"),
fields: import_zod3.z.array(FieldConfig).describe("Fields to be rendered on the page")
})
);
)
});
// ../commons/src/events/Event.ts
var import_zod4 = __require("zod");
var EventInput = import_zod4.z.object({
type: import_zod4.z.string(),
fields: import_zod4.z.array(
import_zod4.z.object({
id: import_zod4.z.string(),
value: import_zod4.z.union([
import_zod4.z.string(),
import_zod4.z.number(),
import_zod4.z.array(
// @TODO: Check if we could make this stricter
import_zod4.z.object({
optionValues: import_zod4.z.array(import_zod4.z.string()),
type: import_zod4.z.string(),
data: import_zod4.z.string(),
fileSize: import_zod4.z.number()
})
)
])
})
)
});
var EventConfig = import_zod4.z.object({
id: import_zod4.z.string(),
label: Label,
summary: Summary,
actions: import_zod4.z.array(ActionConfig)
});
var EventIndex = import_zod4.z.object({
id: import_zod4.z.string(),
event: import_zod4.z.string(),
status: import_zod4.z.enum([ActionType.CREATE]),
createdAt: import_zod4.z.date(),
createdBy: import_zod4.z.string(),
createdAtLocation: import_zod4.z.string(),
// uuid
modifiedAt: import_zod4.z.date(),
assignedTo: import_zod4.z.string(),
updatedBy: import_zod4.z.string(),
data: import_zod4.z.object({})
});
var Event = EventInput.extend({
id: import_zod4.z.string(),
type: import_zod4.z.string(),
// Should be replaced by a reference to a form version
createdAt: import_zod4.z.date(),
updatedAt: import_zod4.z.date(),
actions: import_zod4.z.array(Action)
});
var defineConfig = (config) => EventConfig.parse(config);
})();
// ../commons/src/events/ActionConfig.ts
var ActionConfigBase = import_zod4.z.object({
label: TranslationConfig,
forms: import_zod4.z.array(FormConfig)
});
var ActionType = {
CREATE: "CREATE",
ASSIGN: "ASSIGN",
UNASSIGN: "UNASSIGN",
REGISTER: "REGISTER",
VALIDATE: "VALIDATE",
CORRECT: "CORRECT",
DETECT_DUPLICATE: "DETECT_DUPLICATE",
NOTIFY: "NOTIFY",
DECLARE: "DECLARE"
};
var CreateConfig = ActionConfigBase.merge(
import_zod4.z.object({
type: import_zod4.z.literal(ActionType.CREATE)
})
);
var DeclareConfig = ActionConfigBase.merge(
import_zod4.z.object({
type: import_zod4.z.literal(ActionType.DECLARE)
})
);
var RegisterConfig = ActionConfigBase.merge(
import_zod4.z.object({
type: import_zod4.z.literal(ActionType.REGISTER)
})
);
var ActionConfig = import_zod4.z.discriminatedUnion("type", [
CreateConfig,
DeclareConfig,
RegisterConfig
]);
// ../commons/src/events/EventConfig.ts
var import_zod5 = require("zod");
var EventConfig = import_zod5.z.object({
id: import_zod5.z.string().describe(
'A machine-readable identifier for the event, e.g. "birth" or "death"'
),
label: TranslationConfig,
actions: import_zod5.z.array(ActionConfig)
});
var defineConfig = (config) => EventConfig.parse(config);
{
"name": "@opencrvs/toolkit",
"version": "0.0.4",
"version": "0.0.5",
"description": "OpenCRVS toolkit for building country configurations",

@@ -12,3 +12,3 @@ "license": "MPL-2.0",

"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",
"build-common-events:js": "esbuild src/events/index.ts --bundle --format=cjs --outdir=./dist/events --allow-overwrite --packages=external",
"copy-common-events:ts": "cp -r ../commons/build/dist/common/events/*.d.ts ./dist/events"

@@ -15,0 +15,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc