@grasp-labs/ds-microfrontends-integration 0.6.2

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.
Files changed (54) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +255 -0
  3. package/dist/components/index.d.ts +4 -0
  4. package/dist/components/schemaFields/ArrayField.d.ts +8 -0
  5. package/dist/components/schemaFields/BooleanField.d.ts +8 -0
  6. package/dist/components/schemaFields/EnumField.d.ts +8 -0
  7. package/dist/components/schemaFields/FieldError.d.ts +9 -0
  8. package/dist/components/schemaFields/JsonField.d.ts +8 -0
  9. package/dist/components/schemaFields/NumberField.d.ts +8 -0
  10. package/dist/components/schemaFields/SchemaFields.d.ts +10 -0
  11. package/dist/components/schemaFields/TextField.d.ts +8 -0
  12. package/dist/components/schemaFields/index.d.ts +8 -0
  13. package/dist/components/toast/ToastProvider.d.ts +15 -0
  14. package/dist/components/toast/ToastProvider.stories.d.ts +13 -0
  15. package/dist/components/toast/index.d.ts +3 -0
  16. package/dist/components/toast/types.d.ts +4 -0
  17. package/dist/components/translation/TranslationProvider/TranslationProvider.d.ts +30 -0
  18. package/dist/components/translation/TranslationProvider/index.d.ts +2 -0
  19. package/dist/components/translation/index.d.ts +1 -0
  20. package/dist/components/vault/VaultInput/VaultInput.d.ts +19 -0
  21. package/dist/components/vault/VaultInput/VaultInput.stories.d.ts +58 -0
  22. package/dist/components/vault/VaultInput/VaultInputField.d.ts +9 -0
  23. package/dist/components/vault/VaultInput/index.d.ts +4 -0
  24. package/dist/components/vault/VaultProvider/VaultProvider.d.ts +8 -0
  25. package/dist/components/vault/VaultProvider/index.d.ts +2 -0
  26. package/dist/components/vault/VaultSecretDialog/VaultSecretDialog.d.ts +10 -0
  27. package/dist/components/vault/VaultSecretDialog/VaultSecretDialog.stories.d.ts +36 -0
  28. package/dist/components/vault/VaultSecretDialog/index.d.ts +2 -0
  29. package/dist/components/vault/index.d.ts +3 -0
  30. package/dist/hooks/index.d.ts +1 -0
  31. package/dist/index-8yHLPV2n.js +11530 -0
  32. package/dist/index.d.ts +5 -0
  33. package/dist/index.esm-DgyjJxy1-CnakrFTI.js +781 -0
  34. package/dist/index.js +33 -0
  35. package/dist/lib/schema/defaults.d.ts +3 -0
  36. package/dist/lib/schema/descriptor.d.ts +10 -0
  37. package/dist/lib/schema/index.d.ts +5 -0
  38. package/dist/lib/schema/inspector.d.ts +10 -0
  39. package/dist/lib/schema/resolver.d.ts +2 -0
  40. package/dist/lib/schema/testUtils.d.ts +2 -0
  41. package/dist/lib/schema/types.d.ts +23 -0
  42. package/dist/mf-common.d.ts +44 -0
  43. package/dist/mf-common.js +45 -0
  44. package/dist/test/setup.d.ts +0 -0
  45. package/dist/translations/en/common.json.d.ts +24 -0
  46. package/dist/translations/no/common.json.d.ts +24 -0
  47. package/dist/types/Schema.d.ts +6 -0
  48. package/dist/types/index.d.ts +3 -0
  49. package/dist/types/translation.d.ts +7 -0
  50. package/dist/types/typeGuards.d.ts +13 -0
  51. package/dist/types/vault.d.ts +28 -0
  52. package/dist/utils/index.d.ts +1 -0
  53. package/package.json +95 -0
  54. package/src/index.css +2 -0
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
1
+ import { A as e, B as l, E as t, F as i, J as r, N as o, S as u, T as d, a as n, g as F, d as m, e as c, V as p, f as T, q as V, t as h, j as S, k as b, s as g, l as v, m as f, n as x, o as y, p as D, v as E, r as P, u as A, h as I, i as N, b as j } from "./index-8yHLPV2n.js";
2
+ export {
3
+ e as ArrayField,
4
+ l as BooleanField,
5
+ t as EnumField,
6
+ i as FieldError,
7
+ r as JsonField,
8
+ o as NumberField,
9
+ u as SchemaFields,
10
+ d as TextField,
11
+ n as ToastProvider,
12
+ F as TranslationProvider,
13
+ m as VaultInput,
14
+ c as VaultInputField,
15
+ p as VaultProvider,
16
+ T as VaultSecretDialog,
17
+ V as buildDefaultValues,
18
+ h as createFieldDescriptor,
19
+ S as extractConstraints,
20
+ b as getArrayItemsSchema,
21
+ g as getDefaultValue,
22
+ v as getFieldType,
23
+ f as isEnumField,
24
+ x as isNullable,
25
+ y as isObjectWithoutProperties,
26
+ D as isReadOnly,
27
+ E as parseSchemaFields,
28
+ P as resolveSchema,
29
+ A as useToast,
30
+ I as useTranslation,
31
+ N as useTranslationContext,
32
+ j as useVault
33
+ };
@@ -0,0 +1,3 @@
1
+ import { Schema } from 'src/types/Schema';
2
+ export declare function getDefaultValue(fieldSchema: Schema, rootSchema?: Schema, initialValue?: unknown): unknown;
3
+ export declare function buildDefaultValues(schema: Schema | null, rootSchema?: Schema, initialValues?: Record<string, unknown>): Record<string, unknown> | undefined;
@@ -0,0 +1,10 @@
1
+ import { Schema } from 'src/types/Schema';
2
+ import { FieldDescriptor } from './types';
3
+ /**
4
+ * Create a field descriptor from a schema
5
+ */
6
+ export declare function createFieldDescriptor(key: string, schema: Schema, prefix?: string, rootSchema?: Schema, requiredFields?: string[]): FieldDescriptor;
7
+ /**
8
+ * Parse schema fields into field descriptors
9
+ */
10
+ export declare function parseSchemaFields(schema: Schema | null, prefix?: string, rootSchema?: Schema): FieldDescriptor[];
@@ -0,0 +1,5 @@
1
+ export type { Constraints, FieldDescriptor, FieldType } from './types';
2
+ export { resolveSchema } from './resolver';
3
+ export { extractConstraints, getArrayItemsSchema, getFieldType, isEnumField, isNullable, isObjectWithoutProperties, isReadOnly, } from './inspector';
4
+ export { buildDefaultValues, getDefaultValue } from './defaults';
5
+ export { createFieldDescriptor, parseSchemaFields } from './descriptor';
@@ -0,0 +1,10 @@
1
+ import { Schema } from 'src/types/Schema';
2
+ import { Constraints, FieldType } from './types';
3
+ export declare function isEnumField(schema: Schema): boolean;
4
+ export declare function isReadOnly(schema: Schema): boolean;
5
+ export declare function isNullable(schema: Schema): boolean;
6
+ export declare function isObjectWithoutProperties(schema: Schema): boolean;
7
+ export declare function getFieldType(schema: Schema): FieldType;
8
+ export declare function getArrayItemsSchema(schema: Schema): Schema | null;
9
+ export declare function formatLabel(key: string): string;
10
+ export declare function extractConstraints(schema: Schema): Constraints;
@@ -0,0 +1,2 @@
1
+ import { Schema } from 'src/types/Schema';
2
+ export declare function resolveSchema(schema: Schema, rootSchema: Schema, visited?: Set<string>): Schema;
@@ -0,0 +1,2 @@
1
+ import { Schema } from 'src/types/Schema';
2
+ export declare function createTestSchema(schema: Pick<Schema, "type"> & Partial<Schema>): Schema;
@@ -0,0 +1,23 @@
1
+ import { Schema } from 'src/types/Schema';
2
+ export declare const FIELD_TYPES: readonly ["string", "number", "integer", "boolean", "object", "object-string", "array", "enum", "const", "null", "unknown"];
3
+ export type FieldType = (typeof FIELD_TYPES)[number];
4
+ export type Constraints = {
5
+ minimum?: number;
6
+ maximum?: number;
7
+ minLength?: number;
8
+ maxLength?: number;
9
+ multipleOf?: number;
10
+ pattern?: string;
11
+ format?: string;
12
+ enum?: unknown[];
13
+ };
14
+ export type FieldDescriptor = {
15
+ key: string;
16
+ fieldName: string;
17
+ schema: Schema;
18
+ type: FieldType;
19
+ label: string;
20
+ isDisabled: boolean;
21
+ required: boolean;
22
+ constraints: Constraints;
23
+ };
@@ -0,0 +1,44 @@
1
+ import { IconName } from '@grasp-labs/ds-react-components';
2
+ import { ModuleFederationOptions } from '@module-federation/vite/lib/utils/normalizeModuleFederationOptions';
3
+ export type RouteConfig = {
4
+ label: string;
5
+ path: string;
6
+ icon?: IconName;
7
+ type?: "hidden" | "visible";
8
+ };
9
+ /**
10
+ * INDEX is a mandatory route representing the root of the microfrontend, used as the parent navigation item in the sidebar
11
+ */
12
+ export type IndexNavigationConfig = {
13
+ INDEX: RouteConfig;
14
+ };
15
+ export type NavigationConfig<TKeys extends string = string> = IndexNavigationConfig & Record<TKeys, RouteConfig>;
16
+ export type MicrofrontendExposes = {
17
+ ".": string;
18
+ "./navigationConfig": string;
19
+ } & Record<string, string>;
20
+ export declare const createModuleFederationConfig: (name: string, overrides?: Partial<ModuleFederationOptions>) => ModuleFederationOptions;
21
+ export declare const COMMON_SHARED_DEPS: {
22
+ react: {
23
+ singleton: boolean;
24
+ requiredVersion: string;
25
+ };
26
+ "react-dom": {
27
+ singleton: boolean;
28
+ requiredVersion: string;
29
+ };
30
+ "react-router": {
31
+ singleton: boolean;
32
+ requiredVersion: string;
33
+ };
34
+ "@grasp-labs/ds-microfrontends-integration": {
35
+ singleton: boolean;
36
+ requiredVersion: string;
37
+ };
38
+ axios: {
39
+ singleton: boolean;
40
+ requiredVersion: string;
41
+ };
42
+ };
43
+ export declare const createMicrofrontendsBase: (name: string) => string;
44
+ export declare const dsFederation: (name: string, overrides?: Partial<ModuleFederationOptions>) => import('vite').Plugin<any>[];
@@ -0,0 +1,45 @@
1
+ import { federation as t } from "@module-federation/vite";
2
+ const o = (e, r = {}) => {
3
+ const n = s(e);
4
+ return {
5
+ name: e,
6
+ manifest: !0,
7
+ filename: "remoteEntry.js",
8
+ getPublicPath: `function() {return "${n}"}`,
9
+ exposes: {
10
+ ".": "./src/App",
11
+ "./navigationConfig": "./src/navigationConfig"
12
+ },
13
+ shared: { ...i },
14
+ ...r
15
+ };
16
+ }, i = {
17
+ react: {
18
+ singleton: !0,
19
+ requiredVersion: "^19.1.0"
20
+ },
21
+ "react-dom": {
22
+ singleton: !0,
23
+ requiredVersion: "^19.1.0"
24
+ },
25
+ "react-router": {
26
+ singleton: !0,
27
+ requiredVersion: "^7.8.2"
28
+ },
29
+ "@grasp-labs/ds-microfrontends-integration": {
30
+ singleton: !0,
31
+ requiredVersion: ">=0.4.0 <1.0.0"
32
+ },
33
+ axios: {
34
+ singleton: !0,
35
+ requiredVersion: "^1.7.9"
36
+ }
37
+ }, s = (e) => `microfrontends/${e}/`, c = (e, r = {}) => t({
38
+ ...o(e, r)
39
+ });
40
+ export {
41
+ i as COMMON_SHARED_DEPS,
42
+ s as createMicrofrontendsBase,
43
+ o as createModuleFederationConfig,
44
+ c as dsFederation
45
+ };
File without changes
@@ -0,0 +1,24 @@
1
+ declare const _default: {
2
+ "vaultSecretDialog": {
3
+ "addTitle": "Add New Secret",
4
+ "editTitle": "Edit Secret",
5
+ "cancel": "Cancel",
6
+ "delete": "Delete Secret",
7
+ "deleting": "Deleting...",
8
+ "create": "Create Secret",
9
+ "save": "Save Changes",
10
+ "creating": "Creating...",
11
+ "saving": "Saving...",
12
+ "createError": "Failed to generate secret. Please try again.",
13
+ "updateError": "Failed to update secret. Please try again.",
14
+ "deleteError": "Failed to delete secret. Please try again."
15
+ },
16
+ "vaultInput": {
17
+ "placeholder": "Select a secret",
18
+ "addAriaLabel": "Add new secret",
19
+ "toggleAriaLabel": "Toggle options menu"
20
+ }
21
+ }
22
+ ;
23
+
24
+ export default _default;
@@ -0,0 +1,24 @@
1
+ declare const _default: {
2
+ "vaultSecretDialog": {
3
+ "addTitle": "Legg til ny hemmelighet",
4
+ "editTitle": "Rediger hemmelighet",
5
+ "cancel": "Avbryt",
6
+ "delete": "Slett hemmelighet",
7
+ "deleting": "Sletter...",
8
+ "create": "Opprett hemmelighet",
9
+ "save": "Lagre endringer",
10
+ "creating": "Oppretter...",
11
+ "saving": "Lagrer...",
12
+ "createError": "Kunne ikke opprette hemmelighet. Prøv igjen.",
13
+ "updateError": "Kunne ikke oppdatere hemmeligheten. Prøv igjen.",
14
+ "deleteError": "Kunne ikke slette hemmeligheten. Prøv igjen."
15
+ },
16
+ "vaultInput": {
17
+ "placeholder": "Velg en hemmelighet",
18
+ "addAriaLabel": "Legg til ny hemmelighet",
19
+ "toggleAriaLabel": "Vis eller skjul alternativer"
20
+ }
21
+ }
22
+ ;
23
+
24
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { JSONSchemaType } from 'ajv';
2
+ /**
3
+ * JSON Schema type for validation.
4
+ * Represents a schema for validating objects with unknown properties.
5
+ */
6
+ export type Schema = JSONSchemaType<Record<string, unknown>>;
@@ -0,0 +1,3 @@
1
+ export * from './Schema';
2
+ export * from './translation';
3
+ export * from './vault';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Translation function type for i18next.
3
+ * @param key - Translation key (e.g., "common.title")
4
+ * @param options - Optional parameters (variables, namespace, etc.)
5
+ * @returns Translated string
6
+ */
7
+ export type TranslationFn = (key: string, options?: Record<string, unknown>) => string;
@@ -0,0 +1,13 @@
1
+ import { Schema } from './Schema';
2
+ /**
3
+ * Type guard to check if a value is a plain object.
4
+ * @param value - Value to check
5
+ * @returns True if value is a non-null object (not an array)
6
+ */
7
+ export declare const isObject: (value: unknown) => value is Record<string, unknown>;
8
+ /**
9
+ * Type guard to check if a value is a valid JSON Schema.
10
+ * @param value - Value to check
11
+ * @returns True if value is a valid Schema object
12
+ */
13
+ export declare const isSchema: (value: unknown) => value is Schema;
@@ -0,0 +1,28 @@
1
+ import { Schema } from './Schema';
2
+ /**
3
+ * Represents a secret stored in the vault.
4
+ */
5
+ export type Secret = {
6
+ /** Unique identifier for the secret */
7
+ id: string;
8
+ /** Display name of the secret */
9
+ name: string;
10
+ /** Optional description of the secret */
11
+ description: string;
12
+ };
13
+ /**
14
+ * Context value for the Vault provider.
15
+ * Provides access to secrets list, schema, and CRUD operations.
16
+ */
17
+ export type VaultContextValue = {
18
+ /** List of all secrets in the vault */
19
+ secretsList: Secret[];
20
+ /** JSON Schema defining the structure of secrets */
21
+ schema: Schema;
22
+ /** Creates a new secret from form data */
23
+ generateSecret: (data: Record<string, unknown>) => Promise<Secret>;
24
+ /** Updates an existing secret */
25
+ updateSecret: (secret: Secret) => Promise<Secret>;
26
+ /** Deletes a secret by ID */
27
+ deleteSecret: (id: string) => Promise<void>;
28
+ };
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@grasp-labs/ds-microfrontends-integration",
3
+ "version": "0.6.2",
4
+ "private": false,
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "main": "dist/index.js",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ },
16
+ "./mf-common": {
17
+ "import": "./dist/mf-common.js",
18
+ "types": "./dist/mf-common.d.ts"
19
+ },
20
+ "./styles.css": "./src/index.css"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "src/index.css"
25
+ ],
26
+ "engines": {
27
+ "node": ">=22"
28
+ },
29
+ "sideEffects": false,
30
+ "scripts": {
31
+ "build": "tsc && vite build",
32
+ "lint": "eslint .",
33
+ "lint:fix": "eslint . --fix",
34
+ "dev": "npm run build -- --watch",
35
+ "storybook": "storybook dev -p 6006",
36
+ "build-storybook": "storybook build",
37
+ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
38
+ "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
39
+ "test": "vitest run",
40
+ "test:watch": "vitest",
41
+ "test:coverage": "vitest run --coverage"
42
+ },
43
+ "peerDependencies": {
44
+ "@module-federation/vite": "^1.0.0",
45
+ "ajv": "^8.0.0",
46
+ "axios": "^1.7.9",
47
+ "react": "^19.1.0",
48
+ "react-dom": "^19.1.0",
49
+ "react-hook-form": "^7.0.0",
50
+ "react-router": "^7.8.2"
51
+ },
52
+ "devDependencies": {
53
+ "@eslint/js": "^9.32.0",
54
+ "@grasp-labs/ds-react-components": "^0.13.0",
55
+ "@module-federation/vite": "^1.9.0",
56
+ "@storybook/addon-a11y": "^9.1.0",
57
+ "@storybook/addon-themes": "^9.1.0",
58
+ "@storybook/react-vite": "^9.1.0",
59
+ "@tailwindcss/vite": "^4.1.11",
60
+ "@testing-library/jest-dom": "^6.6.3",
61
+ "@testing-library/react": "^16.3.0",
62
+ "@testing-library/user-event": "^14.6.1",
63
+ "@types/node": "^22.16.5",
64
+ "@types/react": "^19.1.10",
65
+ "@types/react-dom": "^19.1.7",
66
+ "@vitejs/plugin-react": "^4.6.0",
67
+ "@vitest/coverage-v8": "^3.2.4",
68
+ "ajv": "^8.17.1",
69
+ "eslint": "^9.32.0",
70
+ "eslint-config-prettier": "^10.1.8",
71
+ "eslint-plugin-prettier": "^5.5.3",
72
+ "eslint-plugin-react-hooks": "^5.2.0",
73
+ "eslint-plugin-storybook": "^9.1.0",
74
+ "globals": "^16.2.0",
75
+ "jsdom": "^26.1.0",
76
+ "json-edit-react": "^1.29.0",
77
+ "prettier": "^3.6.2",
78
+ "prettier-plugin-tailwindcss": "^0.6.14",
79
+ "react": "^19.1.1",
80
+ "react-dom": "^19.1.1",
81
+ "react-hook-form": "^7.66.0",
82
+ "storybook": "^9.1.0",
83
+ "tailwind-merge": "^3.3.1",
84
+ "tailwindcss": "^4.1.11",
85
+ "typescript": "~5.8.3",
86
+ "typescript-eslint": "^8.35.0",
87
+ "vite": "^7.0.6",
88
+ "vite-plugin-dts": "^4.5.4",
89
+ "vite-tsconfig-paths": "^5.1.4",
90
+ "vitest": "^3.2.4"
91
+ },
92
+ "dependencies": {
93
+ "i18next": "^23.16.8"
94
+ }
95
+ }
package/src/index.css ADDED
@@ -0,0 +1,2 @@
1
+ @import "@grasp-labs/ds-react-components/tailwind-styles.css";
2
+ @import "@grasp-labs/ds-react-components/styles.css";