passerelle-geo-components 0.2.0-alpha.1
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/README.md +77 -0
- package/examples/README.md +175 -0
- package/examples/choropleth-demographique.json +90 -0
- package/examples/corpus-documentaire.json +170 -0
- package/examples/diagnostic-temporel.json +160 -0
- package/examples/heatmap-rag.json +84 -0
- package/examples/maquette-3d.json +153 -0
- package/examples/minimal.json +19 -0
- package/examples/multi-layers-narrative.json +119 -0
- package/examples/timeline-overlay-simple.json +90 -0
- package/examples/validation-terrain-zebra.json +98 -0
- package/geo-components.js +1719 -0
- package/package.json +77 -0
- package/schemas/README.md +125 -0
- package/schemas/scene_manifest.pydantic.py +1000 -0
- package/schemas/scene_manifest.schema.json +905 -0
- package/schemas/scene_manifest.zod.ts +66 -0
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "passerelle-geo-components",
|
|
3
|
+
"version": "0.2.0-alpha.1",
|
|
4
|
+
"description": "Web Components pour cartes MapLibre + composants controllers pilotes - brique commune multi-projet avec contract SceneManifest V0.3.1. Zero dependance runtime, ES module, encapsulation Shadow DOM.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "geo-components.js",
|
|
7
|
+
"module": "geo-components.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./geo-components.js",
|
|
10
|
+
"./schemas/scene-manifest": "./schemas/scene_manifest.schema.json",
|
|
11
|
+
"./schemas/scene-manifest-zod": "./schemas/scene_manifest.zod.ts"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"geo-components.js",
|
|
15
|
+
"README.md",
|
|
16
|
+
"schemas/scene_manifest.schema.json",
|
|
17
|
+
"schemas/scene_manifest.zod.ts",
|
|
18
|
+
"schemas/scene_manifest.pydantic.py",
|
|
19
|
+
"examples/*.json"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "node _selftest.mjs",
|
|
23
|
+
"test:schemas": "node scripts/test-schemas.mjs",
|
|
24
|
+
"build:zod": "json-schema-to-zod -i schemas/scene_manifest.schema.json -o schemas/scene_manifest.zod.ts --name SceneManifestSchema",
|
|
25
|
+
"build:pydantic": "datamodel-codegen --input schemas/scene_manifest.schema.json --input-file-type jsonschema --output schemas/scene_manifest.pydantic.py --output-model-type pydantic_v2.BaseModel --field-constraints --use-double-quotes --strict-nullable",
|
|
26
|
+
"build:schemas": "npm run build:zod && npm run build:pydantic",
|
|
27
|
+
"validate:examples": "for f in examples/*.json; do ajv validate -s schemas/scene_manifest.schema.json -d \"$f\" --spec=draft2020 || exit 1; done",
|
|
28
|
+
"sync-schema": "node scripts/sync-schema-from-qgis-sspcloud.mjs",
|
|
29
|
+
"prepack": "node -e \"const fs=require('fs');fs.copyFileSync('README.md','.README.repo.md.bak');fs.copyFileSync('NPM-README.md','README.md');\"",
|
|
30
|
+
"postpack": "node -e \"const fs=require('fs');if(fs.existsSync('.README.repo.md.bak')){fs.copyFileSync('.README.repo.md.bak','README.md');fs.unlinkSync('.README.repo.md.bak');}\""
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"ajv": "^8.12.0",
|
|
34
|
+
"ajv-formats": "^3.0.1",
|
|
35
|
+
"ajv-cli": "^5.0.0",
|
|
36
|
+
"json-schema-to-zod": "^2.4.0",
|
|
37
|
+
"@apidevtools/json-schema-ref-parser": "^11.0.0"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"geospatial",
|
|
41
|
+
"maplibre",
|
|
42
|
+
"web-components",
|
|
43
|
+
"custom-elements",
|
|
44
|
+
"cartography",
|
|
45
|
+
"scene-manifest",
|
|
46
|
+
"storymap",
|
|
47
|
+
"three-js",
|
|
48
|
+
"grist-widget",
|
|
49
|
+
"qgis"
|
|
50
|
+
],
|
|
51
|
+
"author": "Nicolas LAVAL <laval.nicolas13@gmail.com>",
|
|
52
|
+
"license": "EUPL-1.2",
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"maplibre-gl": "^5.6.1",
|
|
55
|
+
"geoai-kit": "^0.2.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"maplibre-gl": {
|
|
59
|
+
"optional": false
|
|
60
|
+
},
|
|
61
|
+
"geoai-kit": {
|
|
62
|
+
"optional": true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"sideEffects": [
|
|
66
|
+
"geo-components.js"
|
|
67
|
+
],
|
|
68
|
+
"repository": {
|
|
69
|
+
"type": "git",
|
|
70
|
+
"url": "https://github.com/nic01asFr/Passerelle.git",
|
|
71
|
+
"directory": "sdk/js/geo-components"
|
|
72
|
+
},
|
|
73
|
+
"publishConfig": {
|
|
74
|
+
"access": "public",
|
|
75
|
+
"tag": "dev"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Schemas — 3 dialectes du contract SceneManifest V0.3.1
|
|
2
|
+
|
|
3
|
+
Ce dossier contient les **3 dialectes** du contract `SceneManifest V0.3.1` :
|
|
4
|
+
|
|
5
|
+
- **`scene_manifest.schema.json`** — JSON Schema 2020-12 **canonique** (source de vérité)
|
|
6
|
+
- **`scene_manifest.zod.ts`** — Zod TypeScript (généré depuis JSON Schema)
|
|
7
|
+
- **`scene_manifest.pydantic.py`** — Pydantic Python (généré depuis JSON Schema)
|
|
8
|
+
|
|
9
|
+
Voir [`../CONTRACT-V0.3.1.md`](../CONTRACT-V0.3.1.md) pour la spec humaine complète.
|
|
10
|
+
|
|
11
|
+
## Source de vérité
|
|
12
|
+
|
|
13
|
+
**Seul `scene_manifest.schema.json` est édité manuellement.** Les deux autres dialectes sont **générés automatiquement** via la CI.
|
|
14
|
+
|
|
15
|
+
Rationale : garantir round-trip Zod ⇔ Pydantic ⇔ JSON Schema sans divergence (P0-G de la revue adversariale 2026-07-10).
|
|
16
|
+
|
|
17
|
+
## Pipeline de génération
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
scene_manifest.schema.json (édité manuellement)
|
|
21
|
+
│
|
|
22
|
+
├──▶ datamodel-code-generator ──▶ scene_manifest.pydantic.py
|
|
23
|
+
│
|
|
24
|
+
└──▶ json-schema-to-zod ────────▶ scene_manifest.zod.ts
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Prérequis
|
|
28
|
+
|
|
29
|
+
Dependencies déjà déclarées dans `../package.json` (à ajouter en Chantier 1c) :
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"json-schema-to-zod": "^2.4.0",
|
|
35
|
+
"@apidevtools/json-schema-ref-parser": "^11.0.0",
|
|
36
|
+
"ajv": "^8.12.0",
|
|
37
|
+
"ajv-formats": "^3.0.1"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Python (via pip pour la CI ou local venv) :
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
datamodel-code-generator[http]==0.30.0
|
|
46
|
+
pydantic==2.9.2
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Commandes de génération
|
|
50
|
+
|
|
51
|
+
Depuis le dossier `sdk/js/geo-components/` :
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# 1. Valider le JSON Schema (draft 2020-12)
|
|
55
|
+
pnpm exec ajv validate -s schemas/scene_manifest.schema.json -d examples/minimal.json --spec=draft2020
|
|
56
|
+
|
|
57
|
+
# 2. Générer Zod TypeScript
|
|
58
|
+
pnpm exec json-schema-to-zod \
|
|
59
|
+
-i schemas/scene_manifest.schema.json \
|
|
60
|
+
-o schemas/scene_manifest.zod.ts \
|
|
61
|
+
--name SceneManifestSchema
|
|
62
|
+
|
|
63
|
+
# 3. Générer Pydantic Python
|
|
64
|
+
datamodel-codegen \
|
|
65
|
+
--input schemas/scene_manifest.schema.json \
|
|
66
|
+
--input-file-type jsonschema \
|
|
67
|
+
--output schemas/scene_manifest.pydantic.py \
|
|
68
|
+
--output-model-type pydantic_v2.BaseModel \
|
|
69
|
+
--field-constraints \
|
|
70
|
+
--use-double-quotes \
|
|
71
|
+
--use-title-as-name \
|
|
72
|
+
--strict-nullable
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Tests de round-trip
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Valide les 8 exemples canoniques contre les 3 dialectes
|
|
79
|
+
pnpm run test:schemas
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Détail des vérifications :
|
|
83
|
+
1. Chaque `examples/*.json` valide contre `scene_manifest.schema.json` via AJV
|
|
84
|
+
2. Chaque `examples/*.json` parse successfully en Zod via `SceneManifestSchema.parse(json)`
|
|
85
|
+
3. Chaque `examples/*.json` valide en Pydantic via `SceneManifest.model_validate(json)`
|
|
86
|
+
4. Round-trip `dict → Pydantic → dict` identique
|
|
87
|
+
5. Round-trip `json → Zod → json` identique
|
|
88
|
+
|
|
89
|
+
## État actuel (2026-07-10)
|
|
90
|
+
|
|
91
|
+
- ✅ `scene_manifest.schema.json` (canonique) — 905 lignes, JSON valide
|
|
92
|
+
- ⏳ `scene_manifest.zod.ts` — à générer (Chantier 1c continuation)
|
|
93
|
+
- ⏳ `scene_manifest.pydantic.py` — à générer (Chantier 1c continuation)
|
|
94
|
+
- ⏳ 8 exemples canoniques — à rédiger (Chantier 1d)
|
|
95
|
+
- ⏳ CI workflow `.github/workflows/geo-components-ci.yml` — à créer (Chantier 5)
|
|
96
|
+
|
|
97
|
+
## Convention de versioning
|
|
98
|
+
|
|
99
|
+
- Le fichier `scene_manifest.schema.json` porte le champ `$id` avec version :
|
|
100
|
+
`https://nic01asfr.github.io/Passerelle/schemas/scene_manifest/0.3.1.json`
|
|
101
|
+
- Toute modification du JSON Schema **DOIT** :
|
|
102
|
+
- Bumper le patch (`0.3.1 → 0.3.2`) si extension non-breaking
|
|
103
|
+
- Bumper le minor (`0.3.x → 0.4.0`) si breaking-safe (nouveaux champs ajoutés à des unions ouvertes)
|
|
104
|
+
- Bumper le major (`0.x.y → 1.0.0`) si breaking-hard (renommages, suppressions)
|
|
105
|
+
- Compatibilité descendante 2 versions mineures : `0.3.x` accepte tout `0.3.y` avec `y ≤ x`
|
|
106
|
+
- Une PR modifiant le JSON Schema **DOIT** re-générer les 2 autres dialectes dans le même commit (via CI hook pré-merge)
|
|
107
|
+
|
|
108
|
+
## Hébergement public du schema
|
|
109
|
+
|
|
110
|
+
Le fichier `scene_manifest.schema.json` sera publié sur GitHub Pages via `https://nic01asfr.github.io/Passerelle/schemas/scene_manifest/0.3.1.json` pour que :
|
|
111
|
+
|
|
112
|
+
- L'attribut `$schema` des manifests V0.3.1 pointe vers une URL résolvable
|
|
113
|
+
- Les éditeurs JSON (VS Code, IntelliJ) autocomplètent depuis le schema publié
|
|
114
|
+
- Les consommateurs externes (partenaires, agents LLM tiers) peuvent le référencer sans dépendre du repo Passerelle
|
|
115
|
+
|
|
116
|
+
Pipeline GitHub Pages : à mettre en place au commit npm publish 0.2.0 (Chantier 6).
|
|
117
|
+
|
|
118
|
+
## Références
|
|
119
|
+
|
|
120
|
+
- [CONTRACT-V0.3.1.md](../CONTRACT-V0.3.1.md) — spec humaine complète
|
|
121
|
+
- [SPRINT-V0.2-STATUS.md](../SPRINT-V0.2-STATUS.md) — tracker Sprint V0.2 convergence
|
|
122
|
+
- [MIGRATION.md](../MIGRATION.md) — état d'adoption cross-projet
|
|
123
|
+
- JSON Schema 2020-12 spec : https://json-schema.org/draft/2020-12/schema
|
|
124
|
+
- datamodel-code-generator : https://github.com/koxudaxi/datamodel-code-generator
|
|
125
|
+
- json-schema-to-zod : https://github.com/StefanTerdell/json-schema-to-zod
|