@beechcms/core 0.8.0 → 0.9.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/account-email.d.ts +3 -0
- package/dist/auth/account-email.d.ts.map +1 -0
- package/dist/auth/account-email.js +9 -0
- package/dist/auth/password-reset-token.repository.d.ts +13 -2
- package/dist/auth/password-reset-token.repository.d.ts.map +1 -1
- package/dist/auth/user.repository.d.ts +69 -4
- package/dist/auth/user.repository.d.ts.map +1 -1
- package/dist/automations-grammar-words.d.ts +2 -0
- package/dist/automations-grammar-words.d.ts.map +1 -0
- package/dist/automations-grammar-words.js +8 -0
- package/dist/automations.repository.interface.d.ts +19 -0
- package/dist/automations.repository.interface.d.ts.map +1 -0
- package/dist/automations.repository.interface.js +3 -0
- package/dist/automations.runner.interface.d.ts +10 -0
- package/dist/automations.runner.interface.d.ts.map +1 -0
- package/dist/automations.runner.interface.js +3 -0
- package/dist/automations.runner.stub.d.ts +5 -0
- package/dist/automations.runner.stub.d.ts.map +1 -0
- package/dist/automations.runner.stub.js +7 -0
- package/dist/automations.types.d.ts +75 -0
- package/dist/automations.types.d.ts.map +1 -0
- package/dist/automations.types.js +3 -0
- package/dist/clock.d.ts +25 -0
- package/dist/clock.d.ts.map +1 -0
- package/dist/clock.js +11 -0
- package/dist/common/canonical-json.d.ts +31 -0
- package/dist/common/canonical-json.d.ts.map +1 -0
- package/dist/common/canonical-json.js +91 -0
- package/dist/content/content-scan.repository.d.ts +1 -1
- package/dist/content/content.repository.d.ts +154 -3
- package/dist/content/content.repository.d.ts.map +1 -1
- package/dist/content/content.repository.js +62 -0
- package/dist/content/deletion-ledger.d.ts +39 -0
- package/dist/content/deletion-ledger.d.ts.map +1 -0
- package/dist/content/deletion-ledger.js +3 -0
- package/dist/content/seed-media-purge.repository.d.ts +34 -0
- package/dist/content/seed-media-purge.repository.d.ts.map +1 -0
- package/dist/content/seed-media-purge.repository.js +3 -0
- package/dist/content/seed.repository.d.ts +14 -0
- package/dist/content/seed.repository.d.ts.map +1 -1
- package/dist/content-scan.repository.d.ts +9 -0
- package/dist/content-scan.repository.d.ts.map +1 -0
- package/dist/content-scan.repository.js +3 -0
- package/dist/content.repository.d.ts +247 -0
- package/dist/content.repository.d.ts.map +1 -0
- package/dist/content.repository.js +59 -0
- package/dist/dashboard-layout/content-view.d.ts +757 -0
- package/dist/dashboard-layout/content-view.d.ts.map +1 -0
- package/dist/dashboard-layout/content-view.js +285 -0
- package/dist/dashboard-layout/content-view.repository.d.ts +39 -0
- package/dist/dashboard-layout/content-view.repository.d.ts.map +1 -0
- package/dist/dashboard-layout/content-view.repository.js +3 -0
- package/dist/dashboard-layout/dashboard-layout.d.ts +5 -0
- package/dist/dashboard-layout/dashboard-layout.d.ts.map +1 -1
- package/dist/dashboard-layout/dashboard-layout.js +17 -9
- package/dist/dashboard-layout/kanban/kanban.d.ts +32 -18
- package/dist/dashboard-layout/kanban/kanban.d.ts.map +1 -1
- package/dist/dashboard-layout/kanban/kanban.js +45 -21
- package/dist/dashboard-layout/seed-layout.d.ts +22 -31
- package/dist/dashboard-layout/seed-layout.d.ts.map +1 -1
- package/dist/dashboard-layout/seed-layout.js +93 -18
- package/dist/dashboard-layout/seed-layout.repository.d.ts +1 -5
- package/dist/dashboard-layout/seed-layout.repository.d.ts.map +1 -1
- package/dist/dashboard-layout.d.ts +154 -0
- package/dist/dashboard-layout.d.ts.map +1 -0
- package/dist/dashboard-layout.js +186 -0
- package/dist/dashboard-layout.repository.d.ts +18 -0
- package/dist/dashboard-layout.repository.d.ts.map +1 -0
- package/dist/dashboard-layout.repository.js +3 -0
- package/dist/dashboard-permissions.d.ts +3 -0
- package/dist/dashboard-permissions.d.ts.map +1 -0
- package/dist/dashboard-permissions.js +11 -0
- package/dist/dashboard-scopes.d.ts +12 -0
- package/dist/dashboard-scopes.d.ts.map +1 -0
- package/dist/dashboard-scopes.js +30 -0
- package/dist/define-seed.d.ts +3 -0
- package/dist/define-seed.d.ts.map +1 -0
- package/dist/define-seed.js +5 -0
- package/dist/demo-data.repository.d.ts +5 -0
- package/dist/demo-data.repository.d.ts.map +1 -0
- package/dist/demo-data.repository.js +3 -0
- package/dist/email.provider.d.ts +32 -0
- package/dist/email.provider.d.ts.map +1 -0
- package/dist/email.provider.js +4 -0
- package/dist/engine/ddl/ddl.d.ts +247 -0
- package/dist/engine/ddl/ddl.d.ts.map +1 -0
- package/dist/engine/ddl/ddl.js +653 -0
- package/dist/engine/ddl/schema-mutator.d.ts +29 -0
- package/dist/engine/ddl/schema-mutator.d.ts.map +1 -0
- package/dist/engine/ddl/schema-mutator.js +3 -0
- package/dist/engine/ddl/seed-ddl-destructive.d.ts +40 -0
- package/dist/engine/ddl/seed-ddl-destructive.d.ts.map +1 -0
- package/dist/engine/ddl/seed-ddl-destructive.js +149 -0
- package/dist/engine/ddl/seed-ddl.d.ts +43 -0
- package/dist/engine/ddl/seed-ddl.d.ts.map +1 -0
- package/dist/engine/ddl/seed-ddl.js +115 -0
- package/dist/engine/ddl/seed-purge-guards.d.ts +7 -0
- package/dist/engine/ddl/seed-purge-guards.d.ts.map +1 -0
- package/dist/engine/ddl/seed-purge-guards.js +19 -0
- package/dist/engine/engine.d.ts +4 -3
- package/dist/engine/engine.d.ts.map +1 -1
- package/dist/engine/engine.js +4 -3
- package/dist/engine/introspection/introspection.d.ts +101 -0
- package/dist/engine/introspection/introspection.d.ts.map +1 -0
- package/dist/engine/introspection/introspection.js +127 -0
- package/dist/engine/introspection/relation-audit.d.ts +46 -0
- package/dist/engine/introspection/relation-audit.d.ts.map +1 -0
- package/dist/engine/introspection/relation-audit.js +103 -0
- package/dist/engine/introspection/schema-fingerprint.d.ts +74 -0
- package/dist/engine/introspection/schema-fingerprint.d.ts.map +1 -0
- package/dist/engine/introspection/schema-fingerprint.js +102 -0
- package/dist/engine/introspection.d.ts +101 -0
- package/dist/engine/introspection.d.ts.map +1 -0
- package/dist/engine/introspection.js +127 -0
- package/dist/engine/localization/localization.d.ts +127 -0
- package/dist/engine/localization/localization.d.ts.map +1 -0
- package/dist/engine/localization/localization.js +212 -0
- package/dist/engine/localization.d.ts +127 -0
- package/dist/engine/localization.d.ts.map +1 -0
- package/dist/engine/localization.js +212 -0
- package/dist/engine/privacy/policies.d.ts +58 -0
- package/dist/engine/privacy/policies.d.ts.map +1 -0
- package/dist/engine/privacy/policies.js +191 -0
- package/dist/engine/privacy/privacy.service.d.ts +78 -0
- package/dist/engine/privacy/privacy.service.d.ts.map +1 -0
- package/dist/engine/privacy/privacy.service.js +138 -0
- package/dist/engine/privacy.service.d.ts.map +1 -1
- package/dist/engine/query/active-clause.d.ts +19 -0
- package/dist/engine/query/active-clause.d.ts.map +1 -0
- package/dist/engine/query/active-clause.js +27 -0
- package/dist/engine/query/query.d.ts +36 -0
- package/dist/engine/query/query.d.ts.map +1 -0
- package/dist/engine/query/query.js +393 -0
- package/dist/engine/query/relations.d.ts +28 -0
- package/dist/engine/query/relations.d.ts.map +1 -0
- package/dist/engine/query/relations.js +25 -0
- package/dist/engine/query/serialize.d.ts +22 -0
- package/dist/engine/query/serialize.d.ts.map +1 -0
- package/dist/engine/query/serialize.js +175 -0
- package/dist/engine/schema-fingerprint.d.ts +73 -0
- package/dist/engine/schema-fingerprint.d.ts.map +1 -0
- package/dist/engine/schema-fingerprint.js +97 -0
- package/dist/engine/seed-registry.d.ts.map +1 -1
- package/dist/engine/seeds/candidate-ids.d.ts +14 -0
- package/dist/engine/seeds/candidate-ids.d.ts.map +1 -0
- package/dist/engine/seeds/candidate-ids.js +40 -0
- package/dist/engine/seeds/define-seed.d.ts +3 -0
- package/dist/engine/seeds/define-seed.d.ts.map +1 -0
- package/dist/engine/seeds/define-seed.js +5 -0
- package/dist/engine/seeds/seed-definition-diff.d.ts +38 -0
- package/dist/engine/seeds/seed-definition-diff.d.ts.map +1 -0
- package/dist/engine/seeds/seed-definition-diff.js +51 -0
- package/dist/engine/seeds/seed-registry.d.ts +88 -0
- package/dist/engine/seeds/seed-registry.d.ts.map +1 -0
- package/dist/engine/seeds/seed-registry.js +194 -0
- package/dist/engine/seeds/seed-types-generator.d.ts +25 -0
- package/dist/engine/seeds/seed-types-generator.d.ts.map +1 -0
- package/dist/engine/seeds/seed-types-generator.js +116 -0
- package/dist/engine/seeds/seed-validation.d.ts +35 -0
- package/dist/engine/seeds/seed-validation.d.ts.map +1 -0
- package/dist/engine/seeds/seed-validation.js +384 -0
- package/dist/engine/seeds/seeds.d.ts +20 -0
- package/dist/engine/seeds/seeds.d.ts.map +1 -0
- package/dist/engine/seeds/seeds.js +21 -0
- package/dist/engine/seeds/tag-migration.d.ts +73 -0
- package/dist/engine/seeds/tag-migration.d.ts.map +1 -0
- package/dist/engine/seeds/tag-migration.js +212 -0
- package/dist/engine/seeds/tag-options.d.ts +15 -0
- package/dist/engine/seeds/tag-options.d.ts.map +1 -0
- package/dist/engine/seeds/tag-options.js +111 -0
- package/dist/engine/seeds/tag-value.d.ts +31 -0
- package/dist/engine/seeds/tag-value.d.ts.map +1 -0
- package/dist/engine/seeds/tag-value.js +51 -0
- package/dist/engine/types.d.ts +59 -7
- package/dist/engine/types.d.ts.map +1 -1
- package/dist/engine/validation/cache.d.ts.map +1 -1
- package/dist/engine/validation/cache.js +20 -4
- package/dist/engine/validation/emptiness.d.ts +12 -0
- package/dist/engine/validation/emptiness.d.ts.map +1 -0
- package/dist/engine/validation/emptiness.js +33 -0
- package/dist/engine/validation/index.d.ts +11 -0
- package/dist/engine/validation/index.d.ts.map +1 -1
- package/dist/engine/validation/index.js +29 -33
- package/dist/engine/validation/primitives.d.ts +12 -0
- package/dist/engine/validation/primitives.d.ts.map +1 -1
- package/dist/engine/validation/primitives.js +22 -0
- package/dist/engine/validation/richtext-sanitizer.d.ts +9 -1
- package/dist/engine/validation/richtext-sanitizer.d.ts.map +1 -1
- package/dist/engine/validation/richtext-sanitizer.js +36 -7
- package/dist/engine/validation/schema-builders.d.ts +16 -0
- package/dist/engine/validation/schema-builders.d.ts.map +1 -1
- package/dist/engine/validation/schema-builders.js +125 -18
- package/dist/engine.d.ts +144 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +741 -0
- package/dist/file-types.d.ts +13 -0
- package/dist/file-types.d.ts.map +1 -0
- package/dist/file-types.js +85 -0
- package/dist/hooks.d.ts +29 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +3 -0
- package/dist/id-generator.d.ts +26 -0
- package/dist/id-generator.d.ts.map +1 -0
- package/dist/id-generator.js +12 -0
- package/dist/idempotency.repository.d.ts +13 -0
- package/dist/idempotency.repository.d.ts.map +1 -0
- package/dist/idempotency.repository.js +3 -0
- package/dist/index.d.ts +34 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -11
- package/dist/kanban-position.repository.d.ts +19 -0
- package/dist/kanban-position.repository.d.ts.map +1 -0
- package/dist/kanban-position.repository.js +3 -0
- package/dist/kanban.d.ts +75 -0
- package/dist/kanban.d.ts.map +1 -0
- package/dist/kanban.js +82 -0
- package/dist/layout-permissions.d.ts +3 -0
- package/dist/layout-permissions.d.ts.map +1 -0
- package/dist/layout-permissions.js +11 -0
- package/dist/media/file-types.d.ts +12 -0
- package/dist/media/file-types.d.ts.map +1 -1
- package/dist/media/file-types.js +24 -4
- package/dist/media/image-transformer.d.ts +34 -0
- package/dist/media/image-transformer.d.ts.map +1 -0
- package/dist/media/image-transformer.js +3 -0
- package/dist/media/magic-bytes.d.ts.map +1 -1
- package/dist/media/magic-bytes.js +19 -9
- package/dist/media/media-transform.d.ts +92 -0
- package/dist/media/media-transform.d.ts.map +1 -0
- package/dist/media/media-transform.js +197 -0
- package/dist/media/media.repository.d.ts +5 -0
- package/dist/media/media.repository.d.ts.map +1 -1
- package/dist/media.repository.d.ts +61 -0
- package/dist/media.repository.d.ts.map +1 -0
- package/dist/media.repository.js +3 -0
- package/dist/notifications/notification.repository.d.ts +11 -2
- package/dist/notifications/notification.repository.d.ts.map +1 -1
- package/dist/oauth/authorization-code.repository.d.ts +10 -5
- package/dist/oauth/authorization-code.repository.d.ts.map +1 -1
- package/dist/oauth/role-guard.d.ts +30 -11
- package/dist/oauth/role-guard.d.ts.map +1 -1
- package/dist/oauth/role-guard.js +27 -5
- package/dist/oauth/token.repository.d.ts +2 -0
- package/dist/oauth/token.repository.d.ts.map +1 -1
- package/dist/policies.d.ts +10 -0
- package/dist/policies.d.ts.map +1 -0
- package/dist/policies.js +33 -0
- package/dist/queue/queue.interface.d.ts +9 -1
- package/dist/queue/queue.interface.d.ts.map +1 -1
- package/dist/queue/queue.stub.d.ts +1 -1
- package/dist/queue/queue.stub.d.ts.map +1 -1
- package/dist/queue/queue.stub.js +2 -3
- package/dist/queue.interface.d.ts +39 -0
- package/dist/queue.interface.d.ts.map +1 -0
- package/dist/queue.interface.js +3 -0
- package/dist/queue.stub.d.ts +6 -0
- package/dist/queue.stub.d.ts.map +1 -0
- package/dist/queue.stub.js +8 -0
- package/dist/rate-limit/token-bucket-rate-limiter.d.ts +7 -0
- package/dist/rate-limit/token-bucket-rate-limiter.d.ts.map +1 -1
- package/dist/rate-limit/token-bucket-rate-limiter.js +66 -0
- package/dist/rbac/evaluate.d.ts +57 -0
- package/dist/rbac/evaluate.d.ts.map +1 -0
- package/dist/rbac/evaluate.js +113 -0
- package/dist/rbac/invitation.repository.d.ts +84 -0
- package/dist/rbac/invitation.repository.d.ts.map +1 -0
- package/dist/rbac/invitation.repository.js +3 -0
- package/dist/rbac/permissions.d.ts +39 -0
- package/dist/rbac/permissions.d.ts.map +1 -0
- package/dist/rbac/permissions.js +43 -0
- package/dist/rbac/types.d.ts +130 -0
- package/dist/rbac/types.d.ts.map +1 -0
- package/dist/rbac/types.js +4 -0
- package/dist/relations.d.ts +28 -0
- package/dist/relations.d.ts.map +1 -0
- package/dist/relations.js +25 -0
- package/dist/richtext-render.d.ts +11 -0
- package/dist/richtext-render.d.ts.map +1 -0
- package/dist/richtext-render.js +87 -0
- package/dist/richtext.d.ts +11 -0
- package/dist/richtext.d.ts.map +1 -0
- package/dist/richtext.js +13 -0
- package/dist/scheduler.interface.d.ts +4 -0
- package/dist/scheduler.interface.d.ts.map +1 -0
- package/dist/scheduler.interface.js +3 -0
- package/dist/scheduler.stub.d.ts +5 -0
- package/dist/scheduler.stub.d.ts.map +1 -0
- package/dist/scheduler.stub.js +7 -0
- package/dist/schema/canonical.d.ts +15 -0
- package/dist/schema/canonical.d.ts.map +1 -0
- package/dist/schema/canonical.js +37 -0
- package/dist/schema/define.d.ts +42 -0
- package/dist/schema/define.d.ts.map +1 -0
- package/dist/schema/define.js +56 -0
- package/dist/schema/emit.d.ts +14 -0
- package/dist/schema/emit.d.ts.map +1 -0
- package/dist/schema/emit.js +43 -0
- package/dist/schema/index.d.ts +12 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +13 -0
- package/dist/schema/manifest-seeds.d.ts +12 -0
- package/dist/schema/manifest-seeds.d.ts.map +1 -0
- package/dist/schema/manifest-seeds.js +48 -0
- package/dist/schema/manifest-validation.d.ts +13 -0
- package/dist/schema/manifest-validation.d.ts.map +1 -0
- package/dist/schema/manifest-validation.js +41 -0
- package/dist/schema/manifest.types.d.ts +54 -0
- package/dist/schema/manifest.types.d.ts.map +1 -0
- package/dist/schema/manifest.types.js +7 -0
- package/dist/schema-mutator.d.ts +26 -0
- package/dist/schema-mutator.d.ts.map +1 -0
- package/dist/schema-mutator.js +3 -0
- package/dist/search/search.repository.d.ts +5 -4
- package/dist/search/search.repository.d.ts.map +1 -1
- package/dist/search/vector-extractor.d.ts.map +1 -1
- package/dist/search/vector-extractor.js +23 -2
- package/dist/search/vector.repository.d.ts +2 -1
- package/dist/search/vector.repository.d.ts.map +1 -1
- package/dist/security/time-trap-token.repository.d.ts +5 -3
- package/dist/security/time-trap-token.repository.d.ts.map +1 -1
- package/dist/seed-ddl-destructive.d.ts +40 -0
- package/dist/seed-ddl-destructive.d.ts.map +1 -0
- package/dist/seed-ddl-destructive.js +149 -0
- package/dist/seed-ddl.d.ts +40 -0
- package/dist/seed-ddl.d.ts.map +1 -0
- package/dist/seed-ddl.js +100 -0
- package/dist/seed-layout.d.ts +145 -0
- package/dist/seed-layout.d.ts.map +1 -0
- package/dist/seed-layout.js +192 -0
- package/dist/seed-layout.repository.d.ts +22 -0
- package/dist/seed-layout.repository.d.ts.map +1 -0
- package/dist/seed-layout.repository.js +3 -0
- package/dist/seed-registry.d.ts +71 -0
- package/dist/seed-registry.d.ts.map +1 -0
- package/dist/seed-registry.js +143 -0
- package/dist/seed-types-generator.d.ts +1 -1
- package/dist/seed-types-generator.d.ts.map +1 -1
- package/dist/seed-validation.d.ts +23 -0
- package/dist/seed-validation.d.ts.map +1 -0
- package/dist/seed-validation.js +224 -0
- package/dist/seed.repository.d.ts +37 -0
- package/dist/seed.repository.d.ts.map +1 -0
- package/dist/seed.repository.js +3 -0
- package/dist/seeds.d.ts +20 -0
- package/dist/seeds.d.ts.map +1 -0
- package/dist/seeds.js +21 -0
- package/dist/settings/site-settings.repository.d.ts +8 -0
- package/dist/settings/site-settings.repository.d.ts.map +1 -1
- package/dist/site-settings.repository.d.ts +16 -0
- package/dist/site-settings.repository.d.ts.map +1 -0
- package/dist/site-settings.repository.js +3 -0
- package/dist/slug-utils.d.ts +18 -0
- package/dist/slug-utils.d.ts.map +1 -0
- package/dist/slug-utils.js +32 -0
- package/dist/storage.d.ts +46 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +3 -0
- package/dist/transfer/csv.d.ts +34 -0
- package/dist/transfer/csv.d.ts.map +1 -0
- package/dist/transfer/csv.js +135 -0
- package/dist/transfer/flat-seed.d.ts +13 -0
- package/dist/transfer/flat-seed.d.ts.map +1 -0
- package/dist/transfer/flat-seed.js +50 -0
- package/dist/transfer/index.d.ts +7 -0
- package/dist/transfer/index.d.ts.map +1 -0
- package/dist/transfer/index.js +8 -0
- package/dist/transfer/ndjson.d.ts +25 -0
- package/dist/transfer/ndjson.d.ts.map +1 -0
- package/dist/transfer/ndjson.js +62 -0
- package/dist/transfer/row-mapping.d.ts +36 -0
- package/dist/transfer/row-mapping.d.ts.map +1 -0
- package/dist/transfer/row-mapping.js +97 -0
- package/dist/transfer/transfer.constants.d.ts +20 -0
- package/dist/transfer/transfer.constants.d.ts.map +1 -0
- package/dist/transfer/transfer.constants.js +21 -0
- package/dist/transfer/transfer.types.d.ts +46 -0
- package/dist/transfer/transfer.types.d.ts.map +1 -0
- package/dist/transfer/transfer.types.js +6 -0
- package/dist/types.d.ts +243 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/validation.d.ts +50 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +660 -0
- package/dist/webhook-validation.d.ts +3 -0
- package/dist/webhook-validation.d.ts.map +1 -0
- package/dist/webhook-validation.js +6 -0
- package/package.json +11 -6
- package/dist/.tsbuildinfo +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Branch, Seed } from '../engine/types.js';
|
|
2
|
+
import type { FormatCompatibility, TransferFormat } from './transfer.types.js';
|
|
3
|
+
/** Every branch of `seed` that makes it non-flat, in declaration order. Empty when flat. */
|
|
4
|
+
export declare function nonFlatBranches(seed: Seed): Branch[];
|
|
5
|
+
/** A seed is flat when every branch maps to exactly one scalar column. */
|
|
6
|
+
export declare function isFlatSeed(seed: Seed): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* The single authority on "may this seed be transferred in this format?", shared by the
|
|
9
|
+
* export endpoint and the import endpoint so the two can never disagree.
|
|
10
|
+
* NDJSON is universal; CSV requires a flat seed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function checkFormatCompatibility(seed: Seed, format: TransferFormat): FormatCompatibility;
|
|
13
|
+
//# sourceMappingURL=flat-seed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flat-seed.d.ts","sourceRoot":"","sources":["../../src/transfer/flat-seed.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAc,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAGlE,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAuB9E,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,CAEpD;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,cAAc,GACrB,mBAAmB,CAWrB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
import { isAssetListBranch } from '../engine/validation/file-branch.js';
|
|
4
|
+
import { isLocalizedBranch } from '../engine/localization/localization.js';
|
|
5
|
+
/**
|
|
6
|
+
* Branch types whose value is a collection or a nested document, never a scalar cell.
|
|
7
|
+
* A CSV cell cannot carry them without inventing a flattening convention that the
|
|
8
|
+
* importer would then have to guess at — which the brief rules out (§5).
|
|
9
|
+
*/
|
|
10
|
+
const NON_FLAT_BRANCH_TYPES = new Set([
|
|
11
|
+
'relation',
|
|
12
|
+
'repeater',
|
|
13
|
+
'tags',
|
|
14
|
+
'json',
|
|
15
|
+
'richtext',
|
|
16
|
+
]);
|
|
17
|
+
/** True for a branch that cannot be represented as a single scalar CSV cell. */
|
|
18
|
+
function isNonFlat(branch) {
|
|
19
|
+
if (isLocalizedBranch(branch))
|
|
20
|
+
return true;
|
|
21
|
+
// A `file` branch is a single URL string — flat — unless it is an asset list.
|
|
22
|
+
if (branch.type === 'file')
|
|
23
|
+
return isAssetListBranch(branch);
|
|
24
|
+
return NON_FLAT_BRANCH_TYPES.has(branch.type);
|
|
25
|
+
}
|
|
26
|
+
/** Every branch of `seed` that makes it non-flat, in declaration order. Empty when flat. */
|
|
27
|
+
export function nonFlatBranches(seed) {
|
|
28
|
+
return seed.branches.filter(isNonFlat);
|
|
29
|
+
}
|
|
30
|
+
/** A seed is flat when every branch maps to exactly one scalar column. */
|
|
31
|
+
export function isFlatSeed(seed) {
|
|
32
|
+
return nonFlatBranches(seed).length === 0;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The single authority on "may this seed be transferred in this format?", shared by the
|
|
36
|
+
* export endpoint and the import endpoint so the two can never disagree.
|
|
37
|
+
* NDJSON is universal; CSV requires a flat seed.
|
|
38
|
+
*/
|
|
39
|
+
export function checkFormatCompatibility(seed, format) {
|
|
40
|
+
if (format === 'ndjson')
|
|
41
|
+
return { compatible: true };
|
|
42
|
+
const offenders = nonFlatBranches(seed);
|
|
43
|
+
if (offenders.length === 0)
|
|
44
|
+
return { compatible: true };
|
|
45
|
+
return {
|
|
46
|
+
compatible: false,
|
|
47
|
+
code: 'csv_requires_flat_seed',
|
|
48
|
+
offendingBranches: offenders.map((branch) => ({ alias: branch.alias, type: branch.type })),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transfer/index.ts"],"names":[],"mappings":"AAGA,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
export * from './transfer.types.js';
|
|
4
|
+
export * from './transfer.constants.js';
|
|
5
|
+
export * from './flat-seed.js';
|
|
6
|
+
export * from './ndjson.js';
|
|
7
|
+
export * from './csv.js';
|
|
8
|
+
export * from './row-mapping.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LineParseResult, TransferRecord } from './transfer.types.js';
|
|
2
|
+
/** Serialises one record as an NDJSON line, terminator included. */
|
|
3
|
+
export declare function encodeNdjsonLine(record: TransferRecord): string;
|
|
4
|
+
/**
|
|
5
|
+
* Decodes one NDJSON line. Never throws: a malformed line is a failed row in the job
|
|
6
|
+
* report, not an aborted import (brief §2 — best-effort, not atomic).
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseNdjsonLine(line: string): LineParseResult;
|
|
9
|
+
/**
|
|
10
|
+
* Splits an arbitrarily-chunked text stream into complete lines, holding the trailing
|
|
11
|
+
* partial line until the next chunk completes it. Stateful by necessity: a single
|
|
12
|
+
* R2 read boundary may fall in the middle of a record, and an import that lost that
|
|
13
|
+
* record would report a phantom failed row.
|
|
14
|
+
*
|
|
15
|
+
* Blank lines are dropped — a trailing newline at end of file is not a record.
|
|
16
|
+
*/
|
|
17
|
+
export declare class LineReader {
|
|
18
|
+
private buffer;
|
|
19
|
+
private sawFirstChunk;
|
|
20
|
+
/** Feeds a chunk and returns every line completed by it. */
|
|
21
|
+
push(chunk: string): string[];
|
|
22
|
+
/** Flushes the trailing line of a file that does not end in a newline. */
|
|
23
|
+
end(): string[];
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ndjson.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ndjson.d.ts","sourceRoot":"","sources":["../../src/transfer/ndjson.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAE1E,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAE/D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAiB7D;AAID;;;;;;;GAOG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,aAAa,CAAQ;IAE7B,4DAA4D;IAC5D,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAa7B,0EAA0E;IAC1E,GAAG,IAAI,MAAM,EAAE;CAKhB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
/** Serialises one record as an NDJSON line, terminator included. */
|
|
4
|
+
export function encodeNdjsonLine(record) {
|
|
5
|
+
return `${JSON.stringify(record)}\n`;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Decodes one NDJSON line. Never throws: a malformed line is a failed row in the job
|
|
9
|
+
* report, not an aborted import (brief §2 — best-effort, not atomic).
|
|
10
|
+
*/
|
|
11
|
+
export function parseNdjsonLine(line) {
|
|
12
|
+
let parsed;
|
|
13
|
+
try {
|
|
14
|
+
parsed = JSON.parse(line);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return {
|
|
18
|
+
ok: false,
|
|
19
|
+
code: 'invalid_json',
|
|
20
|
+
message: error instanceof Error ? error.message : 'Malformed JSON',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
24
|
+
return { ok: false, code: 'not_an_object', message: 'Line is not a JSON object' };
|
|
25
|
+
}
|
|
26
|
+
return { ok: true, record: parsed };
|
|
27
|
+
}
|
|
28
|
+
const BYTE_ORDER_MARK = '\uFEFF';
|
|
29
|
+
/**
|
|
30
|
+
* Splits an arbitrarily-chunked text stream into complete lines, holding the trailing
|
|
31
|
+
* partial line until the next chunk completes it. Stateful by necessity: a single
|
|
32
|
+
* R2 read boundary may fall in the middle of a record, and an import that lost that
|
|
33
|
+
* record would report a phantom failed row.
|
|
34
|
+
*
|
|
35
|
+
* Blank lines are dropped — a trailing newline at end of file is not a record.
|
|
36
|
+
*/
|
|
37
|
+
export class LineReader {
|
|
38
|
+
buffer = '';
|
|
39
|
+
sawFirstChunk = false;
|
|
40
|
+
/** Feeds a chunk and returns every line completed by it. */
|
|
41
|
+
push(chunk) {
|
|
42
|
+
let text = chunk;
|
|
43
|
+
if (!this.sawFirstChunk) {
|
|
44
|
+
this.sawFirstChunk = true;
|
|
45
|
+
if (text.startsWith(BYTE_ORDER_MARK))
|
|
46
|
+
text = text.slice(BYTE_ORDER_MARK.length);
|
|
47
|
+
}
|
|
48
|
+
this.buffer += text;
|
|
49
|
+
const parts = this.buffer.split('\n');
|
|
50
|
+
this.buffer = parts.pop() ?? '';
|
|
51
|
+
return parts.map(stripCarriageReturn).filter((line) => line.length > 0);
|
|
52
|
+
}
|
|
53
|
+
/** Flushes the trailing line of a file that does not end in a newline. */
|
|
54
|
+
end() {
|
|
55
|
+
const remainder = stripCarriageReturn(this.buffer);
|
|
56
|
+
this.buffer = '';
|
|
57
|
+
return remainder.length > 0 ? [remainder] : [];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function stripCarriageReturn(line) {
|
|
61
|
+
return line.endsWith('\r') ? line.slice(0, -1) : line;
|
|
62
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Seed } from '../engine/types.js';
|
|
2
|
+
import type { ImportPayload, LineParseResult, TransferRecord } from './transfer.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* System columns exported for every seed, in this order, ahead of the branch columns.
|
|
5
|
+
* `deleted_at` is deliberately absent: a trashed row is not exportable content, and the
|
|
6
|
+
* repository's default `trashed: 'active'` mode never hands one to the producer anyway.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EXPORT_SYSTEM_COLUMNS: readonly ["id", "slug", "status", "created_at", "updated_at"];
|
|
9
|
+
/**
|
|
10
|
+
* The ordered column projection for exporting `seed`: system columns, then one column per
|
|
11
|
+
* scalar branch in declaration order. Non-flat branches are omitted — this projection is
|
|
12
|
+
* only ever used for CSV, and `checkFormatCompatibility` has already refused a seed that
|
|
13
|
+
* has any. NDJSON export emits the record whole and does not call this.
|
|
14
|
+
*/
|
|
15
|
+
export declare function exportColumns(seed: Seed): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Projects an API-shaped record onto `columns` as CSV cells.
|
|
18
|
+
* `null`/`undefined` become an empty field; booleans become `true`/`false`; everything else
|
|
19
|
+
* is stringified. The record is expected to have already passed through `dbToApi`, so a
|
|
20
|
+
* `date` branch arrives as a number and is written as its unix-seconds integer.
|
|
21
|
+
*/
|
|
22
|
+
export declare function toCsvCells(record: TransferRecord, columns: string[]): Array<string | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Rebuilds a record from a CSV row. An empty cell is treated as ABSENT, not as null:
|
|
25
|
+
* CSV cannot distinguish the two, and omitting the key lets the engine's own
|
|
26
|
+
* required-field validation produce the error instead of this module guessing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function fromCsvCells(columns: string[], cells: string[]): LineParseResult;
|
|
29
|
+
/**
|
|
30
|
+
* Splits a decoded record into the shape `ContentRepository.create` consumes, dropping the
|
|
31
|
+
* engine-owned columns. Returns `data` WITHOUT `slug`/`status`, mirroring
|
|
32
|
+
* `apps/api/src/features/content/handlers/create.ts:68-70`, so the import consumer can feed
|
|
33
|
+
* `data` straight to `validateAndSanitizeSeedPayload` without re-filtering.
|
|
34
|
+
*/
|
|
35
|
+
export declare function toImportPayload(record: TransferRecord): ImportPayload;
|
|
36
|
+
//# sourceMappingURL=row-mapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-mapping.d.ts","sourceRoot":"","sources":["../../src/transfer/row-mapping.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,+DAAgE,CAAA;AAclG;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,CAMlD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAU1F;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,eAAe,CAiBhF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,aAAa,CAarE"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
import { nonFlatBranches } from './flat-seed.js';
|
|
4
|
+
/**
|
|
5
|
+
* System columns exported for every seed, in this order, ahead of the branch columns.
|
|
6
|
+
* `deleted_at` is deliberately absent: a trashed row is not exportable content, and the
|
|
7
|
+
* repository's default `trashed: 'active'` mode never hands one to the producer anyway.
|
|
8
|
+
*/
|
|
9
|
+
export const EXPORT_SYSTEM_COLUMNS = ['id', 'slug', 'status', 'created_at', 'updated_at'];
|
|
10
|
+
/**
|
|
11
|
+
* Columns the importer must never accept from a file: the engine owns them.
|
|
12
|
+
* `id` is minted by `idGenerator.uuid()`, the timestamps by SQLite defaults. Accepting an
|
|
13
|
+
* `id` from a file would also turn insert-only import (brief §2) into a covert upsert.
|
|
14
|
+
*/
|
|
15
|
+
const IMPORT_REJECTED_COLUMNS = new Set([
|
|
16
|
+
'id',
|
|
17
|
+
'created_at',
|
|
18
|
+
'updated_at',
|
|
19
|
+
'deleted_at',
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
* The ordered column projection for exporting `seed`: system columns, then one column per
|
|
23
|
+
* scalar branch in declaration order. Non-flat branches are omitted — this projection is
|
|
24
|
+
* only ever used for CSV, and `checkFormatCompatibility` has already refused a seed that
|
|
25
|
+
* has any. NDJSON export emits the record whole and does not call this.
|
|
26
|
+
*/
|
|
27
|
+
export function exportColumns(seed) {
|
|
28
|
+
const excluded = new Set(nonFlatBranches(seed).map((branch) => branch.alias));
|
|
29
|
+
return [
|
|
30
|
+
...EXPORT_SYSTEM_COLUMNS,
|
|
31
|
+
...seed.branches.map((branch) => branch.alias).filter((alias) => !excluded.has(alias)),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Projects an API-shaped record onto `columns` as CSV cells.
|
|
36
|
+
* `null`/`undefined` become an empty field; booleans become `true`/`false`; everything else
|
|
37
|
+
* is stringified. The record is expected to have already passed through `dbToApi`, so a
|
|
38
|
+
* `date` branch arrives as a number and is written as its unix-seconds integer.
|
|
39
|
+
*/
|
|
40
|
+
export function toCsvCells(record, columns) {
|
|
41
|
+
return columns.map((column) => {
|
|
42
|
+
const value = record[column];
|
|
43
|
+
if (value === null || value === undefined)
|
|
44
|
+
return null;
|
|
45
|
+
if (typeof value === 'boolean')
|
|
46
|
+
return value ? 'true' : 'false';
|
|
47
|
+
if (typeof value === 'object') {
|
|
48
|
+
throw new TypeError(`Cannot serialize non-scalar value for column "${column}" to CSV cell`);
|
|
49
|
+
}
|
|
50
|
+
return String(value);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Rebuilds a record from a CSV row. An empty cell is treated as ABSENT, not as null:
|
|
55
|
+
* CSV cannot distinguish the two, and omitting the key lets the engine's own
|
|
56
|
+
* required-field validation produce the error instead of this module guessing.
|
|
57
|
+
*/
|
|
58
|
+
export function fromCsvCells(columns, cells) {
|
|
59
|
+
if (cells.length !== columns.length) {
|
|
60
|
+
return {
|
|
61
|
+
ok: false,
|
|
62
|
+
code: 'column_count_mismatch',
|
|
63
|
+
message: `Expected ${columns.length} columns, received ${cells.length}`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const record = Object.create(null);
|
|
67
|
+
for (const [index, column] of columns.entries()) {
|
|
68
|
+
if (column === '__proto__' || column === 'constructor' || column === 'prototype')
|
|
69
|
+
continue;
|
|
70
|
+
const cell = cells[index] ?? '';
|
|
71
|
+
if (cell === '')
|
|
72
|
+
continue;
|
|
73
|
+
record[column] = cell;
|
|
74
|
+
}
|
|
75
|
+
return { ok: true, record };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Splits a decoded record into the shape `ContentRepository.create` consumes, dropping the
|
|
79
|
+
* engine-owned columns. Returns `data` WITHOUT `slug`/`status`, mirroring
|
|
80
|
+
* `apps/api/src/features/content/handlers/create.ts:68-70`, so the import consumer can feed
|
|
81
|
+
* `data` straight to `validateAndSanitizeSeedPayload` without re-filtering.
|
|
82
|
+
*/
|
|
83
|
+
export function toImportPayload(record) {
|
|
84
|
+
const data = Object.create(null);
|
|
85
|
+
for (const [key, value] of Object.entries(record)) {
|
|
86
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype')
|
|
87
|
+
continue;
|
|
88
|
+
if (IMPORT_REJECTED_COLUMNS.has(key))
|
|
89
|
+
continue;
|
|
90
|
+
if (key === 'slug' || key === 'status')
|
|
91
|
+
continue;
|
|
92
|
+
data[key] = value;
|
|
93
|
+
}
|
|
94
|
+
const slug = typeof record['slug'] === 'string' && record['slug'] !== '' ? record['slug'] : undefined;
|
|
95
|
+
const status = typeof record['status'] === 'string' && record['status'] !== '' ? record['status'] : undefined;
|
|
96
|
+
return { ...(slug ? { slug } : {}), ...(status ? { status } : {}), data };
|
|
97
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hard cap on rows a single synchronous export may stream (brief §2). Past this the
|
|
3
|
+
* endpoint answers 413 rather than opening a stream that the edge may truncate mid-file.
|
|
4
|
+
* Overridable per deployment by the API layer (S2) — this is the default, not the law.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_EXPORT_MAX_ROWS = 50000;
|
|
7
|
+
/** Page size for the export producer's findMany loop. Never materialise the full set. */
|
|
8
|
+
export declare const DEFAULT_EXPORT_PAGE_SIZE = 500;
|
|
9
|
+
/**
|
|
10
|
+
* Rows an import consumer processes per queue invocation before persisting its offset
|
|
11
|
+
* and re-enqueuing (brief §2). Sized well under the Workers CPU budget so a chunk that
|
|
12
|
+
* retries repeats at most this many already-inserted rows.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_IMPORT_CHUNK_ROWS = 500;
|
|
15
|
+
/**
|
|
16
|
+
* Upper bound on per-row errors retained in a job report (brief §4). Beyond this only
|
|
17
|
+
* the aggregate failure count grows, so one pathological file cannot unbound the row.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MAX_JOB_ERROR_SAMPLES = 100;
|
|
20
|
+
//# sourceMappingURL=transfer.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.constants.d.ts","sourceRoot":"","sources":["../../src/transfer/transfer.constants.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,QAAS,CAAA;AAE7C,yFAAyF;AACzF,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAE3C;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAE5C;;;GAGG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2024–2026 Flavio De Musso
|
|
3
|
+
/**
|
|
4
|
+
* Hard cap on rows a single synchronous export may stream (brief §2). Past this the
|
|
5
|
+
* endpoint answers 413 rather than opening a stream that the edge may truncate mid-file.
|
|
6
|
+
* Overridable per deployment by the API layer (S2) — this is the default, not the law.
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_EXPORT_MAX_ROWS = 50_000;
|
|
9
|
+
/** Page size for the export producer's findMany loop. Never materialise the full set. */
|
|
10
|
+
export const DEFAULT_EXPORT_PAGE_SIZE = 500;
|
|
11
|
+
/**
|
|
12
|
+
* Rows an import consumer processes per queue invocation before persisting its offset
|
|
13
|
+
* and re-enqueuing (brief §2). Sized well under the Workers CPU budget so a chunk that
|
|
14
|
+
* retries repeats at most this many already-inserted rows.
|
|
15
|
+
*/
|
|
16
|
+
export const DEFAULT_IMPORT_CHUNK_ROWS = 500;
|
|
17
|
+
/**
|
|
18
|
+
* Upper bound on per-row errors retained in a job report (brief §4). Beyond this only
|
|
19
|
+
* the aggregate failure count grows, so one pathological file cannot unbound the row.
|
|
20
|
+
*/
|
|
21
|
+
export const MAX_JOB_ERROR_SAMPLES = 100;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Branch } from '../engine/types.js';
|
|
2
|
+
/** Wire formats supported for bulk transfer. NDJSON is universal; CSV is flat-only. */
|
|
3
|
+
export type TransferFormat = 'csv' | 'ndjson';
|
|
4
|
+
export declare const TRANSFER_FORMATS: readonly ["csv", "ndjson"];
|
|
5
|
+
export declare function isTransferFormat(value: unknown): value is TransferFormat;
|
|
6
|
+
/**
|
|
7
|
+
* Outcome of checking a requested format against a seed's shape.
|
|
8
|
+
* `offendingBranches` is non-empty only on the incompatible branch, and exists so the
|
|
9
|
+
* caller can name the exact fields in its 400 response instead of a generic message.
|
|
10
|
+
*/
|
|
11
|
+
export type FormatCompatibility = {
|
|
12
|
+
compatible: true;
|
|
13
|
+
} | {
|
|
14
|
+
compatible: false;
|
|
15
|
+
code: 'csv_requires_flat_seed';
|
|
16
|
+
offendingBranches: Array<{
|
|
17
|
+
alias: string;
|
|
18
|
+
type: Branch['type'];
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
/** A decoded wire row, keyed by branch alias / system column name. */
|
|
22
|
+
export type TransferRecord = Record<string, unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Per-line decode outcome. Import is best-effort (brief §2), so a bad line is a VALUE,
|
|
25
|
+
* never a thrown error — the consumer must record it in the job report and keep going.
|
|
26
|
+
*/
|
|
27
|
+
export type LineParseResult = {
|
|
28
|
+
ok: true;
|
|
29
|
+
record: TransferRecord;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
code: LineParseErrorCode;
|
|
33
|
+
message: string;
|
|
34
|
+
};
|
|
35
|
+
export type LineParseErrorCode = 'invalid_json' | 'not_an_object' | 'column_count_mismatch' | 'unterminated_quote';
|
|
36
|
+
/**
|
|
37
|
+
* A decoded row split into the three arguments `ContentRepository.create` takes.
|
|
38
|
+
* `slug` and `status` are optional: the caller supplies its own defaults
|
|
39
|
+
* (`create.ts` slugifies the display-name branch and defaults status to 'draft').
|
|
40
|
+
*/
|
|
41
|
+
export interface ImportPayload {
|
|
42
|
+
slug?: string;
|
|
43
|
+
status?: string;
|
|
44
|
+
data: TransferRecord;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=transfer.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.types.d.ts","sourceRoot":"","sources":["../../src/transfer/transfer.types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEhD,uFAAuF;AACvF,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,QAAQ,CAAA;AAE7C,eAAO,MAAM,gBAAgB,4BAAiE,CAAA;AAE9F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,UAAU,EAAE,IAAI,CAAA;CAAE,GACpB;IACE,UAAU,EAAE,KAAK,CAAA;IACjB,IAAI,EAAE,wBAAwB,CAAA;IAC9B,iBAAiB,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC,CAAA;CAClE,CAAA;AAEL,sEAAsE;AACtE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEpD;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GACpC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAE5D,MAAM,MAAM,kBAAkB,GAC1B,cAAc,GACd,eAAe,GACf,uBAAuB,GACvB,oBAAoB,CAAA;AAExB;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,cAAc,CAAA;CACrB"}
|