@cloudpdf/contract 3.0.0-next.5 → 3.0.0-next.7

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/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "CloudPDF Engine API",
5
- "version": "3.0.0-next.5",
5
+ "version": "3.0.0-next.7",
6
6
  "description": "The backend-callable surface of the CloudPDF document engine: deployment and tenant administration plus the document operations (reads, annotations, forms, page operations, redaction, download). Interactive viewing goes through the CloudPDF viewer SDKs, whose session protocol is deliberately not part of this API. Generated from the @cloudpdf/contract operation registry — do not edit by hand.",
7
7
  "license": {
8
8
  "name": "Apache-2.0",
@@ -2835,6 +2835,108 @@
2835
2835
  }
2836
2836
  }
2837
2837
  },
2838
+ "/v1/tenants/{tenantId}/documents/import": {
2839
+ "post": {
2840
+ "operationId": "documents.importFrom",
2841
+ "x-fern-sdk-group-name": ["documents"],
2842
+ "x-fern-sdk-method-name": "importFrom",
2843
+ "x-docs-title": "Import document",
2844
+ "summary": "Server-side pull: fetch a PDF from a caller-supplied URL (e.g. a presigned object-store GET) or an operator-registered storage connection into CloudPDF-owned storage, verify it, and commit it.",
2845
+ "description": "Default mode is synchronous and bounded: the response returns only after the transfer verified and committed (or failed). mode=async (connection sources only) answers 202 immediately and an in-process worker performs the transfer with leased, fenced retries; poll the document until ready/failed. The deployment import policy gates scheme, network range, and size; sources must declare a length. CloudPDF copies and owns the bytes — the source is never referenced in place. A 502 marks a retryable upstream failure: retry with the same idempotencyKey to resume the same document. URL sources are capabilities and never echoed back. Connection sources name operator-registered storage (bucket/prefix scope, allowed credential classes, and tenant bindings are deployment configuration); `revision` is provider-interpreted (S3 VersionId, GCS generation, Azure version id).",
2846
+ "security": [
2847
+ {
2848
+ "apiToken": []
2849
+ },
2850
+ {
2851
+ "tenantToken": []
2852
+ }
2853
+ ],
2854
+ "x-required-scope": ["docs.create"],
2855
+ "parameters": [
2856
+ {
2857
+ "name": "tenantId",
2858
+ "in": "path",
2859
+ "required": true,
2860
+ "schema": {
2861
+ "type": "string",
2862
+ "pattern": "^[A-Za-z0-9_-]+$"
2863
+ }
2864
+ }
2865
+ ],
2866
+ "requestBody": {
2867
+ "required": true,
2868
+ "content": {
2869
+ "application/json": {
2870
+ "schema": {
2871
+ "$ref": "#/components/schemas/DocumentsImportFromRequest"
2872
+ }
2873
+ }
2874
+ }
2875
+ },
2876
+ "responses": {
2877
+ "200": {
2878
+ "description": "OK",
2879
+ "content": {
2880
+ "application/json": {
2881
+ "schema": {
2882
+ "$ref": "#/components/schemas/DocumentsImportFrom200Response"
2883
+ }
2884
+ }
2885
+ }
2886
+ },
2887
+ "202": {
2888
+ "description": "Response",
2889
+ "content": {
2890
+ "application/json": {
2891
+ "schema": {
2892
+ "$ref": "#/components/schemas/DocumentsImportFrom202Response"
2893
+ }
2894
+ }
2895
+ }
2896
+ },
2897
+ "400": {
2898
+ "description": "Bad request",
2899
+ "content": {
2900
+ "application/json": {
2901
+ "schema": {
2902
+ "$ref": "#/components/schemas/DocumentsImportFrom400Response"
2903
+ }
2904
+ }
2905
+ }
2906
+ },
2907
+ "403": {
2908
+ "description": "Forbidden",
2909
+ "content": {
2910
+ "application/json": {
2911
+ "schema": {
2912
+ "$ref": "#/components/schemas/DocumentsImportFrom403Response"
2913
+ }
2914
+ }
2915
+ }
2916
+ },
2917
+ "502": {
2918
+ "description": "Response",
2919
+ "content": {
2920
+ "application/json": {
2921
+ "schema": {
2922
+ "$ref": "#/components/schemas/DocumentsImportFrom502Response"
2923
+ }
2924
+ }
2925
+ }
2926
+ },
2927
+ "default": {
2928
+ "description": "Error",
2929
+ "content": {
2930
+ "application/json": {
2931
+ "schema": {
2932
+ "$ref": "#/components/schemas/AdminErrorPayload"
2933
+ }
2934
+ }
2935
+ }
2936
+ }
2937
+ }
2938
+ }
2939
+ },
2838
2940
  "/v1/tenants/{tenantId}/documents/init": {
2839
2941
  "post": {
2840
2942
  "operationId": "documents.init",
@@ -4005,7 +4107,8 @@
4005
4107
  },
4006
4108
  "dedupMode": {
4007
4109
  "type": "string",
4008
- "enum": ["always-create", "reuse-existing"]
4110
+ "enum": ["always-create", "reuse-existing"],
4111
+ "description": "always-create (default) creates a new document every time. reuse-existing returns a document that already holds the same content instead of storing it twice."
4009
4112
  },
4010
4113
  "docId": {
4011
4114
  "type": "string",
@@ -4393,6 +4496,322 @@
4393
4496
  "required": ["error"],
4394
4497
  "additionalProperties": false
4395
4498
  },
4499
+ "DocumentsImportFromRequest": {
4500
+ "type": "object",
4501
+ "properties": {
4502
+ "source": {
4503
+ "anyOf": [
4504
+ {
4505
+ "type": "object",
4506
+ "properties": {
4507
+ "kind": {
4508
+ "type": "string",
4509
+ "enum": ["url"]
4510
+ },
4511
+ "url": {
4512
+ "type": "string",
4513
+ "format": "uri",
4514
+ "maxLength": 8192,
4515
+ "description": "The URL to fetch. Must be allowed by the deployment import policy (scheme, network range, size) and must declare a length."
4516
+ }
4517
+ },
4518
+ "required": ["kind", "url"],
4519
+ "additionalProperties": false,
4520
+ "description": "The caller supplies the authority: a presigned S3/GCS/Azure/R2/MinIO GET, or any HTTPS endpoint the deployment import policy allows. The URL is a capability — treat it as a secret. CloudPDF never echoes its query string back in errors, logs, or stored failure reasons."
4521
+ },
4522
+ {
4523
+ "type": "object",
4524
+ "properties": {
4525
+ "kind": {
4526
+ "type": "string",
4527
+ "enum": ["connection"]
4528
+ },
4529
+ "connectionId": {
4530
+ "type": "string",
4531
+ "minLength": 1,
4532
+ "maxLength": 128,
4533
+ "description": "The operator-registered storage connection to read from."
4534
+ },
4535
+ "key": {
4536
+ "type": "string",
4537
+ "minLength": 1,
4538
+ "description": "The object key to read, inside the connection's configured scope. At most 1024 UTF-8 bytes."
4539
+ },
4540
+ "revision": {
4541
+ "type": "string",
4542
+ "minLength": 1,
4543
+ "maxLength": 1024,
4544
+ "description": "Pins a specific version of the object. Provider-interpreted (S3 VersionId, GCS generation, Azure version id); providers without versioning reject it."
4545
+ }
4546
+ },
4547
+ "required": ["kind", "connectionId", "key"],
4548
+ "additionalProperties": false,
4549
+ "description": "The operator pre-registered the authority: the request names a connection and a key inside it. Which provider backs the connection (S3, GCS, Azure Blob, filesystem, ...) is deployment configuration, never wire surface."
4550
+ }
4551
+ ],
4552
+ "description": "Where CloudPDF pulls the bytes from. The two shapes differ in WHO supplies the authority to read, not in which storage vendor holds the file."
4553
+ },
4554
+ "expected": {
4555
+ "type": "object",
4556
+ "properties": {
4557
+ "sizeBytes": {
4558
+ "type": "integer",
4559
+ "minimum": 1,
4560
+ "description": "Checked against the source's declared Content-Length before the transfer."
4561
+ },
4562
+ "sha256": {
4563
+ "type": "string",
4564
+ "pattern": "^[0-9a-f]{64}$",
4565
+ "description": "Checked against the server-observed digest after the transfer. Required when dedupMode is reuse-existing."
4566
+ }
4567
+ },
4568
+ "additionalProperties": false,
4569
+ "description": "Integrity pins, enforced when present. When absent, the server-observed values become authoritative."
4570
+ },
4571
+ "metadata": {
4572
+ "type": "object",
4573
+ "additionalProperties": {}
4574
+ },
4575
+ "idempotencyKey": {
4576
+ "type": "string",
4577
+ "description": "Retrying with the same key resumes the same document rather than importing a second copy — including after a 502."
4578
+ },
4579
+ "dedupMode": {
4580
+ "type": "string",
4581
+ "enum": ["always-create", "reuse-existing"],
4582
+ "description": "always-create (default) creates a new document every time. reuse-existing returns a document that already holds the same content instead of storing it twice."
4583
+ },
4584
+ "docId": {
4585
+ "type": "string",
4586
+ "pattern": "^[A-Za-z0-9_-]+$"
4587
+ },
4588
+ "mode": {
4589
+ "type": "string",
4590
+ "enum": ["sync", "async"],
4591
+ "description": "sync (default) holds the response open for the whole transfer. async answers 202 with the document pending and transfers in the background; it requires a connection source, and filesystem connections additionally require expected.sha256."
4592
+ }
4593
+ },
4594
+ "required": ["source"],
4595
+ "additionalProperties": false
4596
+ },
4597
+ "DocumentsImportFrom200Response": {
4598
+ "type": "object",
4599
+ "properties": {
4600
+ "tag": {
4601
+ "type": "string",
4602
+ "enum": ["imported", "deduped", "accepted"]
4603
+ },
4604
+ "document": {
4605
+ "type": "object",
4606
+ "properties": {
4607
+ "id": {
4608
+ "type": "string"
4609
+ },
4610
+ "tenantId": {
4611
+ "type": "string"
4612
+ },
4613
+ "state": {
4614
+ "type": "string",
4615
+ "enum": ["pending", "ready", "failed", "deleting"]
4616
+ },
4617
+ "baseSha": {
4618
+ "type": "string",
4619
+ "nullable": true
4620
+ },
4621
+ "storageSizeBytes": {
4622
+ "type": "number",
4623
+ "nullable": true
4624
+ },
4625
+ "metadata": {
4626
+ "type": "object",
4627
+ "additionalProperties": {},
4628
+ "nullable": true
4629
+ },
4630
+ "idempotencyKey": {
4631
+ "type": "string",
4632
+ "nullable": true
4633
+ },
4634
+ "failureReason": {
4635
+ "type": "string",
4636
+ "nullable": true
4637
+ },
4638
+ "thumbnailState": {
4639
+ "type": "string",
4640
+ "enum": ["pending", "ready", "locked", "failed"]
4641
+ },
4642
+ "thumbnailUrl": {
4643
+ "type": "string",
4644
+ "nullable": true
4645
+ },
4646
+ "createdAt": {
4647
+ "type": "number"
4648
+ },
4649
+ "updatedAt": {
4650
+ "type": "number"
4651
+ },
4652
+ "createdBy": {
4653
+ "type": "string",
4654
+ "nullable": true
4655
+ }
4656
+ },
4657
+ "required": [
4658
+ "id",
4659
+ "tenantId",
4660
+ "state",
4661
+ "baseSha",
4662
+ "storageSizeBytes",
4663
+ "metadata",
4664
+ "idempotencyKey",
4665
+ "failureReason",
4666
+ "createdAt",
4667
+ "updatedAt",
4668
+ "createdBy"
4669
+ ],
4670
+ "additionalProperties": false
4671
+ }
4672
+ },
4673
+ "required": ["tag", "document"],
4674
+ "additionalProperties": false
4675
+ },
4676
+ "DocumentsImportFrom202Response": {
4677
+ "type": "object",
4678
+ "properties": {
4679
+ "tag": {
4680
+ "type": "string",
4681
+ "enum": ["imported", "deduped", "accepted"]
4682
+ },
4683
+ "document": {
4684
+ "type": "object",
4685
+ "properties": {
4686
+ "id": {
4687
+ "type": "string"
4688
+ },
4689
+ "tenantId": {
4690
+ "type": "string"
4691
+ },
4692
+ "state": {
4693
+ "type": "string",
4694
+ "enum": ["pending", "ready", "failed", "deleting"]
4695
+ },
4696
+ "baseSha": {
4697
+ "type": "string",
4698
+ "nullable": true
4699
+ },
4700
+ "storageSizeBytes": {
4701
+ "type": "number",
4702
+ "nullable": true
4703
+ },
4704
+ "metadata": {
4705
+ "type": "object",
4706
+ "additionalProperties": {},
4707
+ "nullable": true
4708
+ },
4709
+ "idempotencyKey": {
4710
+ "type": "string",
4711
+ "nullable": true
4712
+ },
4713
+ "failureReason": {
4714
+ "type": "string",
4715
+ "nullable": true
4716
+ },
4717
+ "thumbnailState": {
4718
+ "type": "string",
4719
+ "enum": ["pending", "ready", "locked", "failed"]
4720
+ },
4721
+ "thumbnailUrl": {
4722
+ "type": "string",
4723
+ "nullable": true
4724
+ },
4725
+ "createdAt": {
4726
+ "type": "number"
4727
+ },
4728
+ "updatedAt": {
4729
+ "type": "number"
4730
+ },
4731
+ "createdBy": {
4732
+ "type": "string",
4733
+ "nullable": true
4734
+ }
4735
+ },
4736
+ "required": [
4737
+ "id",
4738
+ "tenantId",
4739
+ "state",
4740
+ "baseSha",
4741
+ "storageSizeBytes",
4742
+ "metadata",
4743
+ "idempotencyKey",
4744
+ "failureReason",
4745
+ "createdAt",
4746
+ "updatedAt",
4747
+ "createdBy"
4748
+ ],
4749
+ "additionalProperties": false
4750
+ }
4751
+ },
4752
+ "required": ["tag", "document"],
4753
+ "additionalProperties": false
4754
+ },
4755
+ "DocumentsImportFrom400Response": {
4756
+ "type": "object",
4757
+ "properties": {
4758
+ "error": {
4759
+ "type": "object",
4760
+ "properties": {
4761
+ "code": {
4762
+ "type": "string"
4763
+ },
4764
+ "message": {
4765
+ "type": "string"
4766
+ }
4767
+ },
4768
+ "required": ["code", "message"],
4769
+ "additionalProperties": false
4770
+ }
4771
+ },
4772
+ "required": ["error"],
4773
+ "additionalProperties": false
4774
+ },
4775
+ "DocumentsImportFrom403Response": {
4776
+ "type": "object",
4777
+ "properties": {
4778
+ "error": {
4779
+ "type": "object",
4780
+ "properties": {
4781
+ "code": {
4782
+ "type": "string"
4783
+ },
4784
+ "message": {
4785
+ "type": "string"
4786
+ }
4787
+ },
4788
+ "required": ["code", "message"],
4789
+ "additionalProperties": false
4790
+ }
4791
+ },
4792
+ "required": ["error"],
4793
+ "additionalProperties": false
4794
+ },
4795
+ "DocumentsImportFrom502Response": {
4796
+ "type": "object",
4797
+ "properties": {
4798
+ "error": {
4799
+ "type": "object",
4800
+ "properties": {
4801
+ "code": {
4802
+ "type": "string"
4803
+ },
4804
+ "message": {
4805
+ "type": "string"
4806
+ }
4807
+ },
4808
+ "required": ["code", "message"],
4809
+ "additionalProperties": false
4810
+ }
4811
+ },
4812
+ "required": ["error"],
4813
+ "additionalProperties": false
4814
+ },
4396
4815
  "DocumentsList200Response": {
4397
4816
  "type": "object",
4398
4817
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudpdf/contract",
3
- "version": "3.0.0-next.5",
3
+ "version": "3.0.0-next.7",
4
4
  "private": false,
5
5
  "description": "The CloudPDF engine contract: operation registry, Zod schemas, and OpenAPI emitter for every backend-callable surface — used by @cloudpdf/server and the generated @cloudpdf/sdk, and the source of the committed openapi.json.",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "zod": "^3.23.8",
44
44
  "zod-to-json-schema": "^3.24.6",
45
- "@embedpdf/engine-core": "3.0.0-next.5"
45
+ "@embedpdf/engine-core": "3.0.0-next.7"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "latest",