The Package Format
Section titled “The Package Format”Packaging & Distribution documents the workflow — export jobs, import sessions, mappings, execution. This page documents the artifact those workflows produce and consume: exactly which files a package ZIP contains, what every manifest field means, and what the import boundary accepts or rejects. It exists for the reader who wants to inspect, transform, or generate a package rather than click through the export screen. Two companion pages carry the detail this one deliberately hands off: the payload shape inside each resource file is specified in Package Resource Schemas, and the supported ways to produce a package are compared in Generating a Package. The packaging engine this contract belongs to shipped in the 1.8 line (Since 1.8); on an older deployment these endpoints and the export UI are absent.
One thing is worth stating before any detail, because it is the question that usually brings a reader here: a OSOS package is not a single JSON file. It is a multi-file ZIP whose parts must agree with one another — the index must name every resource file, the dependency edges must point at real paths inside the payloads, and the manifest must describe both.
Archive layout
Section titled “Archive layout”The archive is built and parsed by the packaging service’s ZIP utilities. Fourteen kinds of top-level entry may appear — four of them Since 1.10; anything else fails validation (see the strict validator below):
manifest.json requiredindex.json requireddependencies.json written by every export; required at importconfig.json echo of the export requestentry-references.json optionalstore-references.json optionalfile-references.json optionalfield-mapping-hints.json optional, schema 1.2 and laterhashes.json published versions only, schema 1.3 and laterpackage-references.json published versions only, schema 1.3 and laterREADME.md optional, schema 1.4readme/{image} optional, schema 1.4files/{fileId}.bin one per file referenceresources/{Type}/{normalizedName}.json| Entry | Presence | Contents |
|---|---|---|
manifest.json | required | Package metadata — see below. |
index.json | required | The ordered resource list and the id-to-filename map — see below. |
dependencies.json | required at import | The serialized dependency edges — see below. Its absence fails extraction with Invalid package: missing dependencies.json. |
config.json | written by every export | An echo of the original export request: resources, plus excludes, excludeTypes, name and description when they were set. Informational — import does not act on it. |
entry-references.json | optional | PackageEntryReference[] — value-level entry references (specific users, groups, collection items) with the packaged entryData that makes auto-creation possible in the target. |
store-references.json | optional | PackageStoreReference[] — snapshots of shared (cross-space) stores referenced by exported entities. |
file-references.json | optional | PackageFileReference[] — {fileId, fileName, mimeType, size} metadata for template/binary attachments. |
field-mapping-hints.json Since 1.10 | optional | The mapped-field sidecar — the only structural addition in schema 1.2. Written only when non-empty, and its presence is what makes the package declare 1.2. See the sidecar’s own section. |
hashes.json Since 1.10 | published versions | Canonical content hashes per resource and the package’s rootHash. See published-version files. |
package-references.json Since 1.10 | published versions | Every reference from this package into another package. See published-version files. |
README.md, readme/{image} Since 1.10 | optional | The package README and the images it links to — the addition of schema 1.4. See published-version files. |
files/{fileId}.bin | one per file reference | The binary payload itself. Extraction fails with missing binary for file reference if a listed reference has no matching .bin entry. |
resources/{Type}/{normalizedName}.json | the payload | One JSON snapshot per exported resource, grouped in one directory per type. |
One more name, unmapped-dependencies.json, sits on the validator’s allow-list but is not written by the current exporter — treat it as reserved.
Every JSON member is written minified (JSON.stringify with no spacing). The importer requires only valid JSON, not any particular formatting, so a transformed package may be pretty-printed freely.
manifest.json
Section titled “manifest.json”The manifest is the first file read at import. Its authoritative definition is the shared PackageManifest contract; the export side writes it with buildPackageManifest.
| Field | Required | Meaning |
|---|---|---|
schemaVersion | yes | Package format version. The writer stamps the lowest version that describes the package (pickSchemaVersion): 1.4 when the package carries a README, else 1.3 when it carries a package block, else 1.2 when field-mapping-hints.json is present, else 1.1 — the three newer values are all Since 1.10. A 1.10+ importer accepts 1.0 to 1.4; a pre-1.10 one accepts only 1.0 and 1.1 (SUPPORTED_SCHEMA_VERSIONS). Anything else is a blocking INCOMPATIBLE_SCHEMA validation error. The compatibility rules have their own page. |
createdAt | yes | ISO 8601 export timestamp. Informational only. |
resourceCount | yes | The number of resources actually packaged — the length of index.json’s orderedResources, after export-side filtering. |
resourceTypes | yes | The distinct resource types that have at least one file under resources/. Only exportable types ever appear here. |
sourceEnvironment | no | Legacy free-text environment name (the deployment’s NAMESPACE). Superseded by sourceEnvironmentId but still written. |
sourceEnvironmentId | no | Stable source-environment id, from the ENVIRONMENT_ID platform config. Omitted when that config is unset. |
sourceSpaceId | no | The space the package was exported from. |
sourceVersion | no | Application version at export time. Informational — compared only to warn (NEWER_SOURCE_VERSION), never to block. |
description | no | Free text supplied at export. |
package Since 1.10 | no | The published-version identity block — present only in a published package version, and what turns an import into an install. See published-version files. |
origin Since 1.10 | no | Where the file came from: exportId, name, environment {id, name}, space {id, name}, exportedAt, exportedBy {id, name}. Its members are nullable only on files exported before origins existed. The importer records it per resource, which is how the target can say where a resource came from. |
readme Since 1.10 | no | {path: 'README.md', images[]} — the README’s location and its listed images (schema 1.4). |
contents Since 1.10 | no | A summary for display: per-type counts, modules[] with their entities and field counts, an optional other bucket, pages[] (the package’s global pages, {id?, name}), and truncated when the 100-module / 500-entity / 100-page cap is hit. Each module, entity (with its moduleId) and page also records its source-environment id, so a reviewer can be linked to the originals; versions built before the ids were recorded carry names only. |
sourceEnvironmentId and sourceSpaceId matter more than they look: together with the target space they form the key of a persisted mapping profile, the mechanism that lets a repeat import from the same source pre-apply previously confirmed principal mappings. A hand-built manifest that omits them still imports, but no stored profile can ever match it — every user, group, and org-unit mapping starts from scratch on every import.
The strict validator type-checks only the four required fields; the optional fields are read where they are used.
index.json
Section titled “index.json”PackageIndex has three members:
| Member | Type | Meaning |
|---|---|---|
orderedResources | ResourceRef[] | Every packaged resource as {type, id, …}, topologically sorted — parents before children. |
nameMap | Record<id, filename> | Resource id → the base name of its file under resources/{Type}/. This is the authoritative filename key. |
displayNameMap | Record<id, localized name> | Resource id → {en, ar} display name, for the import wizard. Optional. |
nameMap is authoritative for a reason a producer must respect: when two resources of the same type slugify to the same normalizedName, the exporter suffixes the second file name with the resource id (projects → projects_<id>). The resource’s own normalizedName field is therefore only the raw slug, shared by every same-named sibling. The importer (resolvePackagedResource) resolves files through nameMap first and id-verifies any hit reached through a raw slug, precisely so that a name collision cannot silently return a same-named-but-different resource. A generator that derives filenames from anything other than its own nameMap recreates the bug that logic exists to prevent.
dependencies.json
Section titled “dependencies.json”A serialized DependencyEdge[] — the outbound dependency closure of the exported selection, fetched from the dependency graph at export time. The shape:
| Field | Meaning |
|---|---|
from, to | ResourceRefs — the depending resource and its dependency. |
path | The JSON path inside the from resource’s snapshot where the reference lives. This is what tells the importer where to rewrite an id. |
resolvedVia | How the reference was found: DIRECT_ID, NORMALIZED_NAME, REFERENCE_PROPERTY, or PIPELINE_STAGE. |
hard | Whether the dependency is structural. Hard edges gate import ordering and cascade-skips; soft edges may be nulled when unresolvable. |
kind | MEMBERSHIP (child belongs to parent) or REFERENCE (cross-reference) — the only two values of the DependencyKind enum. |
fromActive, fromArchived, metadata | Status flags and extra context. |
The edges do double duty: they drive id remapping (via path) and the topological sort that orders the import. A producer that adds resources without matching edges gets them imported in arbitrary order with no reference rewriting — the resource lands, but everything it points at still carries source-environment ids. Edge semantics, the graph API, and how edges are extracted are covered in The Dependency Graph.
field-mapping-hints.json Since 1.10
Section titled “field-mapping-hints.json Since 1.10”This sidecar is the entire structural difference between schema 1.1 and schema 1.2. No resource JSON gained a property, no manifest field was added or removed, and no existing entry changed shape: 1.2 adds one optional top-level entry and nothing else.
A mapped field is a DataEntityField carrying mapping.enabled — a field that mirrors a value from a parent entity. Its mapping block holds two field UUIDs: referenceFieldId, a field on this entity that points at the parent, and sourceFieldId, a field on the parent entity whose value is mirrored (plus an updateMode: Local 0, Never 1, ParentOnly 2, TwoWay 3).
referenceFieldId survives an import for free, because it is intra-entity and data-service reconciles fields by the payload’s own id. sourceFieldId does not. The parent entity is usually mapped onto a pre-existing target entity rather than freshly written, so it keeps the target environment’s own field UUIDs and the packaged sourceFieldId matches nothing there. The join key that does survive the environment boundary is the field’s fullNormalizedName — <normalizedName> for a top-level field, <block>.<field> for a field on a block’s internal entity.
Before 1.2 nothing carried that name across the boundary, so a mapping whose parent snapshot was absent from the package was dropped silently while the import reported success. The sidecar closes that gap. It maps `${entityId}:${fieldId}` — source-environment ids — to:
interface FieldMappingHint { sourceEntityId: string; // source-env id of the mapped field's PARENT entity sourceFieldFullNormalizedName: string; // flattened name of the source field on that parent}Two rules govern the entry as an archive member. It is written only when non-empty, which is what keeps a package with no mapped fields at schema 1.1 and therefore importable into an environment that has not been upgraded. And it is read optionally: its absence is not an error at any supported version, because the resolver falls back to the parent entity’s own in-package snapshot — the path a 1.0 or 1.1 package has always taken.
The hints are regenerated on every export rather than persisted on the entity, deliberately, so they cannot drift when a field is renamed. When a source field still cannot be found in the target, the installer is asked what the field copies from — a decision the run will not start without — as documented with the import API.
Published-version files Since 1.10
Section titled “Published-version files Since 1.10”A package version published from the Packages area — see Packages, Marketplace & the In-App Store — is the same ZIP with four additions. A plain export carries none of them.
manifest.package (ManifestPackageInfo):
| Member | Meaning |
|---|---|
id | The permanent package id, pkg_ + a 26-character ULID. |
version | Strict semver. |
displayName, description? | Localized. |
releaseNotes | Localized; required. |
minPlatformVersion | The lowest platform version that may install it. |
builtOn? | The authoring environment’s platform version. |
license | Always 'free'. |
rootHash | The package’s canonical hash (from hashes.json). |
dependencies[] | {packageId, range, displayName?} — other packages this one needs, as semver ranges. |
externalDependencies[] | {type, sourceId, name, requiredBy[]} — things outside any package that it references. Since 1.10 each item also explains itself: displayName?, usedBy[] ({resourceId, resourceType, resourceName?, fieldName?, fieldLabel?, kind, copiedField?}, with kind one of reference, copiesField or other) and requiredFields[] ({name, label?, dataType?}, the fields the target entity must offer for the package’s copies to work). Since dev it may also list a soft target that a page widget shows (a view of an entity the package leaves out): such an item is mappable at install but is not a package dependency, and the installer sees it as an optional row (hard: false) — see Page widgets pointing outside the package. |
On import, a package block selects install mode, which requires every member except description and builtOn to be well formed (INSTALL_MANIFEST_INVALID otherwise). A package.id that is not a valid pkg_ id — a file published before package ids existed — is refused with 422 PACKAGE_FORMAT_OUTDATED.
hashes.json — the algorithm, the rootHash, an optional readme hash (included in rootHash when set) and, per resource key, its type, name, hash, optional per-element hashes and, Since 1.10, an optional parentKey — the resource key of the packaged resource it belongs to (a view’s entity, an entity’s module), recorded outside the hash so adding it changed no rootHash, and absent from versions published before parents were recorded. The algorithm is sha256/osos-canonical-v1, -v2 or -v3: new versions are written as v3, and a reader must accept all three. v2 leaves out the keys a client may change on an installed resource (see Package Resource Schemas); v3 additionally hashes a referenced record that the import matches by identity — a user, group, domain or space — by that identity alone, so a profile edit of a referenced user is not a change to the package. Since dev a Function’s hash covers its secret names only, under the same algorithm version (see Function secrets). Each resource is hashed as canonical JSON with server-managed and environment-specific keys left out and ids replaced by package-relative keys, so the same content hashes identically in any environment. That is what lets an installation report whether an installed resource has changed.
package-references.json — every reference from this package into another package: resourceKey, path, packageId, targetResourceKey. A reference that does not resolve in the installing space is INSTALL_REFERENCE_UNRESOLVED.
README.md and readme/ — the README’s Markdown and the images it may link to, listed in manifest.readme. Only a published version is written with a README; a plain export takes none, though the importer still reads and keeps one it finds. They are validated on import against these limits:
| Limit | Value |
|---|---|
| Markdown | 256 KiB |
| Each image | 2 MiB; PNG, JPEG, WebP or GIF |
| Images | at most 50, 20 MiB in total |
A README that is missing, has the wrong path or type, exceeds a limit, or does not match its hash is reported as a README problem. All four additions are on the strict validator’s allow-list; a pre-1.10 service turns a package declaring 1.3 or 1.4 away with INCOMPATIBLE_SCHEMA before it ever reaches them.
The resource files
Section titled “The resource files”Each packaged resource is one JSON file at resources/{Type}/{name}.json, where {name} comes from nameMap. The per-type payload schemas are the subject of Package Resource Schemas; what belongs here is what is true of the files as archive members:
- Server-managed keys are absent. Export deletes
_id,_resolved,createdAt,updatedAt,createdBy,updatedBy,creationInfo,updateInfo,stateHistory,updateIdentifier,spaceId,space,version, and__vfrom every snapshot (SERVER_MANAGED_KEYS), and the import parsers strip them again defensively before writing. Do not emit them; do not expect them. idsurvives. It is the source-environment UUID, kept so the importer can id-verify filename lookups and key the remap table.executionPlanis stripped fromDataViewandGenericViewsnapshots — it is server-derived and regenerated in the target.- Entity-backed
DataCollectionsnapshots carryitems: []— their items are entry UUIDs that do not travel in the package. ADT (primitive-typed) collections keep their embedded scalar items. - A
Functioncarries secret names, never valuesSince dev. Itsvalue.secrets[]rows keep theirkeyand any other field, but everyvalueisnull; theOSOS_API_TOKENrow and theidentityreference are removed. See Function secrets stay in their environment.
Seventeen exportable types — and the eighteenth
Section titled “Seventeen exportable types — and the eighteenth”EXPORTABLE_TYPES is the complete list of types that may appear under resources/ — seventeen of them:
DataEntity, DataView, DataQuery, DataRelation, DataCollection, DataReaction, GenericView, DataModule, SystemButton, StatisticQuery, Report, Function, CounterWidget, Announcement, DataEntityAggregate, QuickFilterGroup, TagGroup.
The last three are new — Since 1.10. QuickFilterGroup and TagGroup are the groups an entity’s quick filters and tags are organised into; they travel as entity children, and their payload shapes are not specified here (export one and read it). DataEntityAggregate, the third, is the resource behind the entity’s Aggregator list, it travels as an entity child under resources/DataEntityAggregate/, and its payload shape is documented with the resource schemas. A package produced before it existed simply has no such directory.
The ResourceType enum those values come from has eighteen members. The extra one is Dashboard, and the mismatch is deliberate — the two lists answer different questions:
ResourceTypeis the dependency graph’s node vocabulary; its doc comment reads “Resource types tracked by the dependency graph.”EXPORTABLE_TYPESis the packaging subset of that vocabulary.
A dashboard is an entry-based resource: dependency-service maps it from the DASHBOARD core entity, i.e. a dashboard is a data entry of a system entity, not a standalone resource document. It participates in the graph — packaging even walks Dashboard.widgets[*] paths when remapping relation composites — but it is never written to resources/. If a dashboard travels at all, it travels as an entry reference.
Identity types are excluded for a different reason: the USER, GROUP, ORGUNIT, and WORKING_HOURS core entities (CORE_ENTITY_IDS) exist independently in every environment, so references to their entries are carried in entry-references.json and remapped at import rather than packaged as resources.
Which instances of the seventeen types are dropped even when selected — archived entities and their subtrees, user-scoped resources, implicit resources — is export-pipeline behaviour and is documented with the export workflow.
Safety limits at import
Section titled “Safety limits at import”extractPackageZip enforces hard limits before reading any content, in this order:
| Guard | Value | On violation |
|---|---|---|
| Maximum ZIP entries | 10 000 (MAX_ZIP_ENTRIES) | Extraction fails. |
Path traversal — .. anywhere, a leading /, or any backslash in an entry name | — (isSafeEntryName) | Extraction fails. |
| Maximum decompressed size, summed across entries | 200 MB (MAX_DECOMPRESSED_SIZE) | Extraction fails. |
Path components under resources/ | must match ^[a-zA-Z0-9_.-]+$ (SAFE_PATH_COMPONENT) | The entry is silently skipped, not rejected. |
resources/ entries not exactly three path segments deep | — | Silently skipped. |
The last two rows deserve emphasis, because they behave differently from the rest. A resource file whose type directory or file name contains a space, a colon, or a non-Latin character does not fail the upload — it is quietly ignored during extraction, and the failure surfaces later and less legibly, as a resource the import cannot find (and a cascade-skip of everything that hard-depends on it). This is the most common failure mode for a generator that derives filenames from human-visible names instead of from nameMap, which only ever contains safe slugs.
The strict validator
Section titled “The strict validator”After the limits pass, validatePackageStrict runs at the extraction boundary so everything downstream can assume a well-formed archive. It checks three things — required entries, manifest shape, and the top-level allow-list — and reports failures as a typed PackageFormatError whose detail.category is one of four values:
| Category | Raised when |
|---|---|
MISSING_ENTRY | manifest.json or index.json is absent. |
INVALID_JSON | manifest.json exists but does not parse as JSON. |
SCHEMA_VIOLATION | The manifest parses but fails a shape check: it is not an object, schemaVersion or createdAt is not a string, resourceCount is not a number, or resourceTypes is not an array. The failing path is reported in detail.schemaPath. |
UNKNOWN_ENTRY | Any top-level entry outside the allow-list — the eleven named JSON files, README.md, and the resources/, files/ and readme/ prefixes. A stray file in the archive root is treated as tampering or format drift and fails fast. This is also what a pre-1.2 service would say about field-mapping-hints.json, which is exactly why a package carrying the sidecar declares 1.2 and is turned away with the more legible INCOMPATIBLE_SCHEMA instead. |
The error carries detail.entryName / detail.schemaPath so a producer can handle failures programmatically instead of pattern-matching messages. Expect to meet all four categories while iterating on a generator — that is what they are for.
Note the asymmetry: dependencies.json is not on the required list of the strict validator, but extraction still fails without it, with a plain (untyped) error. In practice all three root JSON files are mandatory.
Producing or transforming a package
Section titled “Producing or transforming a package”Three production paths exist, compared honestly — including what each costs — in Generating a Package. The short version: start from a real export whenever possible, because it is the only path that begins from an artifact guaranteed to satisfy everything on this page.
For per-environment parameterisation, you usually do not need to touch the ZIP at all. Within an import session, the payload-override endpoints (GET / PATCH / DELETE on /v1/import/{sessionId}/resource/{sourceType}/{sourceId}/payload) substitute a single resource’s payload at execution time — the archive stays untouched, and the wire shapes (GetResourcePayloadResponse, SaveResourcePayloadRequest) are part of the shared packaging contracts. The session workflow around them is documented in The Import API.
Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27