@forge-cms/runtime 0.5.0 → 0.7.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.
- package/dist/auth-handlers.d.ts +43 -1
- package/dist/auth-handlers.d.ts.map +1 -1
- package/dist/auth-handlers.js +64 -18
- package/dist/auth-handlers.js.map +1 -1
- package/dist/auth-managed.d.ts +19 -0
- package/dist/auth-managed.d.ts.map +1 -0
- package/dist/auth-managed.js +24 -0
- package/dist/auth-managed.js.map +1 -0
- package/dist/body.d.ts +28 -0
- package/dist/body.d.ts.map +1 -0
- package/dist/body.js +81 -0
- package/dist/body.js.map +1 -0
- package/dist/concurrency.d.ts +8 -0
- package/dist/concurrency.d.ts.map +1 -0
- package/dist/concurrency.js +15 -0
- package/dist/concurrency.js.map +1 -0
- package/dist/context.d.ts +5 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/errors.d.ts +46 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +61 -0
- package/dist/errors.js.map +1 -1
- package/dist/files.d.ts +15 -1
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +55 -14
- package/dist/files.js.map +1 -1
- package/dist/globals.d.ts +21 -3
- package/dist/globals.d.ts.map +1 -1
- package/dist/globals.js +216 -28
- package/dist/globals.js.map +1 -1
- package/dist/handlers.d.ts +3 -2
- package/dist/handlers.d.ts.map +1 -1
- package/dist/handlers.js +51 -49
- package/dist/handlers.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/localization.d.ts +17 -0
- package/dist/localization.d.ts.map +1 -1
- package/dist/localization.js +56 -0
- package/dist/localization.js.map +1 -1
- package/dist/operations.d.ts +51 -12
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +728 -125
- package/dist/operations.js.map +1 -1
- package/dist/relation-integrity.d.ts +31 -13
- package/dist/relation-integrity.d.ts.map +1 -1
- package/dist/relation-integrity.js +62 -6
- package/dist/relation-integrity.js.map +1 -1
- package/dist/relation-lifecycle.d.ts +95 -0
- package/dist/relation-lifecycle.d.ts.map +1 -0
- package/dist/relation-lifecycle.js +424 -0
- package/dist/relation-lifecycle.js.map +1 -0
- package/dist/runtime.d.ts +21 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +112 -20
- package/dist/runtime.js.map +1 -1
- package/dist/storage-intents.d.ts +96 -0
- package/dist/storage-intents.d.ts.map +1 -0
- package/dist/storage-intents.js +217 -0
- package/dist/storage-intents.js.map +1 -0
- package/dist/system-fields.d.ts +27 -0
- package/dist/system-fields.d.ts.map +1 -0
- package/dist/system-fields.js +74 -0
- package/dist/system-fields.js.map +1 -0
- package/dist/versions.d.ts +73 -1
- package/dist/versions.d.ts.map +1 -1
- package/dist/versions.js +204 -17
- package/dist/versions.js.map +1 -1
- package/package.json +9 -7
package/dist/operations.d.ts
CHANGED
|
@@ -87,23 +87,62 @@ export declare function findByID(ctx: OperationContext, args: FindByIDArgs & {
|
|
|
87
87
|
}): Promise<DatabaseRecord>;
|
|
88
88
|
export declare function count(ctx: OperationContext, args: CountArgs): Promise<number>;
|
|
89
89
|
export declare function create(ctx: OperationContext, args: CreateArgs): Promise<DatabaseRecord>;
|
|
90
|
+
/**
|
|
91
|
+
* The multipart upload pipeline's create (spec 063 §5) — **package-private**: exported for
|
|
92
|
+
* `handlers.ts` only, never from the package entry point. `storageKey` is the key Forge itself just
|
|
93
|
+
* generated and stored the object under; it is merged into the persisted row only, outside caller
|
|
94
|
+
* `data` and hook `data`, so no caller of the public mutation surface can choose or rewrite it.
|
|
95
|
+
*/
|
|
96
|
+
export declare function createUpload(ctx: OperationContext, args: CreateArgs, upload: {
|
|
97
|
+
storageKey: string;
|
|
98
|
+
intentId: string;
|
|
99
|
+
}): Promise<DatabaseRecord>;
|
|
100
|
+
/**
|
|
101
|
+
* The whole upload create (spec 067) — **package-private**, called by `handleCreate` for a multipart
|
|
102
|
+
* body: records a durable storage intent, stores the object under a Forge-generated key, then creates
|
|
103
|
+
* the document with the key and the intent claim in one batch. Any failure after the intent exists
|
|
104
|
+
* settles it: the object is deleted only while the intent is still there (the document never
|
|
105
|
+
* committed); otherwise the intent stays for `reconcileStorage()`. The file's `filename`, `url`,
|
|
106
|
+
* `contentType` and `filesize` fill whichever of those fields the collection declares, under `args.data`.
|
|
107
|
+
*/
|
|
108
|
+
export declare function uploadFile(ctx: OperationContext, args: CreateArgs, file: File): Promise<DatabaseRecord>;
|
|
90
109
|
export declare function update(ctx: OperationContext, args: UpdateArgs): Promise<DatabaseRecord>;
|
|
91
110
|
/**
|
|
92
|
-
* Restores a document to a specific historical version — spec 058 §2.
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
111
|
+
* Restores a document to a specific historical version — spec 058 §2, made atomic by spec 062. The raw
|
|
112
|
+
* snapshot is read (trusted — restore's authorization gate is `update()`'s own update-access check on
|
|
113
|
+
* the *current* document, see spec 058 §2) and handed to this module's own update pipeline, which turns
|
|
114
|
+
* it into a patch of only the fields that differ from the current document (spec 062 §6) and then runs
|
|
115
|
+
* the normal update-access / row-policy / field-write / validation / hook pipeline. The patch and one
|
|
116
|
+
* snapshot labeled `Restored from version N` commit in one atomic batch, so a forbidden, invalid or
|
|
117
|
+
* conflicting restore leaves both the document and its history unchanged.
|
|
98
118
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* "can this caller read this document's history" gate for restore (see spec 058 §2 for the reasoning).
|
|
103
|
-
* A forbidden or invalid restore throws before `update()` ever reaches the adapter write, so both the
|
|
104
|
-
* current document and its history are left unchanged.
|
|
119
|
+
* System metadata (`id`, `created_at`, `updated_at`, `_storageKey`) is never restored. A full (spec 062)
|
|
120
|
+
* snapshot sets every currently declared field, so a snapshot that predates a now-required field fails
|
|
121
|
+
* current validation instead of producing an invalid document.
|
|
105
122
|
*/
|
|
106
123
|
export declare function restoreVersion(ctx: OperationContext, args: RestoreVersionArgs): Promise<DatabaseRecord>;
|
|
124
|
+
/**
|
|
125
|
+
* Deletes a document together with its whole relation graph (spec 064 §5) — plan, prepare, **one**
|
|
126
|
+
* `atomicWrite`, finalize:
|
|
127
|
+
*
|
|
128
|
+
* 1. **Plan** (reads only): root `beforeOperation`, read, access; then {@link planRelationDelete} walks
|
|
129
|
+
* every cascade/set-null/restrict reference to its fixpoint, judges restrict and required set-null
|
|
130
|
+
* against the final state, and refuses a plan that cannot fit in one batch — before any `before*`
|
|
131
|
+
* hook of the graph and before any write.
|
|
132
|
+
* 2. **Prepare** (hooks, validation; no writes): root `beforeDelete`; each cascaded document's
|
|
133
|
+
* `beforeOperation` + `beforeDelete`; each set-null document through the same {@link prepareUpdate}
|
|
134
|
+
* `update()` uses. Dependents run with `overrideAccess: true` — a consequence of an authorized delete,
|
|
135
|
+
* like a database's own `ON DELETE CASCADE` (spec 058 §5) — but never skip validation or hooks.
|
|
136
|
+
* 3. **Commit**: set-null patches (versioned: spec 062's update + snapshot), cascaded deletes guarded by
|
|
137
|
+
* the `updated_at` they were planned with, the root delete, and finally one "no reference remains"
|
|
138
|
+
* `assertCount` per referring field — all in one batch, so a late failure or a reference created
|
|
139
|
+
* concurrently leaves every row unchanged.
|
|
140
|
+
* 4. **Finalize** (after commit): storage cleanup for deleted upload documents, then after-hooks —
|
|
141
|
+
* dependents first, root last.
|
|
142
|
+
*
|
|
143
|
+
* Before-hooks are not transactional: a side effect they performed outside the database survives a
|
|
144
|
+
* rollback of the batch (roadmap D01).
|
|
145
|
+
*/
|
|
107
146
|
export declare function deleteDocument(ctx: OperationContext, args: DeleteArgs): Promise<DatabaseRecord>;
|
|
108
147
|
export interface PreviewArgs extends BaseOperationArgs {
|
|
109
148
|
data: Record<string, unknown>;
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,OAAO,EAAwB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,OAAO,EAAwB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,KAAK,EAEV,cAAc,EACd,aAAa,EACb,SAAS,EAEV,MAAM,eAAe,CAAC;AAMvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AA4BrD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAahE,OAAO,KAAK,EAAqB,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAyB3E,6DAA6D;AAC7D,MAAM,WAAW,aAAa,CAAC,IAAI,GAAG,cAAc;IAClD,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wFAAwF;IACxF,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACd,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAS,SAAQ,iBAAiB;IACjD,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,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