@civitai/app-sdk 0.99.0 → 0.100.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/blocks/index.d.ts +1 -1
- package/dist/blocks/types.d.ts +73 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/manifest/defineBlock.js +7 -5
- package/dist/manifest/index.d.ts +1 -1
- package/package.json +1 -1
- package/schemas/app-block/v1.json +48 -1
package/dist/blocks/index.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export { isModelSlotContext, isPageSlotContext } from './types.js';
|
|
|
88
88
|
* in `types.ts` for which of the two it uses and why.
|
|
89
89
|
*/
|
|
90
90
|
export { isSignedIn } from './types.js';
|
|
91
|
-
export type { BlockContext, KnownSlotId, ModelSlotId, PageSlotContext, PageSlotId, UnknownSlotContext, BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockSettings, BlockStorageCollectionDeclaration, BlockStorageCollectionExtends, BlockStorageCollectionHook, BlockStorageCollectionSchema, BlockStorageDeclaration, BlockStorageImport, BlockStorageIndexes, BlockStorageIndexType, BlockStorageMigrationKeyword, BlockStorageMigrationOp, BlockStoragePrivateCollectionDeclaration, BlockStorageSchemaType, BlockStorageSharedCollectionDeclaration, BlockToken, ContentRating, ManifestBooleanField, ManifestIframe, ManifestNumberField, ManifestPage, ManifestPreview, ManifestSettingField, ManifestSettings, ManifestStringField, ManifestTarget, ModelSlotContext, SettingScope, SettingWidget, Theme, ViewerInfo, ViewerImage, BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockSourceImage, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockUploadedGenerationSource, BlockPersistGenerationSourceRequest, BlockPersistedGenerationSource, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockMediaUploadBatchItemResult, BlockPendingImageInfo, BlockSharedUploadImageInfo, BlockSharedPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockShareLinkMethod, BlockShareLinkRequest, BlockShareLinkResult, BlockTextToImageParams, BlockWorkflowSnapshot, RateLimitMeta, BlockEstimateBatchAggregate, BlockModelSubstitution, ModelSubstitutionReason, KnownBlockWorkflowErrorCode, BlockStepToolCall, BlockTrainedEpoch, BlockPublishedModel, BuzzAccountType, ShowcaseImage, WorkflowBody, WorkflowBodyTextToImage, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyRecipe, WorkflowBodyCustomComfyInline, InlineComfyNode, WorkflowBodyStep, WorkflowBodyPassThroughStep, WorkflowBodyWorkflow, WorkflowBodyWorkflowStep, WorkflowStepRef, WithWorkflowStepRefs, BlockWorkflowStepSnapshot, BlockWorkflowStepQueue, BlockWorkflowEta, KnownBlockWorkflowQueueSupport, BlockWorkflowOutput, BlockWorkflowAvailableOutput, BlockWorkflowRestrictedOutput, BlockWorkflowPendingOutput, BlockWorkflowBlockedOutput, KnownBlockWorkflowOutputRating, KnownBlockWorkflowRestrictionReason, KnownBlockOutputUnlockOutcome, BlockOutputUnlockResult, WorkflowStatus, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, BlockResourceFile, BlockResourceFileEntry, BlockResourceFileEntryFormat, BlockResourceFileErrorCode, BlockResourceFileMeta, AppWorkflow, AppWorkflowImage, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostRequest, BlockCreatePostResult, BlockCreatePostHostError, WorkflowBodyTraining, AiToolkitTrainingParams, AiToolkitTrainingParamsBase, AiToolkitPlainEcosystem, AiToolkitLrScheduler, AiToolkitOptimizerType, BlockTrainingQuote, BlockTrainingDatasetItem, BlockTrainingDataImage, BlockTrainingDataUploadResult, BlockRunTrainingHostError, BlockStepQuote, BlockModel3dOutput, BlockRunConfirmedStepHostError, } from './types.js';
|
|
91
|
+
export type { BlockContext, KnownSlotId, ModelSlotId, PageSlotContext, PageSlotId, UnknownSlotContext, BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockSettings, BlockStorageCollectionDeclaration, BlockStorageCollectionExtends, BlockStorageCollectionHook, BlockStorageCollectionReadHook, BlockStorageCollectionSchema, BlockStorageDeclaration, BlockStorageImport, BlockStorageIndexes, BlockStorageIndexType, BlockStorageMigrationKeyword, BlockStorageMigrationOp, BlockStoragePrivateCollectionDeclaration, BlockStorageSchemaType, BlockStorageSharedCollectionDeclaration, BlockToken, ContentRating, ManifestBooleanField, ManifestIframe, ManifestNumberField, ManifestPage, ManifestPreview, ManifestSettingField, ManifestSettings, ManifestStringField, ManifestTarget, ModelSlotContext, SettingScope, SettingWidget, Theme, ViewerInfo, ViewerImage, BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockSourceImage, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockUploadedGenerationSource, BlockPersistGenerationSourceRequest, BlockPersistedGenerationSource, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockMediaUploadBatchItemResult, BlockPendingImageInfo, BlockSharedUploadImageInfo, BlockSharedPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockShareLinkMethod, BlockShareLinkRequest, BlockShareLinkResult, BlockTextToImageParams, BlockWorkflowSnapshot, RateLimitMeta, BlockEstimateBatchAggregate, BlockModelSubstitution, ModelSubstitutionReason, KnownBlockWorkflowErrorCode, BlockStepToolCall, BlockTrainedEpoch, BlockPublishedModel, BuzzAccountType, ShowcaseImage, WorkflowBody, WorkflowBodyTextToImage, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyRecipe, WorkflowBodyCustomComfyInline, InlineComfyNode, WorkflowBodyStep, WorkflowBodyPassThroughStep, WorkflowBodyWorkflow, WorkflowBodyWorkflowStep, WorkflowStepRef, WithWorkflowStepRefs, BlockWorkflowStepSnapshot, BlockWorkflowStepQueue, BlockWorkflowEta, KnownBlockWorkflowQueueSupport, BlockWorkflowOutput, BlockWorkflowAvailableOutput, BlockWorkflowRestrictedOutput, BlockWorkflowPendingOutput, BlockWorkflowBlockedOutput, KnownBlockWorkflowOutputRating, KnownBlockWorkflowRestrictionReason, KnownBlockOutputUnlockOutcome, BlockOutputUnlockResult, WorkflowStatus, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, BlockResourceFile, BlockResourceFileEntry, BlockResourceFileEntryFormat, BlockResourceFileErrorCode, BlockResourceFileMeta, AppWorkflow, AppWorkflowImage, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostRequest, BlockCreatePostResult, BlockCreatePostHostError, WorkflowBodyTraining, AiToolkitTrainingParams, AiToolkitTrainingParamsBase, AiToolkitPlainEcosystem, AiToolkitLrScheduler, AiToolkitOptimizerType, BlockTrainingQuote, BlockTrainingDatasetItem, BlockTrainingDataImage, BlockTrainingDataUploadResult, BlockRunTrainingHostError, BlockStepQuote, BlockModel3dOutput, BlockRunConfirmedStepHostError, } from './types.js';
|
|
92
92
|
/**
|
|
93
93
|
* Host bounds for an inline `customComfy` graph, mirrored from civitai/civitai —
|
|
94
94
|
* see `WorkflowBodyCustomComfyInline.workflow`.
|
package/dist/blocks/types.d.ts
CHANGED
|
@@ -1555,8 +1555,10 @@ export type WorkflowBodyStep = {
|
|
|
1555
1555
|
* - **`repeat` is refused on this arm**, outright: a `repeat` may only
|
|
1556
1556
|
* iterate an array in a body's own `arguments`, and this arm has none. Use
|
|
1557
1557
|
* a `kind: 'workflow'` body ({@link WorkflowBodyWorkflow}) to repeat a step.
|
|
1558
|
-
* - `maxBuzz` is
|
|
1559
|
-
*
|
|
1558
|
+
* - `maxBuzz` is NOT a spend ceiling: it is the least the host reserves,
|
|
1559
|
+
* and the host's quote can raise the reservation, and the charge, above it.
|
|
1560
|
+
* The limit is the token's per-call budget (`page.buzzBudgetPerGen`), which
|
|
1561
|
+
* an estimate's `overBudget` reports — see `maxBuzz`'s own note below.
|
|
1560
1562
|
*
|
|
1561
1563
|
* @example A pass-through body for an orchestrator step the registry does not
|
|
1562
1564
|
* carry. Note there is no `step` key.
|
|
@@ -3498,16 +3500,24 @@ export type BlockStorageMigrationKeyword = 'type' | 'const' | 'enum' | 'minimum'
|
|
|
3498
3500
|
* bytes of JSON. It is the only op that can cover a newly required property.
|
|
3499
3501
|
* - `rename` covers a declared property removed under `additionalProperties: false`, at `from`.
|
|
3500
3502
|
* - `remove` covers any breaking change at or under a field the new schema does not require.
|
|
3503
|
+
* - `erase` (civitai/civitai#10932) is a `remove` whose stored values are also deleted: it covers
|
|
3504
|
+
* what `remove` covers and runs as `remove` does, and 30 days after the version is approved the
|
|
3505
|
+
* platform deletes the field from the production documents still stored as they were written
|
|
3506
|
+
* before that approval (a document it cannot place exactly is left as it was and reported).
|
|
3507
|
+
* For a field whose values must not be kept. In a limited rollout: civitai.com refuses ANY
|
|
3508
|
+
* `erase` at submit and approve unless the platform has enabled erase for the app (always on
|
|
3509
|
+
* an app's first version); `remove` covers the same changes and keeps the values unserved.
|
|
3501
3510
|
* - `acknowledge` covers exactly the one breaking change whose pointer EQUALS `path` (never a
|
|
3502
3511
|
* prefix) with that `keyword`, and changes nothing: documents that violate it are refused on
|
|
3503
3512
|
* their next write until reshaped. Its `path` may be `""` (the document root) and may use the
|
|
3504
3513
|
* segment `*` for a change inside `items` or an `additionalProperties` schema (`"/tags/*"`).
|
|
3505
3514
|
*
|
|
3506
|
-
* The `path` / `from` / `to` of `default`, `rename` and `
|
|
3507
|
-
* of a document's `data` (`"/meta/title"`): 1 to 15 non-empty segments, `~` written
|
|
3508
|
-
* written `~1`, no `*` segment. Every op is idempotent, and the fields `default`,
|
|
3509
|
-
* `remove` touch must be disjoint. Only the ops that cover a breaking
|
|
3510
|
-
* once, when it is approved; an op that covers nothing is reported
|
|
3515
|
+
* The `path` / `from` / `to` of `default`, `rename`, `remove` and `erase` are JSON Pointers to
|
|
3516
|
+
* one field of a document's `data` (`"/meta/title"`): 1 to 15 non-empty segments, `~` written
|
|
3517
|
+
* `~0` and `/` written `~1`, no `*` segment. Every op is idempotent, and the fields `default`,
|
|
3518
|
+
* `rename`, `remove` and `erase` touch must be disjoint. Only the ops that cover a breaking
|
|
3519
|
+
* change of THIS version run, once, when it is approved; an op that covers nothing is reported
|
|
3520
|
+
* at submit and never runs.
|
|
3511
3521
|
*/
|
|
3512
3522
|
export type BlockStorageMigrationOp = {
|
|
3513
3523
|
op: 'default';
|
|
@@ -3520,6 +3530,9 @@ export type BlockStorageMigrationOp = {
|
|
|
3520
3530
|
} | {
|
|
3521
3531
|
op: 'remove';
|
|
3522
3532
|
path: string;
|
|
3533
|
+
} | {
|
|
3534
|
+
op: 'erase';
|
|
3535
|
+
path: string;
|
|
3523
3536
|
} | {
|
|
3524
3537
|
op: 'acknowledge';
|
|
3525
3538
|
path: string;
|
|
@@ -3558,6 +3571,49 @@ export interface BlockStorageCollectionHook {
|
|
|
3558
3571
|
/** The most milliseconds one call may take: an integer from 1 to 500. Omitted means 50. */
|
|
3559
3572
|
timeoutMs?: number;
|
|
3560
3573
|
}
|
|
3574
|
+
/**
|
|
3575
|
+
* RESERVED — civitai.com refuses this field until read hooks are enabled, so do
|
|
3576
|
+
* not declare it yet. A collection's read hook: one ES module of the bundle
|
|
3577
|
+
* whose default export `read(input)` shapes what a viewer is served when they
|
|
3578
|
+
* read the collection. A separate key from the write `hook`
|
|
3579
|
+
* ({@link BlockStorageCollectionHook}), with the same shape and the same file
|
|
3580
|
+
* rules. Mirrors the canonical schema's `$defs.storageCollectionReadHook`; this
|
|
3581
|
+
* package adds no read-hook behaviour.
|
|
3582
|
+
*
|
|
3583
|
+
* Not allowed beside `registry` (the registry export is read with no viewer);
|
|
3584
|
+
* the canonical refuses the pair. Allowed with `indexes`, but a read whose
|
|
3585
|
+
* filter or sort uses an index is refused with 400 `not_supported_here`.
|
|
3586
|
+
* Allowed on a viewer-keyed (`keyedBy`) collection.
|
|
3587
|
+
*
|
|
3588
|
+
* Checked by the server, not by the schema: whether `file` is inside
|
|
3589
|
+
* `outputDir`, whether it exists in the bundle with this `sha256`, its size (one
|
|
3590
|
+
* self-contained module with no imports, at most 65536 bytes of UTF-8 text),
|
|
3591
|
+
* and two hooks (write or read) pinning one file with different digests.
|
|
3592
|
+
*/
|
|
3593
|
+
export interface BlockStorageCollectionReadHook {
|
|
3594
|
+
/**
|
|
3595
|
+
* The read hook's relative path in the submitted bundle, shipped verbatim (a
|
|
3596
|
+
* committed source file, not a build output): `/`-separated segments, each
|
|
3597
|
+
* starting with a letter, digit, `_` or `-` and then letters, digits, `_`, `.`
|
|
3598
|
+
* or `-` (so no `.` or `..` segment, no hidden file, no leading `/`), ending
|
|
3599
|
+
* `.js` or `.mjs`, at most 200 characters, with no `node_modules` segment.
|
|
3600
|
+
* Pattern `^([A-Za-z0-9_-][A-Za-z0-9_.-]*\/)*[A-Za-z0-9_-][A-Za-z0-9_.-]*\.m?js$`.
|
|
3601
|
+
* Its default export is `read(input)`.
|
|
3602
|
+
*/
|
|
3603
|
+
file: string;
|
|
3604
|
+
/**
|
|
3605
|
+
* The SHA-256 of the file's bytes as 64 lowercase hex characters
|
|
3606
|
+
* (`^[0-9a-f]{64}$`). Submit, the git-push path and approve each refuse a
|
|
3607
|
+
* version whose file is missing or does not match it. One file used by several
|
|
3608
|
+
* hooks (write or read) must be pinned with the same digest in each.
|
|
3609
|
+
*/
|
|
3610
|
+
sha256: string;
|
|
3611
|
+
/**
|
|
3612
|
+
* The most milliseconds the read hook may take for the WHOLE PAGE of one
|
|
3613
|
+
* read: an integer from 1 to 500. Omitted means 50.
|
|
3614
|
+
*/
|
|
3615
|
+
timeoutMs?: number;
|
|
3616
|
+
}
|
|
3561
3617
|
/**
|
|
3562
3618
|
* RESERVED — civitai.com refuses this field until extensions are enabled, so do
|
|
3563
3619
|
* not declare it yet. The source of an EXTENSION collection: this private
|
|
@@ -3608,6 +3664,8 @@ export interface BlockStoragePrivateCollectionDeclaration {
|
|
|
3608
3664
|
migrations?: BlockStorageMigrationOp[];
|
|
3609
3665
|
/** Limited rollout — see {@link BlockStorageSharedCollectionDeclaration.hook}. */
|
|
3610
3666
|
hook?: BlockStorageCollectionHook;
|
|
3667
|
+
/** RESERVED — see {@link BlockStorageSharedCollectionDeclaration.readHook}. */
|
|
3668
|
+
readHook?: BlockStorageCollectionReadHook;
|
|
3611
3669
|
/**
|
|
3612
3670
|
* RESERVED — makes this collection an EXTENSION of another app's collection;
|
|
3613
3671
|
* see {@link BlockStorageCollectionExtends}. Private collections of kind
|
|
@@ -3780,6 +3838,14 @@ export interface BlockStorageSharedCollectionDeclaration {
|
|
|
3780
3838
|
* private and shared alike.
|
|
3781
3839
|
*/
|
|
3782
3840
|
hook?: BlockStorageCollectionHook;
|
|
3841
|
+
/**
|
|
3842
|
+
* RESERVED — civitai.com refuses this field until read hooks are enabled, so
|
|
3843
|
+
* do not declare it yet. A read hook that shapes what a viewer is served when
|
|
3844
|
+
* they read this collection — see {@link BlockStorageCollectionReadHook}.
|
|
3845
|
+
* Allowed on every collection kind, but never beside `registry` (the
|
|
3846
|
+
* canonical refuses the pair).
|
|
3847
|
+
*/
|
|
3848
|
+
readHook?: BlockStorageCollectionReadHook;
|
|
3783
3849
|
}
|
|
3784
3850
|
/**
|
|
3785
3851
|
* One collection declaration — see {@link BlockManifestV1.storage}.
|
package/dist/index.d.ts
CHANGED
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
*
|
|
26
26
|
* - **`./blocks`** — importing it RUNS `./safe-storage` for its side effect
|
|
27
27
|
* (repairing `localStorage`/`sessionStorage` at an opaque origin). Folding
|
|
28
|
-
*
|
|
28
|
+
* 248 symbols and that side effect into the root would make every OAuth app
|
|
29
29
|
* that writes `import { exchangeCode } from '@civitai/app-sdk'` pay for the
|
|
30
30
|
* Civitai-Apps contract it does not use. Blocks and OAuth apps are disjoint
|
|
31
31
|
* audiences; see this package's README.
|
|
32
|
-
* 🔴 That
|
|
32
|
+
* 🔴 That 248 is ASSERTED, not merely quoted — by
|
|
33
33
|
* `packages/civitai-app-sdk/test/export-surface.test.ts`, which pins
|
|
34
34
|
* `surface.get('./blocks').size`. It said 119 here against a real 125 until
|
|
35
35
|
* 2026-10-04, because the existing checks pin the root as an exact union and
|
package/dist/index.js
CHANGED
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
*
|
|
26
26
|
* - **`./blocks`** — importing it RUNS `./safe-storage` for its side effect
|
|
27
27
|
* (repairing `localStorage`/`sessionStorage` at an opaque origin). Folding
|
|
28
|
-
*
|
|
28
|
+
* 248 symbols and that side effect into the root would make every OAuth app
|
|
29
29
|
* that writes `import { exchangeCode } from '@civitai/app-sdk'` pay for the
|
|
30
30
|
* Civitai-Apps contract it does not use. Blocks and OAuth apps are disjoint
|
|
31
31
|
* audiences; see this package's README.
|
|
32
|
-
* 🔴 That
|
|
32
|
+
* 🔴 That 248 is ASSERTED, not merely quoted — by
|
|
33
33
|
* `packages/civitai-app-sdk/test/export-surface.test.ts`, which pins
|
|
34
34
|
* `surface.get('./blocks').size`. It said 119 here against a real 125 until
|
|
35
35
|
* 2026-10-04, because the existing checks pin the root as an exact union and
|
|
@@ -153,11 +153,11 @@ export const KNOWN_GAPS = {
|
|
|
153
153
|
'already declare in the app\'s previous approved version; use a viewer-keyed collection, ' +
|
|
154
154
|
'`keyedBy`, instead), and the ' +
|
|
155
155
|
'RESERVED features (`kind` "log", `ttlSeconds`, `dailyWritesPerAuthor`, `registry`, ' +
|
|
156
|
-
'`write` "anyone" / "owner", `extends`) validate offline and are refused at submit. A new or changed ' +
|
|
156
|
+
'`write` "anyone" / "owner", `extends`, `readHook`) validate offline and are refused at submit. A new or changed ' +
|
|
157
157
|
'`hook` is in a limited rollout: it validates offline and is refused at submit for an author ' +
|
|
158
|
-
'the rollout does not include. A `hook`\'s `file` ' +
|
|
158
|
+
'the rollout does not include. A `hook`\'s or `readHook`\'s `file` ' +
|
|
159
159
|
'being outside `outputDir`, present in the bundle with its `sha256`, its size, and one file ' +
|
|
160
|
-
'pinned with one digest across
|
|
160
|
+
'pinned with one digest across every hook (write or read) are checked by the server too. Ajv enforces the ' +
|
|
161
161
|
'structural rules exactly; these are server-side.',
|
|
162
162
|
'storage-collection-schema-server-only-rules': 'A collection `schema` (civitai/civitai#7491): the canonical encodes the keyword subset, each ' +
|
|
163
163
|
'keyword\'s shape, the 256-character `pattern` bound, "a pattern needs a maxLength of at most ' +
|
|
@@ -168,14 +168,16 @@ export const KNOWN_GAPS = {
|
|
|
168
168
|
'and no pattern that can backtrack ' +
|
|
169
169
|
'catastrophically. Those validate here and are refused at submit.',
|
|
170
170
|
'storage-migrations-server-only-rules': 'A collection\'s `migrations` (civitai/civitai#7661): the canonical encodes each op\'s shape ' +
|
|
171
|
-
'(`default` / `rename` / `remove` / `acknowledge`), the JSON Pointer form of its paths, the ' +
|
|
171
|
+
'(`default` / `rename` / `remove` / `erase` / `acknowledge`), the JSON Pointer form of its paths, the ' +
|
|
172
172
|
'acknowledge-only `""` and `*`, the `keyword` list, 1 to 32 ops and "no migrations on write ' +
|
|
173
173
|
'none", and Ajv enforces those exactly. The rest is the server\'s, at submit. Which schema ' +
|
|
174
174
|
'changes are breaking, and whether an op covers one, needs the PREVIOUS approved manifest, so ' +
|
|
175
175
|
'a breaking change no op covers and an op that covers nothing (reported, never run) are ' +
|
|
176
176
|
'decided there. So are the canonical\'s prose-only rules: a `default` value must match the new ' +
|
|
177
177
|
'schema at its path and be at most 4096 bytes of JSON, and the ops must touch disjoint ' +
|
|
178
|
-
'fields. All of those validate here.'
|
|
178
|
+
'fields. All of those validate here. Any `erase` op is also refused at submit and approve unless ' +
|
|
179
|
+
'the platform has enabled erase for the app (a per-app rollout, and always on a first version), ' +
|
|
180
|
+
'which only the server knows; it validates here.',
|
|
179
181
|
'storage-keyedBy-immutable': 'A collection\'s `keyedBy` (viewer-keyed documents): the canonical encodes its values ' +
|
|
180
182
|
'("viewer" / "parent+viewer") and where it may appear — shared `write` "own" collections ' +
|
|
181
183
|
'only, never `kind` "log", never beside the removed `counters` or `marks` — and Ajv enforces those ' +
|
package/dist/manifest/index.d.ts
CHANGED
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
export { defineBlock, SCHEMA_DIVERGENCES, KNOWN_GAPS, loadCanonicalSchema } from './defineBlock.js';
|
|
16
16
|
export type { DefineBlockConfig } from './defineBlock.js';
|
|
17
17
|
export { BlockManifestError } from '../blocks/manifestError.js';
|
|
18
|
-
export type { BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockStorageCollectionDeclaration, BlockStorageCollectionExtends, BlockStorageCollectionHook, BlockStorageCollectionSchema, BlockStorageDeclaration, BlockStorageImport, BlockStorageIndexes, BlockStorageIndexType, BlockStorageMigrationKeyword, BlockStorageMigrationOp, BlockStoragePrivateCollectionDeclaration, BlockStorageSchemaType, BlockStorageSharedCollectionDeclaration, } from '../blocks/types.js';
|
|
18
|
+
export type { BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockStorageCollectionDeclaration, BlockStorageCollectionExtends, BlockStorageCollectionHook, BlockStorageCollectionReadHook, BlockStorageCollectionSchema, BlockStorageDeclaration, BlockStorageImport, BlockStorageIndexes, BlockStorageIndexType, BlockStorageMigrationKeyword, BlockStorageMigrationOp, BlockStoragePrivateCollectionDeclaration, BlockStorageSchemaType, BlockStorageSharedCollectionDeclaration, } from '../blocks/types.js';
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -533,7 +533,7 @@
|
|
|
533
533
|
},
|
|
534
534
|
"migrations": {
|
|
535
535
|
"type": "array",
|
|
536
|
-
"description": "Optional. Declarative ops applied to this collection's documents ALREADY STORED in production when this version is approved, for a schema change that would otherwise leave them unwritable. Submit compares this collection's `schema` with the previous approved version's (statically; stored documents are never read) and refuses every BREAKING change no op here covers: \"default\" covers a newly required property at its `path` (`value` must match the new schema there) — the only op that can; \"rename\" covers a declared property removed under `additionalProperties: false`, at `from`; \"remove\" covers any breaking change at or under a field the new schema does not require; \"acknowledge\" covers exactly the one breaking change whose pointer is its `path` (\"\" for the document root, \"*\" for an `items` or `additionalProperties` schema, matched literally, never as a prefix) with its `keyword` and changes nothing — documents that violate it are refused on their next write until reshaped. A first schema on a collection that had none is compared with accept-anything, so each of its constraints is its own breaking change. The paths of default, rename and
|
|
536
|
+
"description": "Optional. Declarative ops applied to this collection's documents ALREADY STORED in production when this version is approved, for a schema change that would otherwise leave them unwritable. Submit compares this collection's `schema` with the previous approved version's (statically; stored documents are never read) and refuses every BREAKING change no op here covers: \"default\" covers a newly required property at its `path` (`value` must match the new schema there) — the only op that can; \"rename\" covers a declared property removed under `additionalProperties: false`, at `from`; \"remove\" covers any breaking change at or under a field the new schema does not require; \"erase\" covers what \"remove\" covers, and 30 days after approval also deletes the field from the production documents stored before it (see the op); \"acknowledge\" covers exactly the one breaking change whose pointer is its `path` (\"\" for the document root, \"*\" for an `items` or `additionalProperties` schema, matched literally, never as a prefix) with its `keyword` and changes nothing — documents that violate it are refused on their next write until reshaped. A first schema on a collection that had none is compared with accept-anything, so each of its constraints is its own breaking change. The paths of default, rename, remove and erase are JSON Pointers to one field of a document's data (\"/meta/title\"). Every op is idempotent, and default, rename, remove and erase ops must touch disjoint fields, so a re-run changes nothing. Only the ops that cover a breaking change of THIS version run, once, in bounded batches; an op that covers nothing is reported at submit and never runs, so a list left in a later version is inert. Not allowed on a `write` \"none\" collection. 1 to 32 ops.",
|
|
537
537
|
"minItems": 1,
|
|
538
538
|
"maxItems": 32,
|
|
539
539
|
"items": { "$ref": "#/$defs/storageMigrationOp" }
|
|
@@ -547,6 +547,10 @@
|
|
|
547
547
|
"description": "Optional, in a limited rollout: civitai.com accepts a new or changed hook only from authors the rollout includes, and refuses it otherwise. A permission hook: one ES module of the bundle whose default export decides, for every write to this collection, whether the write is allowed. It runs after the collection `schema` check, never instead of it. `file` is the hook's path in the submitted bundle, shipped verbatim — a committed source file, not a build output, so it must not be inside `outputDir` or `node_modules`; one self-contained module with no imports, at most 65536 bytes of UTF-8 text. `sha256` is the SHA-256 of that file's bytes as 64 lowercase hex characters: submit, the git-push path and approve each refuse a version whose file is missing or does not match it. `timeoutMs` is the most time one call may take, from 1 to 500 (omitted means 50). One file used by several collections must be pinned with the same sha256 in each.",
|
|
548
548
|
"$ref": "#/$defs/storageCollectionHook"
|
|
549
549
|
},
|
|
550
|
+
"readHook": {
|
|
551
|
+
"description": "RESERVED — civitai.com refuses this field until read hooks are enabled, so do not declare it yet. A read hook: one ES module of the bundle whose default export `read(input)` shapes what a viewer is served when they read this collection. A separate key from the write `hook`, with the same shape and the same file rules: `file` is the module's path in the submitted bundle, shipped verbatim — a committed source file, not a build output, so it must not be inside `outputDir` or `node_modules`; one self-contained module with no imports, at most 65536 bytes of UTF-8 text. `sha256` is the SHA-256 of that file's bytes as 64 lowercase hex characters: submit, the git-push path and approve each refuse a version whose file is missing or does not match it. `timeoutMs` is the budget for the WHOLE PAGE of one read, from 1 to 500 (omitted means 50). Not allowed with `registry`: the registry export is read with no viewer. Allowed with `indexes`, but a read whose filter or sort uses an index is refused with 400 `not_supported_here`. Allowed on a viewer-keyed (`keyedBy`) collection. Adding or changing one will be in a limited rollout, as `hook` is. One file used by several hooks (write or read) must be pinned with the same sha256 in each.",
|
|
552
|
+
"$ref": "#/$defs/storageCollectionReadHook"
|
|
553
|
+
},
|
|
550
554
|
"extends": {
|
|
551
555
|
"description": "RESERVED — civitai.com refuses this field until extensions are enabled, so do not declare it yet. Private collections of kind \"docs\" only, without `keyedBy`. Makes this collection an EXTENSION of another app's collection: the viewer's document here under key k extends that viewer's document under the same key k in the source collection, and a reader merges the two on read (the source's value wins a property both hold). The source is never written. `from` is the source app's blockId and must be imported by `storage.imports` with access \"read\" (never \"readwrite\") naming `collection`. Submit refuses an extension whose source has no approved version or does not declare the collection, declares it `exportable: false`, or itself extends another collection; and one whose `schema` declares a top-level property the source collection's schema also declares. At most 4 collections may declare `extends`. Cannot be added, removed or changed on a collection any approved version declared: declare a new collection instead. A moderator sees each extension at review.",
|
|
552
556
|
"$ref": "#/$defs/storageCollectionExtends"
|
|
@@ -629,6 +633,11 @@
|
|
|
629
633
|
},
|
|
630
634
|
"then": { "properties": { "keyedBy": false } }
|
|
631
635
|
},
|
|
636
|
+
{
|
|
637
|
+
"$comment": "The registry export is read with no viewer, so a read hook could not run for it.",
|
|
638
|
+
"if": { "required": ["readHook"] },
|
|
639
|
+
"then": { "properties": { "registry": false } }
|
|
640
|
+
},
|
|
632
641
|
{
|
|
633
642
|
"$comment": "A viewer-keyed document is itself the viewer's vote or entry, so a viewer-keyed collection declares no counters or marks.",
|
|
634
643
|
"if": { "required": ["keyedBy"] },
|
|
@@ -750,6 +759,18 @@
|
|
|
750
759
|
"path": { "$ref": "#/$defs/storageMigrationPath" }
|
|
751
760
|
}
|
|
752
761
|
},
|
|
762
|
+
{
|
|
763
|
+
"type": "object",
|
|
764
|
+
"additionalProperties": false,
|
|
765
|
+
"required": ["op", "path"],
|
|
766
|
+
"properties": {
|
|
767
|
+
"op": {
|
|
768
|
+
"const": "erase",
|
|
769
|
+
"description": "A \"remove\" whose stored values are also deleted: it covers what \"remove\" covers and runs as \"remove\" does, and 30 days after this version is approved the platform deletes the field from the app's production documents still stored as they were written before that approval. A document it cannot place exactly (written later with no recorded schema version, one whose field an earlier version's migration moved, or one recorded at this version or later that still holds the field) is left as it was and reported to the platform; development and review data are not touched, and backups keep what they held. Use it for a field whose values must not be kept. Refused at submit unless the platform has enabled erase for the app."
|
|
770
|
+
},
|
|
771
|
+
"path": { "$ref": "#/$defs/storageMigrationPath" }
|
|
772
|
+
}
|
|
773
|
+
},
|
|
753
774
|
{
|
|
754
775
|
"type": "object",
|
|
755
776
|
"additionalProperties": false,
|
|
@@ -812,6 +833,32 @@
|
|
|
812
833
|
}
|
|
813
834
|
}
|
|
814
835
|
},
|
|
836
|
+
"storageCollectionReadHook": {
|
|
837
|
+
"type": "object",
|
|
838
|
+
"description": "A collection's read hook (see `storage.collections.<name>.readHook`). Whether `file` is inside `outputDir`, whether it exists in the bundle with this sha256, its size, and two hooks pinning one file with different digests are checked by the server, not by this schema.",
|
|
839
|
+
"additionalProperties": false,
|
|
840
|
+
"required": ["file", "sha256"],
|
|
841
|
+
"properties": {
|
|
842
|
+
"file": {
|
|
843
|
+
"type": "string",
|
|
844
|
+
"description": "The read hook's relative path in the bundle: \"/\"-separated segments, each starting with a letter, digit, _ or - and then letters, digits, _, . or - (so no \".\" or \"..\" segment, no hidden file, no leading \"/\"), ending .js or .mjs, at most 200 characters, with no node_modules segment. Its default export is `read(input)`.",
|
|
845
|
+
"maxLength": 200,
|
|
846
|
+
"pattern": "^([A-Za-z0-9_-][A-Za-z0-9_.-]*/)*[A-Za-z0-9_-][A-Za-z0-9_.-]*\\.m?js$",
|
|
847
|
+
"not": { "pattern": "(^|/)node_modules(/|$)" }
|
|
848
|
+
},
|
|
849
|
+
"sha256": {
|
|
850
|
+
"type": "string",
|
|
851
|
+
"description": "The SHA-256 of the file's bytes, as 64 lowercase hex characters.",
|
|
852
|
+
"pattern": "^[0-9a-f]{64}$"
|
|
853
|
+
},
|
|
854
|
+
"timeoutMs": {
|
|
855
|
+
"type": "integer",
|
|
856
|
+
"description": "The most milliseconds the read hook may take for the whole page of one read, from 1 to 500. Omitted means 50.",
|
|
857
|
+
"minimum": 1,
|
|
858
|
+
"maximum": 500
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
},
|
|
815
862
|
"storageCollectionExtends": {
|
|
816
863
|
"type": "object",
|
|
817
864
|
"description": "The source of an extension (see `storage.collections.<name>.extends`). Whether `storage.imports` covers it with access \"read\", what the source app's approved manifest declares, the limit of 4, and that it never changes once approved are checked by the server, not by this schema.",
|