@tunasand/sdk 0.8.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/README.md +165 -144
  3. package/dist/analytics.js +183 -109
  4. package/dist/app.js +276 -166
  5. package/dist/apps-BysPfMuR.js +408 -0
  6. package/dist/astro-image.d.ts +1 -0
  7. package/dist/astro-image.js +33 -0
  8. package/dist/astro-server-Bwau8F6d.js +99 -0
  9. package/dist/astro-server.d.ts +1 -0
  10. package/dist/astro-server.js +1 -0
  11. package/dist/astro.d.ts +1 -0
  12. package/dist/astro.js +306 -0
  13. package/dist/bridge-C2Bl-OAF.js +80 -0
  14. package/dist/bridge.js +1 -13
  15. package/dist/build-file-DNi0PHC5.js +31 -0
  16. package/dist/cli.js +6212 -8
  17. package/dist/{client-Derrexwr.js → client-C8STAw9T.js} +43 -24
  18. package/dist/code-N8pBUDbq.js +30 -0
  19. package/dist/code.d.ts +1 -0
  20. package/dist/code.js +1 -0
  21. package/dist/collection-26aglrg6.js +282 -0
  22. package/dist/{declared-DuNMsdXw.js → declared-CE4a61qb.js} +35 -35
  23. package/dist/delivery.js +121 -114
  24. package/dist/dev-operations-Tutwi1On.js +46 -0
  25. package/dist/dev.js +9 -16
  26. package/dist/embeds-DY6O5TrJ.js +29 -0
  27. package/dist/end-users.d.ts +1 -0
  28. package/dist/end-users.js +189 -0
  29. package/dist/endUsers-DODfjnv1.js +77 -0
  30. package/dist/{errorLabels-BgtQ_zUn.js → errorLabels-BK1NJ6Wz.js} +374 -238
  31. package/dist/i18n.js +4 -4
  32. package/dist/ids-DmtIoqBX.js +109 -0
  33. package/dist/integrations.js +95 -24
  34. package/dist/{ja-Du6ooL6i.js → ja-B3lAaOhZ.js} +91 -45
  35. package/dist/{ja-CeHU0EaY.js → ja-axQPxMJ-.js} +3 -3
  36. package/dist/operations-CIB99rIY.js +95 -0
  37. package/dist/operations.d.ts +1 -0
  38. package/dist/operations.js +1 -0
  39. package/dist/{page-Bzrj24sJ.js → page-yo1cw1kW.js} +1 -1
  40. package/dist/paymentPort-p1jV44Zz.js +203 -0
  41. package/dist/preview.js +8 -1
  42. package/dist/{profile-1em_lcxq.js → profile-DBsXLvvI.js} +48 -48
  43. package/dist/rich-text.js +16 -16
  44. package/dist/{schema-WnobuwLg.js → schema-Bs_BUUNv.js} +526 -265
  45. package/dist/schema.js +66 -88
  46. package/dist/types/access/src/handoff.d.ts +19 -14
  47. package/dist/types/access/src/index.d.ts +2 -2
  48. package/dist/types/access/src/jws.d.ts +41 -0
  49. package/dist/types/access/src/oidc.d.ts +12 -2
  50. package/dist/types/access/src/signed.d.ts +0 -2
  51. package/dist/types/adapter-cloudflare/src/eventLog/viewSchema.d.ts +11 -0
  52. package/dist/types/contract/src/accountProfile.d.ts +7 -0
  53. package/dist/types/contract/src/api/define.d.ts +165 -0
  54. package/dist/types/contract/src/apiKeys.d.ts +6 -2
  55. package/dist/types/contract/src/app.d.ts +32 -7
  56. package/dist/types/contract/src/appChannels.d.ts +152 -0
  57. package/dist/types/contract/src/appDefinition.d.ts +11 -5
  58. package/dist/types/contract/src/appDependencies.d.ts +107 -24
  59. package/dist/types/contract/src/appIdentities.d.ts +21 -0
  60. package/dist/types/contract/src/appInbound.d.ts +53 -0
  61. package/dist/types/contract/src/appMail.d.ts +106 -0
  62. package/dist/types/contract/src/appSecrets.d.ts +63 -0
  63. package/dist/types/contract/src/appServer.d.ts +460 -45
  64. package/dist/types/contract/src/approvals.d.ts +1 -1
  65. package/dist/types/contract/src/apps.d.ts +126 -60
  66. package/dist/types/contract/src/auditActions.d.ts +2 -2
  67. package/dist/types/contract/src/auditLabels.d.ts +120 -15
  68. package/dist/types/contract/src/authorize.d.ts +42 -14
  69. package/dist/types/contract/src/bridge.d.ts +35 -36
  70. package/dist/types/contract/src/consents.d.ts +29 -27
  71. package/dist/types/contract/src/deletion.d.ts +18 -0
  72. package/dist/types/contract/src/embeds.d.ts +26 -90
  73. package/dist/types/contract/src/{customerLabels.d.ts → endUserLabels.d.ts} +6 -9
  74. package/dist/types/contract/src/endUsers.d.ts +244 -0
  75. package/dist/types/contract/src/errorLabels.d.ts +67 -37
  76. package/dist/types/contract/src/errorLabelsEn.d.ts +50 -33
  77. package/dist/types/contract/src/errors.d.ts +28 -16
  78. package/dist/types/contract/src/eventSchemas.d.ts +70 -0
  79. package/dist/types/contract/src/eventTraces.d.ts +41 -0
  80. package/dist/types/contract/src/failureStatus.d.ts +14 -22
  81. package/dist/types/contract/src/fieldAccess.d.ts +8 -8
  82. package/dist/types/contract/src/formLabels.d.ts +3 -0
  83. package/dist/types/contract/src/forms.d.ts +4 -0
  84. package/dist/types/contract/src/grants.d.ts +26 -0
  85. package/dist/types/contract/src/headers.d.ts +5 -0
  86. package/dist/types/contract/src/hostingRpc.d.ts +44 -19
  87. package/dist/types/contract/src/identifiers.d.ts +45 -17
  88. package/dist/types/contract/src/ids.d.ts +18 -10
  89. package/dist/types/contract/src/import.d.ts +17 -16
  90. package/dist/types/contract/src/index.d.ts +57 -29
  91. package/dist/types/contract/src/integrationGraph.d.ts +83 -0
  92. package/dist/types/contract/src/issueLabels.d.ts +121 -81
  93. package/dist/types/contract/src/issueLabelsEn.d.ts +61 -41
  94. package/dist/types/contract/src/manage.d.ts +16 -7
  95. package/dist/types/contract/src/manageLabels.d.ts +2 -0
  96. package/dist/types/contract/src/manifestText.d.ts +66 -0
  97. package/dist/types/contract/src/messagePort.d.ts +208 -0
  98. package/dist/types/contract/src/migration.d.ts +2 -2
  99. package/dist/types/contract/src/notices.d.ts +37 -0
  100. package/dist/types/contract/src/operationEffects.d.ts +39 -0
  101. package/dist/types/contract/src/operatorOperations.d.ts +104 -110
  102. package/dist/types/contract/src/outbound.d.ts +29 -0
  103. package/dist/types/contract/src/paths.d.ts +13 -0
  104. package/dist/types/contract/src/paymentPort.d.ts +129 -0
  105. package/dist/types/contract/src/pending.d.ts +2 -0
  106. package/dist/types/contract/src/permissions.d.ts +7 -11
  107. package/dist/types/contract/src/perspective.d.ts +26 -0
  108. package/dist/types/contract/src/powers.d.ts +5 -0
  109. package/dist/types/contract/src/principal.d.ts +127 -56
  110. package/dist/types/contract/src/readPages.d.ts +92 -0
  111. package/dist/types/contract/src/recordLabels.d.ts +6 -0
  112. package/dist/types/contract/src/roles.d.ts +7 -4
  113. package/dist/types/contract/src/ruleLabels.d.ts +16 -0
  114. package/dist/types/contract/src/ruleProblems.d.ts +16 -0
  115. package/dist/types/contract/src/schemaLabels.d.ts +8 -0
  116. package/dist/types/contract/src/settingProblems.d.ts +18 -1
  117. package/dist/types/contract/src/settings.d.ts +5 -7
  118. package/dist/types/contract/src/siteDeclaration.d.ts +7 -7
  119. package/dist/types/contract/src/siteIndex.d.ts +76 -0
  120. package/dist/types/contract/src/transfer.d.ts +1 -1
  121. package/dist/types/contract/src/trial.d.ts +4 -1
  122. package/dist/types/contract/src/versions.d.ts +1 -3
  123. package/dist/types/contract/src/viewEvent.d.ts +0 -9
  124. package/dist/types/contract/src/webhooks.d.ts +24 -3
  125. package/dist/types/contract/src/workflow.d.ts +16 -19
  126. package/dist/types/contract/src/workspaceItems.d.ts +23 -7
  127. package/dist/types/contract/src/workspacePaths.d.ts +1 -1
  128. package/dist/types/rich-text/src/html.d.ts +1 -1
  129. package/dist/types/rich-text/src/index.d.ts +8 -7
  130. package/dist/types/rich-text/src/labels/en.d.ts +1 -1
  131. package/dist/types/rich-text/src/labels/ja.d.ts +2 -2
  132. package/dist/types/rich-text/src/library.d.ts +1 -1
  133. package/dist/types/rich-text/src/media.d.ts +2 -0
  134. package/dist/types/rich-text/src/normalize.d.ts +1 -1
  135. package/dist/types/rich-text/src/problems.d.ts +5 -5
  136. package/dist/types/rich-text/src/profile.d.ts +10 -10
  137. package/dist/types/rich-text/src/render.d.ts +1 -1
  138. package/dist/types/rich-text/src/schema.d.ts +2 -2
  139. package/dist/types/rich-text/src/standard.d.ts +4 -4
  140. package/dist/types/rich-text/src/types.d.ts +2 -2
  141. package/dist/types/schema/src/audience.d.ts +1 -3
  142. package/dist/types/schema/src/capabilities.d.ts +18 -27
  143. package/dist/types/schema/src/changes.d.ts +3 -1
  144. package/dist/types/schema/src/collection.d.ts +142 -111
  145. package/dist/types/schema/src/defaultSchema.d.ts +8 -2
  146. package/dist/types/schema/src/fieldIds.d.ts +18 -0
  147. package/dist/types/schema/src/file.d.ts +24 -11
  148. package/dist/types/schema/src/fileRefs.d.ts +14 -0
  149. package/dist/types/schema/src/fileSignature.d.ts +20 -0
  150. package/dist/types/schema/src/filesCollection.d.ts +7 -0
  151. package/dist/types/schema/src/forms.d.ts +43 -0
  152. package/dist/types/schema/src/imageMetadata.d.ts +9 -0
  153. package/dist/types/schema/src/index.d.ts +19 -10
  154. package/dist/types/schema/src/indexes.d.ts +11 -0
  155. package/dist/types/schema/src/input.d.ts +1 -1
  156. package/dist/types/schema/src/integrity.d.ts +8 -7
  157. package/dist/types/schema/src/kinds.d.ts +26 -0
  158. package/dist/types/schema/src/labels/en.d.ts +89 -46
  159. package/dist/types/schema/src/labels/ja.d.ts +92 -46
  160. package/dist/types/schema/src/mediaUrl.d.ts +26 -33
  161. package/dist/types/schema/src/page.d.ts +4 -4
  162. package/dist/types/schema/src/problems.d.ts +85 -42
  163. package/dist/types/schema/src/refs.d.ts +0 -9
  164. package/dist/types/schema/src/schema.d.ts +17 -12
  165. package/dist/types/schema/src/selfOps.d.ts +20 -19
  166. package/dist/types/schema/src/traits.d.ts +28 -0
  167. package/dist/types/schema/src/typesSource.d.ts +1 -1
  168. package/dist/types/schema/src/values.d.ts +5 -2
  169. package/dist/types/schema/src/widening.d.ts +3 -0
  170. package/dist/types/sdk/src/analytics.d.ts +2 -1
  171. package/dist/types/sdk/src/app.d.ts +43 -14
  172. package/dist/types/sdk/src/astro-image.d.ts +19 -0
  173. package/dist/types/sdk/src/astro-response.d.ts +6 -0
  174. package/dist/types/sdk/src/astro-server.d.ts +16 -0
  175. package/dist/types/sdk/src/astro.d.ts +19 -0
  176. package/dist/types/sdk/src/bridge.d.ts +2 -4
  177. package/dist/types/sdk/src/code.d.ts +61 -0
  178. package/dist/types/sdk/src/delegation.d.ts +13 -3
  179. package/dist/types/sdk/src/delivery/changes.d.ts +4 -4
  180. package/dist/types/sdk/src/delivery/client.d.ts +33 -22
  181. package/dist/types/sdk/src/delivery/fields.d.ts +3 -3
  182. package/dist/types/sdk/src/delivery/index.d.ts +3 -3
  183. package/dist/types/sdk/src/delivery/media.d.ts +5 -8
  184. package/dist/types/sdk/src/delivery/query.d.ts +15 -11
  185. package/dist/types/sdk/src/delivery/schema.d.ts +1 -1
  186. package/dist/types/sdk/src/delivery/values.d.ts +10 -14
  187. package/dist/types/sdk/src/delivery.d.ts +2 -2
  188. package/dist/types/sdk/src/dev-operations.d.ts +20 -0
  189. package/dist/types/sdk/src/dev.d.ts +6 -5
  190. package/dist/types/sdk/src/end-users.d.ts +187 -0
  191. package/dist/types/sdk/src/i18n.d.ts +2 -2
  192. package/dist/types/sdk/src/integrations.d.ts +14 -21
  193. package/dist/types/sdk/src/operations.d.ts +17 -0
  194. package/dist/types/sdk/src/preview.d.ts +2 -1
  195. package/dist/types/sdk/src/rich-text.d.ts +2 -2
  196. package/dist/types/sdk/src/schema.d.ts +1 -1
  197. package/dist/types/sdk/src/site/artifact.d.ts +64 -0
  198. package/dist/types/sdk/src/site/build-file.d.ts +30 -0
  199. package/dist/types/sdk/src/site/check-code.d.ts +14 -0
  200. package/dist/types/sdk/src/site/check-text.d.ts +19 -0
  201. package/dist/types/sdk/src/site/cli.d.ts +52 -0
  202. package/dist/types/sdk/src/site/content-type.d.ts +2 -0
  203. package/dist/types/sdk/src/site/labels.d.ts +14 -0
  204. package/dist/types/sdk/src/types.d.ts +1 -1
  205. package/dist/{types-B77qvqPJ.js → types-CYnY-63C.js} +5 -6
  206. package/dist/types.js +1 -1
  207. package/dist/{typesSource-CWybQYus.js → typesSource-BTA9-rcB.js} +17 -15
  208. package/package.json +32 -6
  209. package/dist/apps-BxnJ1RlU.js +0 -435
  210. package/dist/bridge-DtHw9hS6.js +0 -74
  211. package/dist/collection-BEOxeISR.js +0 -189
  212. package/dist/customers-DTbL0qn6.js +0 -86
  213. package/dist/customers.d.ts +0 -1
  214. package/dist/customers.js +0 -185
  215. package/dist/embeds-B5V54Zur.js +0 -34
  216. package/dist/ids--RF7hGyC.js +0 -36
  217. package/dist/src-sazhzYui.js +0 -71
  218. package/dist/types/contract/src/customers.d.ts +0 -266
  219. package/dist/types/schema/src/legacy.d.ts +0 -2
  220. package/dist/types/schema/src/media.d.ts +0 -5
  221. package/dist/types/sdk/src/customers.d.ts +0 -184
@@ -7,7 +7,7 @@ export declare const API_ISSUE_MESSAGES_EN: {
7
7
  readonly slug_uuid: "Slug must not be in UUID form";
8
8
  readonly url_format: "Invalid URL";
9
9
  readonly infra_id: "Invalid ID (26 lowercase letters and digits)";
10
- readonly infra_id_uuid: "UUID-form IDs are not accepted (26 lowercase letters and digits)";
10
+ readonly uuid_not_accepted: "UUID-form IDs are not accepted (26 lowercase letters and digits)";
11
11
  readonly https_only: "Only https URLs are allowed";
12
12
  readonly body_not_json: "The request body is not JSON";
13
13
  readonly email_format: "Invalid email address";
@@ -21,7 +21,12 @@ export declare const API_ISSUE_MESSAGES_EN: {
21
21
  readonly app_namespace: "The namespace must be 3 to 32 lowercase letters and digits, starting with a letter";
22
22
  readonly app_namespace_taken: "This namespace is already taken (namespaces cannot be reused)";
23
23
  readonly app_no_organization: "Apps cannot be registered in a project that is not linked to a organization";
24
- readonly app_slots: "Choose the collections to embed into (embeds that need a body require a collection with a body field)";
24
+ readonly app_collections: "Choose the existing collections to map and the fields to map (each field must have the same type; unmapped fields are added by the installation, so map any field that already uses the same key)";
25
+ readonly channel_capabilities: "Choose one or more channel capabilities from the kind declaration";
26
+ readonly channel_address: "Use a local part of lowercase letters, digits, \".\", \"_\" and \"-\" on a domain verified in this project (only for kinds with addresses)";
27
+ readonly channel_setting: "{key} is not a setting of this kind or has an invalid value";
28
+ readonly channel_kind: "Use a channel kind declared by an installed app (choose the app with installationId when several apps declare the kind)";
29
+ readonly app_slugs: "A collection slug of the app is taken or invalid. Specify the slugs";
25
30
  readonly app_not_installable: "This app cannot be installed (only apps of your own organization and reviewed apps)";
26
31
  readonly app_no_registration: "Apps cannot be added to this project";
27
32
  readonly app_changed: "The app version or capabilities changed after you reviewed them. Review them again";
@@ -29,15 +34,14 @@ export declare const API_ISSUE_MESSAGES_EN: {
29
34
  readonly app_incompatible: "Incompatible change within the same major version. Bump the major version or revert the change";
30
35
  readonly app_incompatible_detail: "Incompatible change within the same major version. Bump the major version or revert the change ({detail})";
31
36
  readonly app_key_private: "Keys with private parts (such as d) cannot be registered. Send only the public key";
32
- readonly app_key_unsupported: "Only ES256 (EC P-256) or RS256 (RSA) public signing keys can be registered";
37
+ readonly app_key_unsupported: "Only ES256 (EC P-256), RS256 (RSA) or ML-DSA-44 public signing keys can be registered";
33
38
  readonly app_key_weak: "RSA keys must be at least 2048 bits";
34
39
  readonly app_key_kid: "kid must be a string of 1 to 128 characters";
35
40
  readonly app_key_duplicate_kid: "Multiple keys share the same kid";
36
41
  readonly app_key_duplicate_key: "The same key appears more than once (use different keys for exchange and upload)";
37
42
  readonly deploy_artifact: "The artifact is malformed";
38
- readonly deploy_artifact_required: "Send exactly one of artifact or version (to redeploy)";
43
+ readonly deploy_artifact_required: "Send the artifact (artifact)";
39
44
  readonly deploy_secrets: "secrets must be a JSON object from names to strings";
40
- readonly deploy_version_not_found: "No artifact exists for that version";
41
45
  readonly deploy_binding: "A variable or secret name or value is not accepted";
42
46
  readonly artifact_too_large: "The artifact exceeds the size limit";
43
47
  readonly artifact_format: "Not an artifact (build it with tunasand site)";
@@ -51,34 +55,37 @@ export declare const API_ISSUE_MESSAGES_EN: {
51
55
  readonly binding_duplicate_name: "The same name is used by a variable and a secret";
52
56
  readonly binding_tunasand_value: "Tunasand secrets, or values containing them, cannot be used";
53
57
  readonly binding_too_many: "Too many variables, secrets and resources";
54
- readonly customer_invalid_date: "The date must be a real day in YYYY-MM-DD";
55
- readonly customer_no_target_collection: "The grant target collection does not exist (the collection referenced by a collection’s required grant field)";
56
- readonly customer_no_target: "The grant target record does not exist";
57
- readonly customer_ends_before_start: "The end date is before the start date";
58
- readonly customer_ends_required: "An end date is required (the target collection has no period in months, or the target record has no value)";
59
- readonly customer_months_invalid: "The target record’s period in months is not an integer from 1 to 1200 (fix it or specify an end date)";
60
- readonly customer_ends_unchecked: "The end date follows the target’s period in months (not checked in a test run because the target is an earlier record of the same run)";
61
- readonly customer_no_provider: "The issuer is not in the settings";
62
- readonly customer_profile_collection: "The profile collection must have a unique reference field to customers";
63
- readonly customer_not_configured: "enabling customers, or an identity issuer";
64
- readonly customer_read_log_not_configured: "storage for the log of reads of personal records";
65
- readonly customer_version_too_long: "The question version must be at most 64 characters";
66
- readonly customer_id_shape: "{field} must be a customer ID";
67
- readonly customer_missing: "Customer {id} of {field} does not exist";
68
- readonly customer_singleton: "{field} of {collection} (customer fields of object-format collections cannot be handled by customer deletion; remove the field first)";
69
- readonly customer_cascade_other: "{field} of {collection} (a record deleted by cascade points to another customer)";
70
- readonly customer_cascade_vanished: "{collection} (a record to delete by cascade disappeared after planning; delete again)";
71
- readonly customer_erasure_confirm: "For confirmation, enter the customer ID again in confirm";
72
- readonly customer_deletion_too_large: "{count, number} records, rewritten records and revisions do not fit in one deletion (reduce the referencing records first)";
73
- readonly customer_statements_too_large: "{count, number} statements exceed the limit for one deletion (reduce the referencing records and customer data first)";
74
- readonly customer_undeclared_on_delete: "{field} of {collection} (onDelete for deleted customers is not set; set it in the schema first)";
75
- readonly consent_purpose: "The purpose must be service, marketing, or a purpose declared in the customer settings";
76
- readonly consent_address: "The address does not match the channel (email address for email, phone number for sms, userId for line)";
77
- readonly consent_target: "email and sms require address (line requires customerId or address)";
58
+ readonly end_user_invalid_date: "The date must be a real day in YYYY-MM-DD";
59
+ readonly end_user_no_target_collection: "The entitlement target collection does not exist (the collection referenced by a collection’s required entitlement field)";
60
+ readonly end_user_no_target: "The entitlement target record does not exist";
61
+ readonly payment_reflection_mismatch: "The payment reflection does not match the reflected purchase or subscription, or the price kind";
62
+ readonly payment_url_host: "The return URL must be on a host of the project site";
63
+ readonly end_user_ends_before_start: "The end date is before the start date";
64
+ readonly end_user_ends_required: "An end date is required (the target collection has no period in months, or the target record has no value)";
65
+ readonly end_user_months_invalid: "The target record’s period in months is not an integer from 1 to 1200 (fix it or specify an end date)";
66
+ readonly end_user_ends_unchecked: "The end date follows the target’s period in months (not checked in a test run because the target is an earlier record of the same run)";
67
+ readonly end_user_no_provider: "The issuer is not in the settings";
68
+ readonly end_user_not_configured: "enabling end users, or an identity issuer";
69
+ readonly end_user_read_log_not_configured: "storage for the log of reads of personal records";
70
+ readonly end_user_version_too_long: "The question version must be at most 64 characters";
71
+ readonly end_user_id_shape: "{field} must be an end user ID";
72
+ readonly end_user_missing: "End user {id} of {field} does not exist";
73
+ readonly end_user_singleton: "{field} of {collection} (end user fields of object-format collections cannot be handled by end user deletion; remove the field first)";
74
+ readonly end_user_cascade_other: "{field} of {collection} (a record deleted by cascade points to another end user)";
75
+ readonly cascade_vanished: "{collection} (a record to delete by cascade disappeared after planning; delete again)";
76
+ readonly end_user_erasure_confirm: "For confirmation, enter the end user ID again in confirm";
77
+ readonly deletion_too_large: "{count, number} records, rewritten records and revisions do not fit in one deletion (reduce the referencing records first)";
78
+ readonly end_user_statements_too_large: "{count, number} statements exceed the limit for one deletion (reduce the referencing records and end user data first)";
79
+ readonly end_user_undeclared_on_delete: "{field} of {collection} (onDelete for deleted end users is not set; set it in the schema first)";
80
+ readonly consent_purpose: "The purpose must be service, marketing, or a purpose declared in the end user settings";
81
+ readonly consent_address: "The address does not match the channel (email address for email, phone number for sms; channel IDs take no address)";
82
+ readonly consent_target: "email and sms require address; channel IDs require end_user_id";
83
+ readonly consent_channel: "The channel must be email, sms, or the ID of a channel in this project";
78
84
  readonly consent_method: "This method is not available for the source kind (account is staff only)";
79
85
  readonly unfilterable_field: "{key} cannot be used as a filter";
86
+ readonly undeclared_field: "{key} is not a field of the collection";
80
87
  readonly unwritable_field: "{key} cannot be written because it is not visible to this credential (visibility)";
81
- readonly self_unwritable: "{key} cannot be written by the customer";
88
+ readonly self_unwritable: "{key} cannot be written by the end user";
82
89
  readonly unique_part_required: "{key} is required because it is part of a one-row-per-person key";
83
90
  readonly reference_unavailable: "The reference of {key} cannot be chosen (published records only)";
84
91
  readonly request_reject_note_required: "A rejection reason is required";
@@ -86,14 +93,17 @@ export declare const API_ISSUE_MESSAGES_EN: {
86
93
  readonly record_no_review: "This collection has no review";
87
94
  readonly generated_slug: "Slugs in this collection are assigned by the CMS and cannot be specified";
88
95
  readonly unique_taken: "A record with the same {labels} already exists";
96
+ readonly transition_not_allowed: "Cannot change from {from} to {to}";
97
+ readonly transition_create_not_allowed: "Cannot create with {to}";
89
98
  readonly unique_duplicates: "{count, number} records in {collection} share the same {labels} (fix the duplicates before making it unique)";
90
99
  readonly publish_check_unavailable: "No enabled app provides the publish check {check}";
91
- readonly capability_missing: "The storage of {collection} lacks the capability {capability} that its declaration needs";
100
+ readonly table_field_limit: "{collection} can have at most {max} fields (now {fields})";
92
101
  readonly use_at: "{field}{rest, select, none {} other { ({rest})}} of {collection}";
102
+ readonly file_missing: "Image or file {id} does not exist (it was deleted or never existed)";
93
103
  readonly public_in_private_field: "A field for private media only contains public images or files (upload them again from this field)";
94
104
  readonly trash_record: "record {id} of {collection}";
95
105
  readonly trash_unique_holder: "a record of {collection} ({reason})";
96
- readonly trash_customer_missing: "customer {id} referenced by {field} of {collection} (the customer does not exist)";
106
+ readonly trash_end_user_missing: "end user {id} referenced by {field} of {collection} (the end user does not exist)";
97
107
  readonly renamed_replacement: "Save the replacement of options of a collection whose id changes separately from the id change";
98
108
  readonly project_name_required: "Project name is required";
99
109
  readonly project_slug_invalid: "Use lowercase letters, digits and hyphens; ID-shaped slugs are not allowed";
@@ -107,12 +117,14 @@ export declare const API_ISSUE_MESSAGES_EN: {
107
117
  readonly config_missing: "Settings are missing from the DB of project {id} ({parts}; apply the project template).";
108
118
  readonly setting_text: "Enter text for \"{field}\".";
109
119
  readonly setting_integer_min: "\"{field}\" must be an integer of at least {min, number}.";
120
+ readonly setting_integer_max: "\"{field}\" must be an integer of at most {max, number}.";
110
121
  readonly setting_boolean: "\"{field}\" must be on or off.";
111
122
  readonly setting_text_list: "\"{field}\" must be a list of strings.";
112
123
  readonly setting_choice: "\"{field}\" must be one of: {choices}";
113
124
  readonly setting_duplicate: "\"{value}\" in \"{field}\" is duplicated.";
114
125
  readonly setting_required: "Specify at least one \"{field}\".";
115
126
  readonly setting_shape: "\"{field}\" is malformed.";
127
+ readonly setting_row_text: "Enter \"{sub}\" in row {row, number} of \"{field}\".";
116
128
  readonly unmapped_rows: "Collection {collection} has records with the same IDs imported before the import map ({ids}{more, plural, =0 {} other { and # more}}), so they cannot be imported (projects imported before the map are not reimported)";
117
129
  readonly screens_shape: "The screen settings are malformed";
118
130
  readonly reimport_unknown: "This environment has no import map for source {source}, so it is not reimported (reimport only into environments moved from the same source)";
@@ -131,14 +143,15 @@ export declare const API_ISSUE_MESSAGES_EN: {
131
143
  readonly import_map_closed: "The import map row is being deleted or is a tombstone";
132
144
  readonly import_map_no_key: "Cannot open the import map key (the DB was copied from another project)";
133
145
  readonly import_map_raced: "The import map or record changed first, by a concurrent import or an edit";
146
+ readonly import_map_held: "Another holder holds the record";
134
147
  readonly import_duplicate_identity: "The same identity appears more than once";
135
- readonly import_duplicate_grant: "The same grant (target collection and record, or key) appears more than once";
136
- readonly import_grant_target_changed: "The target of an imported grant cannot change (use another key for a different grant)";
137
- readonly import_identity_taken: "{customer, select, none {The identity belongs to another customer} other {The identity belongs to another customer {customer}}}";
138
- readonly import_closed_in_conflict: "Applied only the closure from the source (other changes are not written because of the conflict)";
139
- readonly import_closes_in_conflict: "Will apply only the closure from the source (other changes are not written because of the conflict)";
148
+ readonly import_duplicate_entitlement: "The same entitlement (target collection and record, or key) appears more than once";
149
+ readonly import_entitlement_target_changed: "The target of an imported entitlement cannot change (use another key for a different entitlement)";
150
+ readonly import_identity_taken: "{endUser, select, none {The identity belongs to another end user} other {The identity belongs to another end user {endUser}}}";
151
+ readonly import_suspended_in_conflict: "Applied only the suspension from the source (other changes are not written because of the conflict)";
152
+ readonly import_suspends_in_conflict: "Will apply only the suspension from the source (other changes are not written because of the conflict)";
140
153
  readonly import_overwritten: "Changes after the import were overwritten with the source values";
141
- readonly import_overwrite_note: "A reason note is required when customers are overwritten (overwrite)";
154
+ readonly import_overwrite_note: "A reason note is required when end users are overwritten (overwrite)";
142
155
  readonly import_file_not_stored: "No stored image or file has the same content";
143
156
  readonly import_file_failed: "{reason, select, forbidden {No permission to create images and files} https_required {Only https URLs are allowed} upstream_failed {Could not fetch it} unsupported_image {Unsupported image format (PNG, JPEG, GIF, WebP)} unsupported_file {Unsupported file format} file_too_large {Exceeds the size limit} other {Cannot be imported}}";
144
157
  readonly import_phase_unpublishable: "Steps of a cycle between collections require collections with editing (the first step creates drafts)";
@@ -175,16 +188,21 @@ export declare const API_ISSUE_MESSAGES_EN: {
175
188
  readonly import_kind_origin_missing: "Source ID not found in the import map";
176
189
  readonly import_kind_map_conflict: "Row does not match the import map (changed or removed after import)";
177
190
  readonly import_kind_map_unavailable: "No key for the import map (SECRETS_KEY missing)";
178
- readonly import_kind_identity_taken: "The identity belongs to another customer";
191
+ readonly import_kind_identity_taken: "The identity belongs to another end user";
179
192
  readonly delivery_path_count: "path must have 1 to {max, number} entries";
180
193
  readonly delivery_path_format: "path must be a delivery API path starting with /: {path}";
181
194
  readonly delivery_path_bundle: "path cannot include the bundle";
182
- readonly delivery_path_route_checked: "path cannot include the customer API";
195
+ readonly delivery_path_route_checked: "path cannot include the end user API";
183
196
  readonly delivery_path_wildcard: "path can have at most one *: {path}";
184
197
  readonly delivery_expanded_max: "At most {max, number} routes after expansion";
185
198
  readonly delivery_limit_range: "limit must be an integer from 1 to {max, number}";
186
199
  readonly delivery_since_invalid: "Invalid since (use next from the previous response)";
187
200
  readonly delivery_at_format: "at must be an ISO 8601 date-time";
201
+ readonly read_token_expiry: "expiresAt must be a future date-time within {max, number} days";
202
+ readonly delivery_at_past: "at must not be in the past";
203
+ readonly delivery_perspective_value: "perspective must be published or latest";
204
+ readonly delivery_perspective_combined: "Use only one of perspective=latest, revision and at";
205
+ readonly delivery_revision_list: "revision is only for a single record";
188
206
  readonly delivery_singleton_list: "A single-record collection cannot be listed";
189
207
  readonly delivery_fields_empty: "fields must be comma-separated non-empty fields";
190
208
  readonly delivery_expand_depth: "Expansion depth is at most {max, number}: {token}";
@@ -194,13 +212,14 @@ export declare const API_ISSUE_MESSAGES_EN: {
194
212
  readonly delivery_field_not_expandable: "Field cannot be expanded: {key}";
195
213
  readonly delivery_expanded_not_selectable: "Field cannot be selected in the expanded collection {collection}: {key}";
196
214
  readonly delivery_single: "{name} can be given only once";
215
+ readonly reference_single: "{field} takes only one record";
197
216
  readonly delivery_op_planned: "Not implemented operator: {op}";
198
217
  readonly delivery_filter_format: "Filters are filter[key] or filter[key][operator]";
199
218
  readonly delivery_filter_nested_planned: "Not implemented filter: field inside a group {key}";
200
219
  readonly delivery_field_not_filterable: "Field cannot be filtered: {key}";
201
220
  readonly delivery_op_not_allowed: "Operator not allowed for field {key}: {op}";
202
221
  readonly delivery_filter_value: "Invalid value for field {key}: {raw}";
203
- readonly delivery_ids_format: "ids must be up to {max, number} comma-separated non-empty ids";
222
+ readonly delivery_ids_format: "ids must be up to {max, number} non-empty ids, one per repeated parameter";
204
223
  readonly delivery_offset_planned: "Not implemented: offset (use cursor for paging)";
205
224
  readonly delivery_order_max: "At most {max, number} sort keys";
206
225
  readonly delivery_field_not_sortable: "Field cannot be sorted: {name}";
@@ -216,4 +235,5 @@ export declare const API_ISSUE_MESSAGES_EN: {
216
235
  readonly form_too_many: "At most {max, number} choices";
217
236
  readonly form_too_few: "At least {min, number} choices";
218
237
  readonly form_unknown_form: "Unknown form name";
238
+ readonly form_unwritable: "{key} cannot be submitted";
219
239
  };
@@ -1,23 +1,32 @@
1
- import { type ManagementPrincipal } from './authorize.js';
1
+ import { type ManagementPrincipal, type Operation } from './authorize.js';
2
+ import { type PrincipalShape, type Subject } from './principal.js';
2
3
  import type { Permissions } from './permissions.js';
3
- import type { User } from './roles.js';
4
4
  /**
5
5
  * 管理の権限のチェック
6
6
  * - schema: スキーマの変更、environments: 環境の作成と削除、request_production: 本番への反映の申請
7
7
  * - api_keys: API の鍵、secrets: 連携の秘密値(Webhook の送信先と鍵、外部関数の鍵)、memberships: メンバーとロールと招待
8
+ * - deployments: サイトの配置(公開は替えない)、activations: 配置したサイトの有効化(公開するデプロイを替える)
8
9
  */
9
- export declare const MANAGE_CHECKS: readonly ["schema", "environments", "request_production", "api_keys", "secrets", "memberships"];
10
+ export declare const MANAGE_CHECKS: readonly ["schema", "environments", "request_production", "api_keys", "secrets", "memberships", "deployments", "activations"];
10
11
  /** 管理の権限のチェック */
11
12
  export type ManageCheck = (typeof MANAGE_CHECKS)[number];
12
13
  /** 権限の表での管理の権限の id */
13
14
  export declare const manageTarget: (check: ManageCheck) => string;
14
15
  /** 権限の表の対象が管理の権限か */
15
16
  export declare const isManageTarget: (id: string) => boolean;
16
- type Holder = Pick<User, 'role' | 'permissions'> & Partial<Pick<User, 'mcp' | 'operator' | 'app'>>;
17
17
  /** 管理の権限を持つか(判定は authorize) */
18
- export declare const canManage: (user: Holder, check: ManageCheck) => boolean;
18
+ export declare const canManage: (user: Subject, check: ManageCheck) => boolean;
19
19
  /** 持つ管理の権限 */
20
- export declare const manageChecksOf: (user: Holder) => readonly ManageCheck[];
20
+ export declare const manageChecksOf: (user: Subject) => readonly ManageCheck[];
21
+ /** MCP の上限で MCP に開く管理の領域(本番への反映の申請だけ。承認とほかの管理の領域は MCP で行えない) */
22
+ export declare const MCP_MANAGED_AREAS: readonly string[];
23
+ /** MCP の接続が管理の領域を操作できるか(MCP に開く領域で、接続したアカウントのロールが持ち、接続の段階が content:write を含む) */
24
+ export declare function mcpManages(principal: PrincipalShape, operation: Operation, area: string): boolean;
25
+ /**
26
+ * MCP の接続がプロジェクトの値(スキーマなど、環境の主体に見せる値)を読めるか
27
+ * - 実効の権限(ロールとプロジェクトの MCP の上限と接続の段階の共通部分)で、どこかのコレクションかファイルを読めるときだけ
28
+ */
29
+ export declare function mcpReadsProject(principal: PrincipalShape): boolean;
21
30
  /** 管理の権限の行(更新の可だけ) */
22
31
  export declare const manageRowsOf: (checks: readonly ManageCheck[]) => Permissions;
23
32
  /** ロールの開ける環境(all はすべて) */
@@ -43,5 +52,5 @@ export type ReauthFactor = (typeof REAUTH_FACTORS)[number];
43
52
  /** 組織の設定の要素の値(未知の値を捨て、login を必ず含める。厳しくはできるが緩められない) */
44
53
  export declare const reauthFactorsOf: (raw: unknown) => readonly ReauthFactor[];
45
54
  /** プロジェクトのワークスペースのアカウントを、プロジェクトの管理の操作の主体に(MCP とアプリは管理の権限を持たないので、管理者でも表を空にする) */
46
- export declare const projectAccountPrincipal: (user: Holder, projectId: string) => ManagementPrincipal;
55
+ export declare const projectAccountPrincipal: (user: Subject, projectId: string) => ManagementPrincipal;
47
56
  export {};
@@ -6,4 +6,6 @@ export declare const MANAGE_CHECK_LABELS: {
6
6
  readonly api_keys: "API キー";
7
7
  readonly secrets: "連携の秘密値";
8
8
  readonly memberships: "メンバーとロール";
9
+ readonly deployments: "サイトの配置";
10
+ readonly activations: "サイトの有効化";
9
11
  };
@@ -0,0 +1,66 @@
1
+ import type { AppCollection, AppSettingDef } from './appDependencies.js';
2
+ import { type AppManifest, type AppManifestProblem, type AppUi } from './apps.js';
3
+ /** 表示の文字列の塊の言語(ja は必須で基準、en がない文字列は ja) */
4
+ export declare const APP_TEXT_LANGS: readonly ["ja", "en"];
5
+ export type AppTextLang = (typeof APP_TEXT_LANGS)[number];
6
+ type TextTable = Readonly<Record<string, string>>;
7
+ /** 言語ごとの表示の文字列の塊 */
8
+ export type AppManifestText = Readonly<{
9
+ label?: string;
10
+ description?: string;
11
+ targets?: TextTable;
12
+ audit_actions?: TextTable;
13
+ problems?: TextTable;
14
+ permissions?: TextTable;
15
+ ui?: TextTable;
16
+ settings?: Readonly<Record<string, Readonly<{
17
+ label?: string;
18
+ unit?: string;
19
+ }>>>;
20
+ collections?: Readonly<Record<string, Readonly<{
21
+ label?: string;
22
+ fields?: TextTable;
23
+ }>>>;
24
+ }>;
25
+ type Json = Readonly<Record<string, unknown>>;
26
+ /** 塊に移したフィールドの宣言(label を持たない) */
27
+ export type AppManifestDocumentField = Json & Readonly<{
28
+ key: string;
29
+ fields?: readonly AppManifestDocumentField[];
30
+ }>;
31
+ /** 塊に移したコレクションの宣言 */
32
+ export type AppManifestDocumentCollection = Omit<AppCollection, 'label' | 'fields'> & Readonly<{
33
+ fields: readonly AppManifestDocumentField[];
34
+ }>;
35
+ /** 登録と保存のマニフェスト */
36
+ export type AppManifestDocument = Readonly<Omit<AppManifest, 'label' | 'description' | 'targets' | 'audit_actions' | 'problems' | 'en' | 'permissions' | 'ui' | 'settings' | 'collections'> & {
37
+ permissions?: readonly Readonly<{
38
+ id: string;
39
+ }>[];
40
+ ui?: readonly Omit<AppUi, 'label'>[];
41
+ settings?: readonly Omit<AppSettingDef, 'label' | 'unit'>[];
42
+ collections?: readonly AppManifestDocumentCollection[];
43
+ ja: AppManifestText & Readonly<{
44
+ label: string;
45
+ }>;
46
+ en?: AppManifestText;
47
+ }>;
48
+ /** 登録のマニフェストの項目(登録はこれ以外の項目を拒否する) */
49
+ export declare const APP_MANIFEST_DOCUMENT_KEYS: readonly string[];
50
+ /**
51
+ * 登録と保存の形から、表示の文字列を本体に戻した形(lang の文字列、なければ ja)
52
+ * - 形を確かめない(検査は appManifestDocumentProblems)。塊の文字列のない項目は label なしのまま
53
+ */
54
+ export declare function manifestFromDocument(document: unknown, lang?: AppTextLang): unknown;
55
+ /** 読む側の形から登録と保存の形(同梱のアプリのマニフェストを登録の形で扱うときと、試験の材料) */
56
+ export declare function manifestDocumentOf(manifest: AppManifest): AppManifestDocument;
57
+ /**
58
+ * 保存したマニフェストの検査(読み取り。知らない項目は拒否しない)
59
+ * - 塊の形、本体に残った表示の文字列、塊を解いた形の検査(appManifestProblems、箇所は登録と保存の形で)
60
+ */
61
+ export declare function appManifestDocumentProblems(input: unknown, namespace: string | null): AppManifestProblem[];
62
+ /** 登録するマニフェストの検査(形のバージョン、知らない項目の拒否、registeringManifestProblems の決まり) */
63
+ export declare function registeringDocumentProblems(input: unknown, namespace: string | null): AppManifestProblem[];
64
+ /** 保存したマニフェストの JSON を読む側の形に(壊れていれば null) */
65
+ export declare function storedManifestOf(raw: string | null, namespace: string | null): AppManifest | null;
66
+ export {};
@@ -0,0 +1,208 @@
1
+ import { z } from 'zod';
2
+ import { type AddressChannel } from './consents.js';
3
+ /** ポートの id */
4
+ export declare const MESSAGE_PORT: "tunasand:message@1";
5
+ /** 受信のイベントの名前 */
6
+ export declare const MESSAGE_RECEIVED = "message.received";
7
+ /** 能力の形(text、image か `<名前空間>.<名前>`) */
8
+ export declare const MESSAGE_CAPABILITY: RegExp;
9
+ /** 上限(1回の送信のメッセージの数、テキストの字数、URL の字数、名前空間つきの本文のバイト数、冪等キーの字数、受信の操作のデータの字数) */
10
+ export declare const MESSAGE_LIMITS: {
11
+ readonly perSend: 5;
12
+ readonly textMaxChars: 5000;
13
+ readonly urlMaxChars: 2000;
14
+ readonly extensionMaxBytes: 30000;
15
+ readonly idempotencyKeyMaxChars: 128;
16
+ readonly actionDataMaxChars: 300;
17
+ readonly eventIdMaxChars: 200;
18
+ readonly addressMaxChars: 254;
19
+ readonly nameMaxChars: 200;
20
+ };
21
+ /** メッセージ(送信と受信で同じ形) */
22
+ export declare const portMessage: z.ZodUnion<readonly [z.ZodObject<{
23
+ kind: z.ZodLiteral<"text">;
24
+ text: z.ZodString;
25
+ }, z.core.$strict>, z.ZodObject<{
26
+ kind: z.ZodLiteral<"image">;
27
+ url: z.ZodString;
28
+ previewUrl: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strict>, z.ZodObject<{
30
+ kind: z.ZodString;
31
+ }, z.core.$catchall<z.ZodUnknown>>]>;
32
+ /** メッセージ(kind は能力) */
33
+ export type PortMessage = Readonly<{
34
+ kind: 'text';
35
+ text: string;
36
+ }> | Readonly<{
37
+ kind: 'image';
38
+ url: string;
39
+ previewUrl?: string;
40
+ }> | (Readonly<{
41
+ kind: `${string}.${string}`;
42
+ }> & Readonly<Record<string, unknown>>);
43
+ /** アドレスの相手(channel はアドレスのチャネル。形の検査と正規化はコアの同意と抑止の確認が行う) */
44
+ export type MessageAddress = Readonly<{
45
+ channel: AddressChannel;
46
+ address: string;
47
+ }>;
48
+ /** 送信の宛先(エンドユーザーの ID か、アドレス) */
49
+ export type MessageRecipient = Readonly<{
50
+ endUserId: string;
51
+ }> | MessageAddress;
52
+ /** 受信の送り主(アドレスの送り主は表示名を持つことがある) */
53
+ export type MessageSender = Readonly<{
54
+ endUserId: string;
55
+ }> | (MessageAddress & Readonly<{
56
+ name?: string;
57
+ }>);
58
+ /**
59
+ * 送信のリクエスト
60
+ * - to: エンドユーザーの ID か、アドレス。purpose は同意の目的、idempotencyKey は同じ送信の重複を除くキー
61
+ * - channel: 宛先の種類(その種類を consent_channel に宣言したプロバイダーを選ぶ)。省略はアドレスのチャネルか、能力をすべて持つ最初のプロバイダー
62
+ * - channelId: 送るチャネル(プロジェクトのチャネルの id。そのチャネルを持つプロバイダーが送る)。省略はプロバイダーの種類の既定のチャネル
63
+ * - replyTo: 返信する受信の eventId(プロバイダーはスレッドの返信として送る。扱わないチャネルは無視する)
64
+ */
65
+ export declare const messageSendRequest: z.ZodObject<{
66
+ to: z.ZodUnion<readonly [z.ZodObject<{
67
+ endUserId: z.ZodString;
68
+ }, z.core.$strict>, z.ZodObject<{
69
+ channel: z.ZodEnum<{
70
+ email: "email";
71
+ sms: "sms";
72
+ }>;
73
+ address: z.ZodString;
74
+ }, z.core.$strict>]>;
75
+ channel: z.ZodOptional<z.ZodEnum<{
76
+ email: "email";
77
+ sms: "sms";
78
+ }>>;
79
+ channelId: z.ZodOptional<z.ZodString>;
80
+ purpose: z.ZodString;
81
+ messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
82
+ kind: z.ZodLiteral<"text">;
83
+ text: z.ZodString;
84
+ }, z.core.$strict>, z.ZodObject<{
85
+ kind: z.ZodLiteral<"image">;
86
+ url: z.ZodString;
87
+ previewUrl: z.ZodOptional<z.ZodString>;
88
+ }, z.core.$strict>, z.ZodObject<{
89
+ kind: z.ZodString;
90
+ }, z.core.$catchall<z.ZodUnknown>>]>>;
91
+ idempotencyKey: z.ZodString;
92
+ replyTo: z.ZodOptional<z.ZodObject<{
93
+ eventId: z.ZodString;
94
+ }, z.core.$strict>>;
95
+ }, z.core.$strict>;
96
+ export type MessageSendRequest = Readonly<{
97
+ to: MessageRecipient;
98
+ channel?: AddressChannel;
99
+ channelId?: string;
100
+ purpose: string;
101
+ messages: readonly PortMessage[];
102
+ idempotencyKey: string;
103
+ replyTo?: Readonly<{
104
+ eventId: string;
105
+ }>;
106
+ }>;
107
+ /**
108
+ * 送信しない理由
109
+ * - no_identity: 宛先のチャネルの identity かアドレスがない、blocked: 宛先がチャネルで受け取りを止めた、no_consent: 同意がない、
110
+ * suppressed: 抑止の一覧にある、no_channel: チャネルの指定がなく、プロバイダーの種類の既定のチャネルもない、
111
+ * test_environment: live 以外の環境(送信しない)
112
+ */
113
+ export declare const MESSAGE_SKIP_REASONS: readonly ["no_identity", "blocked", "no_consent", "suppressed", "no_channel", "test_environment"];
114
+ export type MessageSkipReason = (typeof MESSAGE_SKIP_REASONS)[number];
115
+ /**
116
+ * 拒否の位置(index は何番目のメッセージで、リクエストの全体の誤りは負の値。path はその中の位置)
117
+ * - コアのコード: invalid_input、message_capability_undeclared、message_no_provider、message_address_channel、
118
+ * message_channel_unknown
119
+ * - message_address_channel: アドレスのチャネルがプロバイダーのチャネルと違う
120
+ * - message_channel_unknown: channelId がプロジェクトの送信のできるチャネルでないか、その種類のプロバイダーが能力を持たない
121
+ */
122
+ export type MessageProblem = Readonly<{
123
+ index: number;
124
+ path: string;
125
+ code: string;
126
+ }>;
127
+ /**
128
+ * 送信の結果(プロバイダーの一時的な失敗は結果にせず例外)
129
+ * - sent: 送った(providerMessageIds はチャネルの側の ID、ないものは空)
130
+ * - skipped: 送らなかった(理由)
131
+ * - rejected: 内容の誤り(位置とコード)
132
+ */
133
+ export type MessageSendResult = Readonly<{
134
+ status: 'sent';
135
+ provider: string;
136
+ providerMessageIds: readonly string[];
137
+ }> | Readonly<{
138
+ status: 'skipped';
139
+ reason: MessageSkipReason;
140
+ }> | Readonly<{
141
+ status: 'rejected';
142
+ problems: readonly MessageProblem[];
143
+ }>;
144
+ /** プロバイダーの結果(宛先の解決と内容の検査はプロバイダーが行う。コアの理由 no_consent・suppressed・no_channel・test_environment は返さない) */
145
+ export type MessageProviderResult = Exclude<MessageSendResult, Readonly<{
146
+ status: 'sent';
147
+ }>> | Readonly<{
148
+ status: 'sent';
149
+ providerMessageIds: readonly string[];
150
+ }>;
151
+ /** 受信の要素(メッセージか、操作の結果。操作の結果はリッチメニューやボタンのポストバックなど) */
152
+ export type ReceivedItem = PortMessage | Readonly<{
153
+ kind: 'action';
154
+ data: string;
155
+ }>;
156
+ /**
157
+ * 受信のイベント
158
+ * - eventId: チャネルの側のイベントの ID(受け手は redelivery の重複をこの値で除く。送信の replyTo に渡す)、at: 受信の時刻(ISO 8601)
159
+ * - from: 送り主(エンドユーザーか、アドレス)。provider はプロバイダーのアプリの id(コアが付ける)
160
+ * - channelId: 受けたチャネル(プロジェクトのチャネルの id。チャネルを持たないプロバイダーは null。受け手は設定で受けるチャネルを選ぶ)
161
+ */
162
+ export type MessageReceived = Readonly<{
163
+ provider: string;
164
+ channelId: string | null;
165
+ eventId: string;
166
+ from: MessageSender;
167
+ at: string;
168
+ redelivery: boolean;
169
+ items: readonly ReceivedItem[];
170
+ }>;
171
+ /** プロバイダーが出す受信(provider はコアが付ける。channelId はプロバイダーのチャネルだけ) */
172
+ export type MessageReceivedInput = Omit<MessageReceived, 'provider' | 'channelId'> & Readonly<{
173
+ channelId?: string;
174
+ }>;
175
+ /** 受信の検査 */
176
+ export declare const messageReceivedInput: z.ZodObject<{
177
+ channelId: z.ZodOptional<z.ZodString>;
178
+ eventId: z.ZodString;
179
+ from: z.ZodUnion<readonly [z.ZodObject<{
180
+ endUserId: z.ZodString;
181
+ }, z.core.$strict>, z.ZodObject<{
182
+ channel: z.ZodEnum<{
183
+ email: "email";
184
+ sms: "sms";
185
+ }>;
186
+ address: z.ZodString;
187
+ name: z.ZodOptional<z.ZodString>;
188
+ }, z.core.$strict>]>;
189
+ at: z.ZodISODateTime;
190
+ redelivery: z.ZodBoolean;
191
+ items: z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
192
+ kind: z.ZodLiteral<"text">;
193
+ text: z.ZodString;
194
+ }, z.core.$strict>, z.ZodObject<{
195
+ kind: z.ZodLiteral<"image">;
196
+ url: z.ZodString;
197
+ previewUrl: z.ZodOptional<z.ZodString>;
198
+ }, z.core.$strict>, z.ZodObject<{
199
+ kind: z.ZodString;
200
+ }, z.core.$catchall<z.ZodUnknown>>]>, z.ZodObject<{
201
+ kind: z.ZodLiteral<"action">;
202
+ data: z.ZodString;
203
+ }, z.core.$strict>]>>;
204
+ }, z.core.$strict>;
205
+ /** メッセージの能力(kind)の一覧 */
206
+ export declare const messageKindsOf: (messages: readonly Readonly<{
207
+ kind: string;
208
+ }>[]) => string[];
@@ -1,4 +1,4 @@
1
- /** コレクションごとの行の数(取り出し元ごと。人はコレクション CUSTOMER_MAP_TYPE) */
1
+ /** コレクションごとの行の数(取り出し元ごと。人はコレクション END_USER_MAP_TYPE) */
2
2
  export type SourceCounts = Readonly<Record<string, Readonly<Record<string, number>>>>;
3
3
  /**
4
4
  * 計画の本文(ほかのキーは診断と人が埋めた判断)
@@ -64,7 +64,7 @@ export declare const VERIFY_PAGE_MAX = 200;
64
64
  * - collections: コレクションごと、状態ごとの対応表の行の数(知らない状態も数える。ページによらず全部)
65
65
  * - runs: 完了した取り込みの実行(plan は完了のときに結んだ計画、なしは null。ページによらず全部)
66
66
  * - missing: このページの有効か2段目待ちの対応表の行で、行(人は人)がない数(コレクションごと)
67
- * - dangling: このページの有効な対応表の行のうち、参照の項目か顧客フィールドの先がない値の位置(id は新しい ID、path は項目の道)
67
+ * - dangling: このページの有効な対応表の行のうち、参照の項目かエンドユーザーへの参照のフィールドの先がない値の位置(id は新しい ID、path は項目の道)
68
68
  * - next: 次のページの after(コレクションと新しい ID)、なしは終わり
69
69
  */
70
70
  export type TransferCounts = Readonly<{
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ /** 通知のポート */
3
+ export declare const NOTICES_PORT: "tunasand:notices@1";
4
+ /**
5
+ * 通知の1件
6
+ * - collection と record は対象の id、at は日時(UTC の ISO 8601)
7
+ * - by: 差出人(account はアカウントの ID、owners は対象のレコードの持ち主、なしは null)
8
+ * - standing: 対応するまで残る件か(偽は、開いたときに既読になる件)
9
+ */
10
+ declare const appNotice: z.ZodObject<{
11
+ kind: z.ZodString;
12
+ collection: z.ZodString;
13
+ record: z.ZodString;
14
+ at: z.ZodISODateTime;
15
+ by: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
16
+ account: z.ZodString;
17
+ }, z.core.$strip>, z.ZodLiteral<"owners">]>>;
18
+ standing: z.ZodBoolean;
19
+ }, z.core.$strip>;
20
+ /** 提供者の結果の検査の形 */
21
+ export declare const appNotices: z.ZodObject<{
22
+ notices: z.ZodArray<z.ZodObject<{
23
+ kind: z.ZodString;
24
+ collection: z.ZodString;
25
+ record: z.ZodString;
26
+ at: z.ZodISODateTime;
27
+ by: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
28
+ account: z.ZodString;
29
+ }, z.core.$strip>, z.ZodLiteral<"owners">]>>;
30
+ standing: z.ZodBoolean;
31
+ }, z.core.$strip>>;
32
+ }, z.core.$strip>;
33
+ export type AppNotice = Readonly<z.infer<typeof appNotice>>;
34
+ export type AppNotices = Readonly<{
35
+ notices: readonly AppNotice[];
36
+ }>;
37
+ export {};