@prisma-next-idb/family-idb 0.1.0

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 (33) hide show
  1. package/LICENSE +21 -0
  2. package/dist/bin/prisma-next-idb.d.mts +1 -0
  3. package/dist/bin/prisma-next-idb.mjs +281 -0
  4. package/dist/bin/prisma-next-idb.mjs.map +1 -0
  5. package/dist/exports/config-types.d.mts +39 -0
  6. package/dist/exports/config-types.d.mts.map +1 -0
  7. package/dist/exports/config-types.mjs +66 -0
  8. package/dist/exports/config-types.mjs.map +1 -0
  9. package/dist/exports/contract-psl.d.mts +48 -0
  10. package/dist/exports/contract-psl.d.mts.map +1 -0
  11. package/dist/exports/contract-psl.mjs +463 -0
  12. package/dist/exports/contract-psl.mjs.map +1 -0
  13. package/dist/exports/contract-ts.d.mts +73 -0
  14. package/dist/exports/contract-ts.d.mts.map +1 -0
  15. package/dist/exports/contract-ts.mjs +162 -0
  16. package/dist/exports/contract-ts.mjs.map +1 -0
  17. package/dist/exports/control.d.mts +79 -0
  18. package/dist/exports/control.d.mts.map +1 -0
  19. package/dist/exports/control.mjs +566 -0
  20. package/dist/exports/control.mjs.map +1 -0
  21. package/dist/exports/pack.d.mts +10 -0
  22. package/dist/exports/pack.d.mts.map +1 -0
  23. package/dist/exports/pack.mjs +11 -0
  24. package/dist/exports/pack.mjs.map +1 -0
  25. package/dist/generate-baseline-Dg3vfBpB.mjs +130 -0
  26. package/dist/generate-baseline-Dg3vfBpB.mjs.map +1 -0
  27. package/dist/generate-migration-D8bDx9jo.mjs +150 -0
  28. package/dist/generate-migration-D8bDx9jo.mjs.map +1 -0
  29. package/dist/preflight-D8GLQXy3.mjs +112 -0
  30. package/dist/preflight-D8GLQXy3.mjs.map +1 -0
  31. package/dist/validate-DL9NthnR.mjs +48 -0
  32. package/dist/validate-DL9NthnR.mjs.map +1 -0
  33. package/package.json +63 -0
@@ -0,0 +1,162 @@
1
+ import { t as validateContract } from "../validate-DL9NthnR.mjs";
2
+ import { UNBOUND_DOMAIN_NAMESPACE_ID, crossRef } from "@prisma-next/contract/types";
3
+ import { computeProfileHash, computeStorageHash } from "@prisma-next/contract/hashing";
4
+ //#region src/core/contract-builder.ts
5
+ const SCALAR_TO_CODEC_ID = {
6
+ String: "idb/string@1",
7
+ Int: "idb/int32@1",
8
+ Float: "idb/double@1",
9
+ Boolean: "idb/bool@1",
10
+ DateTime: "idb/date@1",
11
+ BigInt: "idb/bigint@1",
12
+ Decimal: "idb/decimal@1",
13
+ Json: "idb/json@1",
14
+ Bytes: "idb/bytes@1"
15
+ };
16
+ function buildFields(fields) {
17
+ const result = {};
18
+ for (const [name, spec] of Object.entries(fields)) {
19
+ const nullable = spec.endsWith("?");
20
+ const typeName = nullable ? spec.slice(0, -1) : spec;
21
+ const codecId = SCALAR_TO_CODEC_ID[typeName];
22
+ if (codecId === void 0) throw new Error(`Unknown field type "${typeName}" for field "${name}"`);
23
+ result[name] = {
24
+ nullable,
25
+ type: {
26
+ kind: "scalar",
27
+ codecId
28
+ }
29
+ };
30
+ }
31
+ return result;
32
+ }
33
+ function buildRoots(models) {
34
+ const roots = {};
35
+ for (const modelName of Object.keys(models)) {
36
+ const def = models[modelName];
37
+ roots[def.store] = crossRef(modelName);
38
+ }
39
+ return roots;
40
+ }
41
+ function buildStores(models) {
42
+ const stores = {};
43
+ for (const def of Object.values(models)) {
44
+ const indexes = {};
45
+ for (const [indexName, idx] of Object.entries(def.indexes ?? {})) indexes[indexName] = {
46
+ keyPath: idx.keyPath,
47
+ unique: idx.unique ?? false,
48
+ ...idx.multiEntry !== void 0 ? { multiEntry: idx.multiEntry } : {}
49
+ };
50
+ stores[def.store] = {
51
+ keyPath: def.key,
52
+ ...Object.keys(indexes).length > 0 ? { indexes } : {}
53
+ };
54
+ }
55
+ return stores;
56
+ }
57
+ function buildModels(models) {
58
+ const result = {};
59
+ for (const [modelName, def] of Object.entries(models)) {
60
+ const relations = {};
61
+ const relationsStorage = {};
62
+ for (const [relName, rel] of Object.entries(def.relations ?? {})) {
63
+ relations[relName] = {
64
+ to: crossRef(rel.to),
65
+ cardinality: rel.cardinality,
66
+ on: {
67
+ localFields: rel.on.local,
68
+ targetFields: rel.on.target
69
+ }
70
+ };
71
+ if (rel.onDelete !== void 0) relationsStorage[relName] = { onDelete: rel.onDelete };
72
+ }
73
+ const storage = Object.keys(relationsStorage).length > 0 ? {
74
+ storeName: def.store,
75
+ keyPath: def.key,
76
+ relations: relationsStorage
77
+ } : {
78
+ storeName: def.store,
79
+ keyPath: def.key
80
+ };
81
+ result[modelName] = {
82
+ fields: buildFields(def.fields),
83
+ relations,
84
+ storage
85
+ };
86
+ }
87
+ return result;
88
+ }
89
+ /**
90
+ * Builds a typed IDB contract from a developer-friendly model definition.
91
+ *
92
+ * This is the TypeScript-first (no-emit) authoring path per ADR 006. The
93
+ * returned contract object can be passed directly to `createIdbClient()` or
94
+ * to `typescriptContract()` for config-file usage.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * import { defineContract } from '@prisma-next-idb/family-idb/contract-ts';
99
+ * import idbFamily from '@prisma-next-idb/family-idb/pack';
100
+ * import idbTarget from '@prisma-next-idb/target-idb/pack';
101
+ *
102
+ * export default defineContract({
103
+ * family: idbFamily,
104
+ * target: idbTarget,
105
+ * models: {
106
+ * User: {
107
+ * store: 'users',
108
+ * key: 'id',
109
+ * fields: { id: 'String', name: 'String?', email: 'String' },
110
+ * indexes: { byEmail: { keyPath: 'email', unique: true } },
111
+ * },
112
+ * },
113
+ * });
114
+ * ```
115
+ */
116
+ function defineContract(input) {
117
+ const stores = buildStores(input.models);
118
+ const capabilities = { idb: {
119
+ ddlOnlyInUpgrade: true,
120
+ transactionalDDL: true
121
+ } };
122
+ const ns = UNBOUND_DOMAIN_NAMESPACE_ID;
123
+ const storageBlock = {
124
+ stores,
125
+ namespaces: { [ns]: {
126
+ id: ns,
127
+ entries: {}
128
+ } }
129
+ };
130
+ const storageHash = computeStorageHash({
131
+ target: "idb",
132
+ targetFamily: "idb",
133
+ storage: storageBlock
134
+ });
135
+ const profileHash = computeProfileHash({
136
+ target: "idb",
137
+ targetFamily: "idb",
138
+ capabilities
139
+ });
140
+ const storage = {
141
+ ...storageBlock,
142
+ storageHash
143
+ };
144
+ const domain = { namespaces: { [ns]: { models: buildModels(input.models) } } };
145
+ const contract = {
146
+ target: "idb",
147
+ targetFamily: "idb",
148
+ roots: buildRoots(input.models),
149
+ domain,
150
+ storage,
151
+ capabilities,
152
+ extensionPacks: {},
153
+ meta: {},
154
+ profileHash
155
+ };
156
+ validateContract(contract);
157
+ return contract;
158
+ }
159
+ //#endregion
160
+ export { defineContract };
161
+
162
+ //# sourceMappingURL=contract-ts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-ts.mjs","names":[],"sources":["../../src/core/contract-builder.ts"],"sourcesContent":["import { computeProfileHash, computeStorageHash } from \"@prisma-next/contract/hashing\";\nimport type { ApplicationDomain, Contract, ContractField, CrossReference } from \"@prisma-next/contract/types\";\nimport { UNBOUND_DOMAIN_NAMESPACE_ID, crossRef } from \"@prisma-next/contract/types\";\nimport type {\n IdbIndexDefinition,\n IdbModelStorage,\n IdbReferentialAction,\n IdbStorage,\n IdbStoreDefinition,\n} from \"@prisma-next-idb/target-idb/pack\";\nimport { validateContract } from \"./validate\";\n\n// ── Field type system ─────────────────────────────────────────────────────────\n\ntype PrismaScalarType = \"String\" | \"Int\" | \"Float\" | \"Boolean\" | \"DateTime\" | \"BigInt\" | \"Decimal\" | \"Json\" | \"Bytes\";\n\n/**\n * A field spec string: the Prisma scalar type name, optionally suffixed with\n * `?` to indicate the field is nullable (e.g. `\"String\"`, `\"Int?\"`, `\"DateTime?\"`).\n */\nexport type FieldSpec = PrismaScalarType | `${PrismaScalarType}?`;\n\nconst SCALAR_TO_CODEC_ID: Record<PrismaScalarType, string> = {\n String: \"idb/string@1\",\n Int: \"idb/int32@1\",\n Float: \"idb/double@1\",\n Boolean: \"idb/bool@1\",\n DateTime: \"idb/date@1\",\n BigInt: \"idb/bigint@1\",\n Decimal: \"idb/decimal@1\",\n Json: \"idb/json@1\",\n Bytes: \"idb/bytes@1\",\n};\n\n// ── Input types ───────────────────────────────────────────────────────────────\n\nexport type RelationDef = {\n readonly to: string;\n readonly cardinality: \"1:1\" | \"1:N\" | \"N:1\";\n readonly on: {\n readonly local: readonly string[];\n readonly target: readonly string[];\n };\n readonly onDelete?: IdbReferentialAction;\n};\n\nexport type IndexDef = {\n readonly keyPath: string;\n readonly unique?: boolean;\n readonly multiEntry?: boolean;\n};\n\nexport type ModelDef = {\n readonly store: string;\n readonly key: string;\n /** All scalar fields on the model. Use `\"Type\"` for non-nullable, `\"Type?\"` for nullable. */\n readonly fields: Record<string, FieldSpec>;\n readonly indexes?: Record<string, IndexDef>;\n readonly relations?: Record<string, RelationDef>;\n};\n\nexport type DefineContractInput = {\n /** Pass the default export of `@prisma-next-idb/family-idb/pack`. */\n readonly family: { readonly familyId: \"idb\"; readonly id: string };\n /** Pass the default export of `@prisma-next-idb/target-idb/pack`. */\n readonly target: { readonly targetId: string; readonly id: string };\n readonly models: Record<string, ModelDef>;\n};\n\n// ── Helper: build ContractField entries from field specs ──────────────────────\n\nfunction buildFields(fields: Record<string, FieldSpec>): Record<string, ContractField> {\n const result: Record<string, ContractField> = {};\n for (const [name, spec] of Object.entries(fields)) {\n const nullable = spec.endsWith(\"?\");\n const typeName = (nullable ? spec.slice(0, -1) : spec) as PrismaScalarType;\n const codecId = SCALAR_TO_CODEC_ID[typeName];\n if (codecId === undefined) {\n throw new Error(`Unknown field type \"${typeName}\" for field \"${name}\"`);\n }\n result[name] = { nullable, type: { kind: \"scalar\" as const, codecId } };\n }\n return result;\n}\n\n// ── Helper: derive the `roots` map (storeName → model CrossReference) ─────────\n\nfunction buildRoots(models: Record<string, ModelDef>): Record<string, CrossReference> {\n const roots: Record<string, CrossReference> = {};\n for (const modelName of Object.keys(models)) {\n const def = models[modelName]!;\n // v0.12.0: roots values are CrossReference `{ namespace, model }`, not bare\n // model-name strings. IDB has a single (unbound) namespace.\n roots[def.store] = crossRef(modelName);\n }\n return roots;\n}\n\n// ── Helper: derive storage.stores from model definitions ─────────────────────\n\nfunction buildStores(models: Record<string, ModelDef>): Record<string, IdbStoreDefinition> {\n const stores: Record<string, IdbStoreDefinition> = {};\n for (const def of Object.values(models)) {\n const indexes: Record<string, IdbIndexDefinition> = {};\n for (const [indexName, idx] of Object.entries(def.indexes ?? {})) {\n indexes[indexName] = {\n keyPath: idx.keyPath,\n unique: idx.unique ?? false,\n ...(idx.multiEntry !== undefined ? { multiEntry: idx.multiEntry } : {}),\n };\n }\n stores[def.store] = {\n keyPath: def.key,\n ...(Object.keys(indexes).length > 0 ? { indexes } : {}),\n };\n }\n return stores;\n}\n\n// ── Helper: build the models section ─────────────────────────────────────────\n\ntype ContractModelEntry = {\n readonly fields: Record<string, ContractField>;\n readonly relations: Record<\n string,\n {\n readonly to: CrossReference;\n readonly cardinality: \"1:1\" | \"1:N\" | \"N:1\";\n readonly on: { readonly localFields: readonly string[]; readonly targetFields: readonly string[] };\n }\n >;\n readonly storage: IdbModelStorage;\n};\n\nfunction buildModels(models: Record<string, ModelDef>): Record<string, ContractModelEntry> {\n const result: Record<string, ContractModelEntry> = {};\n for (const [modelName, def] of Object.entries(models)) {\n const relations: ContractModelEntry[\"relations\"] = {};\n const relationsStorage: Record<string, { onDelete: IdbReferentialAction }> = {};\n for (const [relName, rel] of Object.entries(def.relations ?? {})) {\n relations[relName] = {\n // v0.12.0: relation `to` is a CrossReference, not a bare model-name string.\n to: crossRef(rel.to),\n cardinality: rel.cardinality,\n on: { localFields: rel.on.local, targetFields: rel.on.target },\n };\n if (rel.onDelete !== undefined) {\n relationsStorage[relName] = { onDelete: rel.onDelete };\n }\n }\n const storage: IdbModelStorage =\n Object.keys(relationsStorage).length > 0\n ? { storeName: def.store, keyPath: def.key, relations: relationsStorage }\n : { storeName: def.store, keyPath: def.key };\n result[modelName] = { fields: buildFields(def.fields), relations, storage };\n }\n return result;\n}\n\n// ── defineContract ────────────────────────────────────────────────────────────\n\n/**\n * Builds a typed IDB contract from a developer-friendly model definition.\n *\n * This is the TypeScript-first (no-emit) authoring path per ADR 006. The\n * returned contract object can be passed directly to `createIdbClient()` or\n * to `typescriptContract()` for config-file usage.\n *\n * @example\n * ```ts\n * import { defineContract } from '@prisma-next-idb/family-idb/contract-ts';\n * import idbFamily from '@prisma-next-idb/family-idb/pack';\n * import idbTarget from '@prisma-next-idb/target-idb/pack';\n *\n * export default defineContract({\n * family: idbFamily,\n * target: idbTarget,\n * models: {\n * User: {\n * store: 'users',\n * key: 'id',\n * fields: { id: 'String', name: 'String?', email: 'String' },\n * indexes: { byEmail: { keyPath: 'email', unique: true } },\n * },\n * },\n * });\n * ```\n */\nexport function defineContract(input: DefineContractInput): Contract<IdbStorage> {\n const stores = buildStores(input.models);\n\n // Mirror the capability surface that `prisma-next contract emit` writes\n // into the JSON contract — keeps the two authoring paths byte-equivalent\n // for the capabilities block. See ARCHITECTURE.md § \"Key type: capabilities\".\n const capabilities = {\n idb: {\n ddlOnlyInUpgrade: true,\n transactionalDDL: true,\n },\n };\n\n // v0.12.0 (ADR 221): both planes are namespace-keyed. IDB has no namespace\n // concept, so everything lives under the single unbound namespace.\n const ns = UNBOUND_DOMAIN_NAMESPACE_ID;\n const storageBlock = {\n stores,\n namespaces: { [ns]: { id: ns, entries: {} } },\n };\n\n const storageHash = computeStorageHash({\n target: \"idb\",\n targetFamily: \"idb\",\n storage: storageBlock,\n });\n\n const profileHash = computeProfileHash({\n target: \"idb\",\n targetFamily: \"idb\",\n capabilities,\n });\n\n const storage: IdbStorage = { ...storageBlock, storageHash };\n\n // v0.12.0: models live under `domain.namespaces.<ns>.models`, not a top-level\n // `models` field.\n const domain = {\n namespaces: { [ns]: { models: buildModels(input.models) } },\n } as unknown as ApplicationDomain;\n\n const contract: Contract<IdbStorage> = {\n target: \"idb\",\n targetFamily: \"idb\",\n roots: buildRoots(input.models),\n domain,\n storage,\n capabilities,\n extensionPacks: {},\n meta: {},\n profileHash,\n };\n\n validateContract(contract);\n\n return contract;\n}\n"],"mappings":"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"}
@@ -0,0 +1,79 @@
1
+ import { ControlFamilyDescriptor, ControlFamilyInstance, ControlStack } from "@prisma-next/framework-components/control";
2
+ import { Contract } from "@prisma-next/contract/types";
3
+ import { IdbStorage } from "@prisma-next-idb/target-idb/pack";
4
+
5
+ //#region src/core/schema-ir.d.ts
6
+ /**
7
+ * IndexedDB schema IR — the in-memory representation of the object store
8
+ * structure used by introspect(), schemaVerify(), and the manifest format.
9
+ *
10
+ * Mirrors the contract types in `@prisma-next-idb/target-idb/pack` but
11
+ * is independent of any versioned contract hash so it can be used as a
12
+ * stable internal representation.
13
+ */
14
+ type IdbIndexIR = {
15
+ readonly keyPath: string;
16
+ readonly unique: boolean;
17
+ readonly multiEntry?: boolean;
18
+ };
19
+ type IdbStoreIR = {
20
+ readonly keyPath: string;
21
+ readonly autoIncrement?: boolean;
22
+ readonly indexes?: Record<string, IdbIndexIR>;
23
+ };
24
+ type IdbSchemaIR = {
25
+ readonly stores: Record<string, IdbStoreIR>;
26
+ };
27
+ //#endregion
28
+ //#region src/core/control-instance.d.ts
29
+ /** Fully-typed IDB control family instance returned by {@link createIdbFamilyInstance}. */
30
+ type IdbControlFamilyInstance = ControlFamilyInstance<"idb", IdbSchemaIR>;
31
+ //#endregion
32
+ //#region src/core/control-descriptor.d.ts
33
+ /**
34
+ * IDB family descriptor — the control-plane entry point for the IDB family.
35
+ *
36
+ * Registered in a Prisma Next config file under the `family` key:
37
+ * ```ts
38
+ * import idb from '@prisma-next-idb/family-idb/control';
39
+ * export default defineConfig({ family: idb, ... });
40
+ * ```
41
+ *
42
+ * **Responsibilities:**
43
+ * - Carries the {@link idbEmission} plugin used by `prisma-next contract emit`
44
+ * to generate `contract.d.ts`.
45
+ * - Acts as a factory: `create(stack)` returns an {@link IdbControlFamilyInstance}
46
+ * with domain-action methods consumed by the CLI.
47
+ */
48
+ declare class IdbFamilyDescriptor implements ControlFamilyDescriptor<"idb", IdbControlFamilyInstance> {
49
+ readonly kind: "family";
50
+ readonly id = "idb";
51
+ readonly familyId: "idb";
52
+ readonly version = "0.0.1";
53
+ readonly emission: {
54
+ readonly id: "idb";
55
+ readonly generateStorageType: (contract: import("@prisma-next/contract/types").Contract, storageHashTypeName: string) => string;
56
+ readonly generateModelStorageType: (_modelName: string, model: import("@prisma-next/contract/types").ContractModel) => string;
57
+ readonly getFamilyImports: () => string[];
58
+ readonly getFamilyTypeAliases: () => string;
59
+ readonly getTypeMapsExpression: () => string;
60
+ readonly getContractWrapper: (contractBaseName: string, typeMapsName: string) => string;
61
+ };
62
+ /**
63
+ * Creates an {@link IdbControlFamilyInstance} for the given control stack.
64
+ *
65
+ * The instance is a plain object whose methods implement the CLI domain
66
+ * actions (validateContract, verify, sign, etc.).
67
+ */
68
+ create(stack: ControlStack<"idb", string>): IdbControlFamilyInstance;
69
+ }
70
+ //#endregion
71
+ //#region src/core/validate.d.ts
72
+ /** Fully-typed IDB contract after validation. */
73
+ type IdbContract = Contract<IdbStorage>;
74
+ //#endregion
75
+ //#region src/exports/control.d.ts
76
+ declare const _default: IdbFamilyDescriptor;
77
+ //#endregion
78
+ export { type IdbContract, type IdbControlFamilyInstance, type IdbIndexIR, type IdbSchemaIR, type IdbStoreIR, _default as default };
79
+ //# sourceMappingURL=control.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../../src/core/schema-ir.ts","../../src/core/control-instance.ts","../../src/core/control-descriptor.ts","../../src/core/validate.ts","../../src/exports/control.ts"],"mappings":";;;;;;;;;;AASA;;;KAAY,UAAA;EAAA,SACD,OAAA;EAAA,SACA,MAAA;EAAA,SACA,UAAA;AAAA;AAAA,KAGC,UAAA;EAAA,SACD,OAAA;EAAA,SACA,aAAA;EAAA,SACA,OAAA,GAAU,MAAM,SAAS,UAAA;AAAA;AAAA,KAGxB,WAAA;EAAA,SACD,MAAA,EAAQ,MAAM,SAAS,UAAA;AAAA;;;;KCmCtB,wBAAA,GAA2B,qBAAqB,QAAQ,WAAA;;;;;;ADhDpE;;;;;;;;AAGqB;AAGrB;;;cEIa,mBAAA,YAA+B,uBAAA,QAA+B,wBAAA;EAAA,SAChE,IAAA;EAAA,SACA,EAAA;EAAA,SACA,QAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;IAAA;;;;;;;;EFFuB;;AAAU;;;;EEU1C,MAAA,CAAO,KAAA,EAAO,YAAA,kBAA8B,wBAAA;AAAA;;;;KCzBlC,WAAA,GAAc,QAAQ,CAAC,UAAA;;;cCHiB,QAAA"}