@tunasand/sdk 0.11.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 (70) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +6 -4
  3. package/dist/analytics.js +113 -50
  4. package/dist/app.js +98 -9
  5. package/dist/{apps-DIxAWBSZ.js → apps-BysPfMuR.js} +102 -12
  6. package/dist/{bridge-Dv4NxGZ7.js → bridge-C2Bl-OAF.js} +1 -2
  7. package/dist/bridge.js +1 -1
  8. package/dist/cli.js +2 -2
  9. package/dist/{collection-nUz1RetA.js → collection-26aglrg6.js} +20 -2
  10. package/dist/delivery.js +1 -1
  11. package/dist/{embeds-B-Dbn64k.js → embeds-DY6O5TrJ.js} +2 -2
  12. package/dist/end-users.js +29 -25
  13. package/dist/{errorLabels-aT2bnMsO.js → errorLabels-BK1NJ6Wz.js} +21 -5
  14. package/dist/i18n.js +2 -2
  15. package/dist/integrations.js +2 -2
  16. package/dist/{ja-CrY_72Tn.js → ja-B3lAaOhZ.js} +13 -11
  17. package/dist/{workflow-CUpl6hO_.js → paymentPort-p1jV44Zz.js} +57 -2
  18. package/dist/{schema-Dcg1ajnW.js → schema-Bs_BUUNv.js} +35 -7
  19. package/dist/schema.js +4 -4
  20. package/dist/types/access/src/handoff.d.ts +1 -1
  21. package/dist/types/access/src/oidc.d.ts +2 -0
  22. package/dist/types/contract/src/api/define.d.ts +165 -0
  23. package/dist/types/contract/src/app.d.ts +22 -7
  24. package/dist/types/contract/src/appChannels.d.ts +65 -27
  25. package/dist/types/contract/src/appDependencies.d.ts +22 -2
  26. package/dist/types/contract/src/appInbound.d.ts +26 -1
  27. package/dist/types/contract/src/appSecrets.d.ts +18 -0
  28. package/dist/types/contract/src/appServer.d.ts +57 -7
  29. package/dist/types/contract/src/apps.d.ts +15 -6
  30. package/dist/types/contract/src/auditActions.d.ts +2 -2
  31. package/dist/types/contract/src/auditLabels.d.ts +10 -1
  32. package/dist/types/contract/src/authorize.d.ts +1 -1
  33. package/dist/types/contract/src/bridge.d.ts +1 -1
  34. package/dist/types/contract/src/consents.d.ts +1 -6
  35. package/dist/types/contract/src/embeds.d.ts +11 -9
  36. package/dist/types/contract/src/endUsers.d.ts +3 -0
  37. package/dist/types/contract/src/errorLabels.d.ts +4 -1
  38. package/dist/types/contract/src/errorLabelsEn.d.ts +4 -1
  39. package/dist/types/contract/src/errors.d.ts +2 -2
  40. package/dist/types/contract/src/eventTraces.d.ts +0 -2
  41. package/dist/types/contract/src/hostingRpc.d.ts +21 -2
  42. package/dist/types/contract/src/import.d.ts +3 -3
  43. package/dist/types/contract/src/index.d.ts +16 -13
  44. package/dist/types/contract/src/issueLabels.d.ts +11 -3
  45. package/dist/types/contract/src/issueLabelsEn.d.ts +4 -0
  46. package/dist/types/contract/src/manage.d.ts +5 -0
  47. package/dist/types/contract/src/notices.d.ts +2 -3
  48. package/dist/types/contract/src/operationEffects.d.ts +39 -0
  49. package/dist/types/contract/src/operatorOperations.d.ts +104 -47
  50. package/dist/types/contract/src/paymentPort.d.ts +129 -0
  51. package/dist/types/contract/src/readPages.d.ts +92 -0
  52. package/dist/types/contract/src/roles.d.ts +2 -2
  53. package/dist/types/contract/src/settingProblems.d.ts +18 -1
  54. package/dist/types/contract/src/workflow.d.ts +5 -2
  55. package/dist/types/contract/src/workspaceItems.d.ts +3 -1
  56. package/dist/types/contract/src/workspacePaths.d.ts +1 -1
  57. package/dist/types/schema/src/collection.d.ts +4 -0
  58. package/dist/types/schema/src/file.d.ts +2 -0
  59. package/dist/types/schema/src/index.d.ts +3 -2
  60. package/dist/types/schema/src/indexes.d.ts +11 -0
  61. package/dist/types/schema/src/labels/en.d.ts +2 -0
  62. package/dist/types/schema/src/labels/ja.d.ts +13 -11
  63. package/dist/types/schema/src/problems.d.ts +13 -11
  64. package/dist/types/sdk/src/app.d.ts +11 -8
  65. package/dist/types/sdk/src/end-users.d.ts +12 -15
  66. package/dist/types/sdk/src/schema.d.ts +1 -1
  67. package/dist/{types-DkO2N7u2.js → types-CYnY-63C.js} +1 -1
  68. package/dist/types.js +1 -1
  69. package/dist/{typesSource-VJIxtN9b.js → typesSource-BTA9-rcB.js} +1 -1
  70. package/package.json +2 -2
@@ -12,7 +12,7 @@ export type OperatorWhen = 'trial' | 'legacy' | 'notLive';
12
12
  export type OperatorOperation = Readonly<{
13
13
  id: string;
14
14
  cli?: string;
15
- method?: 'GET' | 'POST';
15
+ method?: 'GET' | 'POST' | 'DELETE';
16
16
  path?: string;
17
17
  level: OperatorLevel;
18
18
  secret?: boolean;
@@ -39,24 +39,46 @@ export declare const OPERATOR_OPERATIONS: readonly [{
39
39
  };
40
40
  readonly available: true;
41
41
  }, {
42
- readonly id: "secrets";
43
- readonly cli: "secrets";
42
+ readonly id: "migrate";
43
+ readonly cli: "migrate";
44
+ readonly method: "POST";
45
+ readonly path: "/registry:migrate";
46
+ readonly level: "reversible";
47
+ readonly place: {
48
+ readonly screen: "maintenance";
49
+ };
50
+ readonly available: true;
51
+ }, {
52
+ readonly id: "one-time-targets";
44
53
  readonly method: "GET";
45
- readonly path: "/secrets";
54
+ readonly path: "/one-time";
46
55
  readonly level: "read";
47
56
  readonly place: {
48
57
  readonly screen: "maintenance";
49
58
  };
50
59
  readonly available: true;
51
60
  }, {
52
- readonly id: "migrate";
53
- readonly cli: "migrate";
61
+ readonly id: "one-time";
54
62
  readonly method: "POST";
55
- readonly path: "/migrate";
63
+ readonly path: "/projects/{project}:run-one-time";
56
64
  readonly level: "reversible";
57
65
  readonly place: {
58
- readonly screen: "maintenance";
66
+ readonly screen: "project";
67
+ readonly tab: OperatorProjectTab;
59
68
  };
69
+ readonly environment: true;
70
+ readonly available: true;
71
+ }, {
72
+ readonly id: "secrets";
73
+ readonly cli: "secrets";
74
+ readonly method: "GET";
75
+ readonly path: "/projects/{project}/secrets";
76
+ readonly level: "read";
77
+ readonly place: {
78
+ readonly screen: "project";
79
+ readonly tab: OperatorProjectTab;
80
+ };
81
+ readonly environment: true;
60
82
  readonly available: true;
61
83
  }, {
62
84
  readonly id: "session";
@@ -72,7 +94,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
72
94
  readonly id: "paused";
73
95
  readonly cli: "paused";
74
96
  readonly method: "GET";
75
- readonly path: "/paused";
97
+ readonly path: "/registry";
76
98
  readonly level: "read";
77
99
  readonly place: {
78
100
  readonly screen: "maintenance";
@@ -82,7 +104,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
82
104
  readonly id: "pause";
83
105
  readonly cli: "pause";
84
106
  readonly method: "POST";
85
- readonly path: "/pause";
107
+ readonly path: "/registry:pause";
86
108
  readonly level: "heavy";
87
109
  readonly place: {
88
110
  readonly screen: "maintenance";
@@ -92,7 +114,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
92
114
  readonly id: "resume";
93
115
  readonly cli: "resume";
94
116
  readonly method: "POST";
95
- readonly path: "/resume";
117
+ readonly path: "/registry:resume";
96
118
  readonly level: "reversible";
97
119
  readonly place: {
98
120
  readonly screen: "maintenance";
@@ -108,6 +130,25 @@ export declare const OPERATOR_OPERATIONS: readonly [{
108
130
  readonly screen: "projects";
109
131
  };
110
132
  readonly available: true;
133
+ }, {
134
+ readonly id: "organizations";
135
+ readonly cli: "organizations";
136
+ readonly method: "GET";
137
+ readonly path: "/organizations";
138
+ readonly level: "read";
139
+ readonly place: {
140
+ readonly screen: "organizations";
141
+ };
142
+ readonly available: true;
143
+ }, {
144
+ readonly id: "organization-sync";
145
+ readonly method: "POST";
146
+ readonly path: "/organizations:sync";
147
+ readonly level: "read";
148
+ readonly place: {
149
+ readonly screen: "organizations";
150
+ };
151
+ readonly available: true;
111
152
  }, {
112
153
  readonly id: "create";
113
154
  readonly cli: "create";
@@ -121,8 +162,6 @@ export declare const OPERATOR_OPERATIONS: readonly [{
121
162
  }, {
122
163
  readonly id: "hosting";
123
164
  readonly cli: "hosting";
124
- readonly method: "POST";
125
- readonly path: "/hosting";
126
165
  readonly level: "heavy";
127
166
  readonly place: {
128
167
  readonly screen: "hosting";
@@ -148,6 +187,15 @@ export declare const OPERATOR_OPERATIONS: readonly [{
148
187
  readonly screen: "apps";
149
188
  };
150
189
  readonly available: true;
190
+ }, {
191
+ readonly id: "standard-app-candidates";
192
+ readonly method: "GET";
193
+ readonly path: "/standard-app-candidates";
194
+ readonly level: "read";
195
+ readonly place: {
196
+ readonly screen: "apps";
197
+ };
198
+ readonly available: true;
151
199
  }, {
152
200
  readonly id: "standard-app-set";
153
201
  readonly cli: "standard-app-set";
@@ -161,8 +209,8 @@ export declare const OPERATOR_OPERATIONS: readonly [{
161
209
  }, {
162
210
  readonly id: "standard-app-remove";
163
211
  readonly cli: "standard-app-remove";
164
- readonly method: "POST";
165
- readonly path: "/standard-apps/{app}/remove";
212
+ readonly method: "DELETE";
213
+ readonly path: "/standard-apps/{app}";
166
214
  readonly level: "heavy";
167
215
  readonly place: {
168
216
  readonly screen: "apps";
@@ -202,7 +250,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
202
250
  readonly id: "app-keys";
203
251
  readonly cli: "app-keys";
204
252
  readonly method: "POST";
205
- readonly path: "/apps/{app}/keys";
253
+ readonly path: "/apps/{app}:set-keys";
206
254
  readonly level: "heavy";
207
255
  readonly place: {
208
256
  readonly screen: "apps";
@@ -222,7 +270,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
222
270
  readonly id: "registry-backup";
223
271
  readonly cli: "backup";
224
272
  readonly method: "POST";
225
- readonly path: "/backups/registry";
273
+ readonly path: "/backups:registry";
226
274
  readonly level: "reversible";
227
275
  readonly place: {
228
276
  readonly screen: "maintenance";
@@ -232,7 +280,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
232
280
  readonly id: "registry-download";
233
281
  readonly cli: "backup:download";
234
282
  readonly method: "GET";
235
- readonly path: "/backups/download?registry";
283
+ readonly path: "/backups/{backup}:download?registry";
236
284
  readonly level: "read";
237
285
  readonly place: {
238
286
  readonly screen: "maintenance";
@@ -273,8 +321,8 @@ export declare const OPERATOR_OPERATIONS: readonly [{
273
321
  }, {
274
322
  readonly id: "delete-project";
275
323
  readonly cli: "delete-project";
276
- readonly method: "POST";
277
- readonly path: "/projects/{project}/delete-project";
324
+ readonly method: "DELETE";
325
+ readonly path: "/projects/{project}";
278
326
  readonly level: "irreversible";
279
327
  readonly place: {
280
328
  readonly screen: "project";
@@ -284,8 +332,8 @@ export declare const OPERATOR_OPERATIONS: readonly [{
284
332
  }, {
285
333
  readonly id: "delete-trial";
286
334
  readonly cli: "delete-trial";
287
- readonly method: "POST";
288
- readonly path: "/projects/{project}/delete-trial";
335
+ readonly method: "DELETE";
336
+ readonly path: "/projects/{project}";
289
337
  readonly level: "irreversible";
290
338
  readonly place: {
291
339
  readonly screen: "project";
@@ -308,7 +356,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
308
356
  readonly id: "copy-env";
309
357
  readonly cli: "copy-env";
310
358
  readonly method: "POST";
311
- readonly path: "/projects/{project}/copy-environment";
359
+ readonly path: "/projects/{project}/environments:copy";
312
360
  readonly level: "heavy";
313
361
  readonly place: {
314
362
  readonly screen: "project";
@@ -318,8 +366,8 @@ export declare const OPERATOR_OPERATIONS: readonly [{
318
366
  }, {
319
367
  readonly id: "delete-env";
320
368
  readonly cli: "delete-env";
321
- readonly method: "POST";
322
- readonly path: "/projects/{project}/delete-environment";
369
+ readonly method: "DELETE";
370
+ readonly path: "/projects/{project}/environments/{environment}";
323
371
  readonly level: "irreversible";
324
372
  readonly place: {
325
373
  readonly screen: "project";
@@ -331,7 +379,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
331
379
  readonly id: "freeze";
332
380
  readonly cli: "freeze";
333
381
  readonly method: "POST";
334
- readonly path: "/projects/{project}/freeze";
382
+ readonly path: "/projects/{project}:freeze";
335
383
  readonly level: "heavy";
336
384
  readonly place: {
337
385
  readonly screen: "project";
@@ -342,7 +390,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
342
390
  readonly id: "unfreeze";
343
391
  readonly cli: "unfreeze";
344
392
  readonly method: "POST";
345
- readonly path: "/projects/{project}/unfreeze";
393
+ readonly path: "/projects/{project}:unfreeze";
346
394
  readonly level: "reversible";
347
395
  readonly place: {
348
396
  readonly screen: "project";
@@ -353,7 +401,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
353
401
  readonly id: "promote-plan";
354
402
  readonly cli: "promote-plan";
355
403
  readonly method: "POST";
356
- readonly path: "/projects/{project}/promote-plan";
404
+ readonly path: "/projects/{project}:plan-promotion";
357
405
  readonly level: "read";
358
406
  readonly place: {
359
407
  readonly screen: "project";
@@ -365,7 +413,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
365
413
  readonly id: "promote-commit";
366
414
  readonly cli: "promote-commit";
367
415
  readonly method: "POST";
368
- readonly path: "/projects/{project}/promote-commit";
416
+ readonly path: "/projects/{project}:promote";
369
417
  readonly level: "heavy";
370
418
  readonly place: {
371
419
  readonly screen: "project";
@@ -377,7 +425,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
377
425
  readonly id: "prune";
378
426
  readonly cli: "prune";
379
427
  readonly method: "POST";
380
- readonly path: "/projects/{project}/prune";
428
+ readonly path: "/projects/{project}:prune";
381
429
  readonly level: "irreversible";
382
430
  readonly place: {
383
431
  readonly screen: "project";
@@ -402,7 +450,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
402
450
  readonly id: "download";
403
451
  readonly cli: "backup:download";
404
452
  readonly method: "GET";
405
- readonly path: "/backups/download?project={project}";
453
+ readonly path: "/backups/{backup}:download?project={project}";
406
454
  readonly level: "read";
407
455
  readonly place: {
408
456
  readonly screen: "project";
@@ -414,7 +462,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
414
462
  readonly id: "backup";
415
463
  readonly cli: "backup";
416
464
  readonly method: "POST";
417
- readonly path: "/projects/{project}/backup";
465
+ readonly path: "/projects/{project}:backup";
418
466
  readonly level: "reversible";
419
467
  readonly place: {
420
468
  readonly screen: "project";
@@ -426,7 +474,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
426
474
  readonly id: "restore";
427
475
  readonly cli: "restore";
428
476
  readonly method: "POST";
429
- readonly path: "/projects/{project}/restore";
477
+ readonly path: "/projects/{project}:restore";
430
478
  readonly level: "irreversible";
431
479
  readonly place: {
432
480
  readonly screen: "project";
@@ -439,7 +487,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
439
487
  readonly id: "import";
440
488
  readonly cli: "import";
441
489
  readonly method: "POST";
442
- readonly path: "/projects/{project}/import";
490
+ readonly path: "/projects/{project}:import";
443
491
  readonly level: "irreversible";
444
492
  readonly place: {
445
493
  readonly screen: "project";
@@ -452,7 +500,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
452
500
  readonly id: "switch-host";
453
501
  readonly cli: "switch-host";
454
502
  readonly method: "POST";
455
- readonly path: "/projects/{project}/hosts";
503
+ readonly path: "/projects/{project}/hosts:switch";
456
504
  readonly level: "heavy";
457
505
  readonly place: {
458
506
  readonly screen: "project";
@@ -463,7 +511,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
463
511
  readonly id: "set-host";
464
512
  readonly cli: "set-host";
465
513
  readonly method: "POST";
466
- readonly path: "/projects/{project}/hosts";
514
+ readonly path: "/projects/{project}/hosts:replace";
467
515
  readonly level: "heavy";
468
516
  readonly place: {
469
517
  readonly screen: "project";
@@ -474,7 +522,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
474
522
  readonly id: "remove-alias";
475
523
  readonly cli: "remove-alias";
476
524
  readonly method: "POST";
477
- readonly path: "/projects/{project}/hosts";
525
+ readonly path: "/projects/{project}/hosts:remove-alias";
478
526
  readonly level: "heavy";
479
527
  readonly place: {
480
528
  readonly screen: "project";
@@ -485,7 +533,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
485
533
  readonly id: "emergency";
486
534
  readonly cli: "emergency";
487
535
  readonly method: "POST";
488
- readonly path: "/projects/{project}/emergency";
536
+ readonly path: "/projects/{project}:emergency";
489
537
  readonly level: "heavy";
490
538
  readonly place: {
491
539
  readonly screen: "project";
@@ -496,7 +544,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
496
544
  readonly id: "revoke-grants";
497
545
  readonly cli: "revoke-grants";
498
546
  readonly method: "POST";
499
- readonly path: "/projects/{project}/revoke-grants";
547
+ readonly path: "/projects/{project}:revoke-grants";
500
548
  readonly level: "reversible";
501
549
  readonly place: {
502
550
  readonly screen: "project";
@@ -508,7 +556,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
508
556
  readonly id: "api-key-create";
509
557
  readonly cli: "api-key-create";
510
558
  readonly method: "POST";
511
- readonly path: "/projects/{project}/api-key-create";
559
+ readonly path: "/projects/{project}/api-keys";
512
560
  readonly level: "heavy";
513
561
  readonly secret: true;
514
562
  readonly place: {
@@ -516,11 +564,22 @@ export declare const OPERATOR_OPERATIONS: readonly [{
516
564
  readonly tab: OperatorProjectTab;
517
565
  };
518
566
  readonly available: true;
567
+ }, {
568
+ readonly id: "channel-key";
569
+ readonly cli: "channel-key";
570
+ readonly method: "POST";
571
+ readonly path: "/projects/{project}:issue-channel-key";
572
+ readonly level: "heavy";
573
+ readonly place: {
574
+ readonly screen: "project";
575
+ readonly tab: OperatorProjectTab;
576
+ };
577
+ readonly available: true;
519
578
  }, {
520
579
  readonly id: "test-integration";
521
580
  readonly cli: "test-integration";
522
581
  readonly method: "POST";
523
- readonly path: "/projects/{project}/integrations/{registration}/test";
582
+ readonly path: "/projects/{project}/integrations/{registration}:test";
524
583
  readonly level: "reversible";
525
584
  readonly place: {
526
585
  readonly screen: "project";
@@ -531,7 +590,7 @@ export declare const OPERATOR_OPERATIONS: readonly [{
531
590
  readonly id: "trial-session";
532
591
  readonly cli: "trial-session";
533
592
  readonly method: "POST";
534
- readonly path: "/projects/{project}/trial-session";
593
+ readonly path: "/projects/{project}:start-trial-session";
535
594
  readonly level: "reversible";
536
595
  readonly secret: true;
537
596
  readonly place: {
@@ -614,8 +673,6 @@ export declare const OPERATOR_OPERATIONS: readonly [{
614
673
  }];
615
674
  /** 操作の ID */
616
675
  export type OperatorOperationId = (typeof OPERATOR_OPERATIONS)[number]['id'];
617
- /** 本文に固定で足す値(ホスト名の操作の mode) */
618
- export declare const OPERATOR_FIXED_BODY: Readonly<Partial<Record<OperatorOperationId, Readonly<Record<string, unknown>>>>>;
619
676
  /** ホスティングするサイトの操作の段(purge はサイトの削除、stop と reattach は直近のログイン、ほかは確かめない) */
620
677
  export declare const HOSTING_LEVELS: {
621
678
  readonly stop: "heavy";
@@ -634,7 +691,7 @@ export declare const operatorOperation: (id: OperatorOperationId) => OperatorOpe
634
691
  /** 直近のログインを確かめる段か */
635
692
  export declare const needsRecentLogin: (level: OperatorLevel) => boolean;
636
693
  /**
637
- * 変更の要求(POST、/api を外したパス)の段(表にない経路は null)
638
- * - 同じ経路の操作(ホスト名の3つ)は同じ段。hosting は本文の action ごと(不明な action は heavy)
694
+ * 変更の要求(POST と DELETE、/api を外したパス)の段(表にない経路は null)
695
+ * - 同じ経路の操作(プロジェクトの削除の2つ)は同じ段。ホスティングの操作は経路の操作ごと(HOSTING_LEVELS)
639
696
  */
640
- export declare function levelOfRequest(pathname: string, body: Readonly<Record<string, unknown>> | null): OperatorLevel | null;
697
+ export declare function levelOfRequest(method: string, pathname: string, body: Readonly<Record<string, unknown>> | null): OperatorLevel | null;
@@ -0,0 +1,129 @@
1
+ import { z } from 'zod';
2
+ import type { ChannelMode } from './appChannels.js';
3
+ /** ポートの id */
4
+ export declare const PAYMENT_PORT: "tunasand:payment@1";
5
+ /** 価格の種類(one_time: 買い切り、recurring: 継続) */
6
+ export declare const PRICE_KINDS: readonly ["one_time", "recurring"];
7
+ export type PriceKind = (typeof PRICE_KINDS)[number];
8
+ /** 継続の周期 */
9
+ export declare const PRICE_INTERVALS: readonly ["month", "year"];
10
+ export type PriceInterval = (typeof PRICE_INTERVALS)[number];
11
+ /** 通貨(ISO 4217の小文字。金額は通貨の最小の単位の整数) */
12
+ export declare const PRICE_CURRENCIES: readonly ["jpy", "usd"];
13
+ export type PriceCurrency = (typeof PRICE_CURRENCIES)[number];
14
+ /** 購入の状態 */
15
+ export declare const PURCHASE_STATUSES: readonly ["paid", "refunded"];
16
+ export type PurchaseStatus = (typeof PURCHASE_STATUSES)[number];
17
+ /** 購読の状態(外部の決済のサービスの購読の状態の語) */
18
+ export declare const SUBSCRIPTION_STATUSES: readonly ["incomplete", "incomplete_expired", "trialing", "active", "past_due", "unpaid", "paused", "canceled"];
19
+ export type SubscriptionStatus = (typeof SUBSCRIPTION_STATUSES)[number];
20
+ /** 権利が続く購読の状態(past_due は外部のサービスの再試行の間、期間の終わりまで続ける) */
21
+ export declare const ENTITLING_SUBSCRIPTION_STATUSES: readonly ["trialing", "active", "past_due"];
22
+ /** 上限(名前の字数、金額、外部の ID とイベントの ID の字数、URL の字数、冪等キーの字数) */
23
+ export declare const PAYMENT_LIMITS: {
24
+ readonly nameMaxChars: 200;
25
+ readonly amountMax: 99999999;
26
+ readonly refMaxChars: 255;
27
+ readonly urlMaxChars: 2000;
28
+ readonly idempotencyKeyMaxChars: 128;
29
+ };
30
+ /** オファー(target は購入で付く権利の対象のレコード) */
31
+ export type OfferView = Readonly<{
32
+ id: string;
33
+ name: string;
34
+ targetCollection: string;
35
+ targetId: string;
36
+ state: 'active' | 'archived';
37
+ version: number;
38
+ }>;
39
+ /** 価格(lookupKey はプロバイダーが外部の価格と対応づけるキーで、価格を作り直すまで変わらない) */
40
+ export type PriceView = Readonly<{
41
+ id: string;
42
+ offerId: string;
43
+ kind: PriceKind;
44
+ amount: number;
45
+ currency: PriceCurrency;
46
+ interval: PriceInterval | null;
47
+ state: 'active' | 'archived';
48
+ lookupKey: string;
49
+ }>;
50
+ /** 価格の lookup_key(`<オファーの ID>.<価格の ID>`。価格は作った後に金額と周期を変えない) */
51
+ export declare const priceLookupKeyOf: (offerId: string, priceId: string) => string;
52
+ /**
53
+ * 申し込みの依頼(コアからプロバイダーへ。endUserId は購入者で、権利の保持者も同じ人)
54
+ * environmentId は申し込みの環境で、プロバイダーは外部のサービスのメタデータに入れ、sandbox の受信の届け先に返す
55
+ * mode はチャネルの外部のキーのモード(live の方針の環境だけ live)
56
+ */
57
+ export type PaymentCheckoutRequest = Readonly<{
58
+ channelId: string;
59
+ mode: ChannelMode;
60
+ environmentId: string;
61
+ offer: OfferView;
62
+ price: PriceView;
63
+ endUserId: string;
64
+ successUrl: string;
65
+ cancelUrl: string;
66
+ idempotencyKey: string;
67
+ }>;
68
+ /** 申し込みの結果(url は支払いの画面、expiresAt は ISO 8601) */
69
+ export type PaymentCheckout = Readonly<{
70
+ url: string;
71
+ expiresAt: string;
72
+ }>;
73
+ /** 顧客の支払いの画面の依頼 */
74
+ export type PaymentPortalRequest = Readonly<{
75
+ channelId: string;
76
+ mode: ChannelMode;
77
+ endUserId: string;
78
+ returnUrl: string;
79
+ }>;
80
+ /** 申し込みと支払いの画面の戻り先の URL(https だけ) */
81
+ export declare const paymentUrl: z.ZodString;
82
+ /** 購入の反映(買い切りの価格の支払い) */
83
+ export declare const purchaseReflection: z.ZodObject<{
84
+ eventId: z.ZodString;
85
+ channelId: z.ZodString;
86
+ providerRef: z.ZodString;
87
+ offerId: z.ZodString;
88
+ priceId: z.ZodString;
89
+ endUserId: z.ZodString;
90
+ observedAt: z.ZodISODateTime;
91
+ status: z.ZodEnum<{
92
+ paid: "paid";
93
+ refunded: "refunded";
94
+ }>;
95
+ amount: z.ZodNumber;
96
+ currency: z.ZodEnum<{
97
+ jpy: "jpy";
98
+ usd: "usd";
99
+ }>;
100
+ }, z.core.$strict>;
101
+ export type PurchaseReflection = z.infer<typeof purchaseReflection>;
102
+ /** 購読の反映(継続の価格。currentPeriodEnd は ISO 8601) */
103
+ export declare const subscriptionReflection: z.ZodObject<{
104
+ eventId: z.ZodString;
105
+ channelId: z.ZodString;
106
+ providerRef: z.ZodString;
107
+ offerId: z.ZodString;
108
+ priceId: z.ZodString;
109
+ endUserId: z.ZodString;
110
+ observedAt: z.ZodISODateTime;
111
+ status: z.ZodEnum<{
112
+ canceled: "canceled";
113
+ active: "active";
114
+ incomplete: "incomplete";
115
+ incomplete_expired: "incomplete_expired";
116
+ trialing: "trialing";
117
+ past_due: "past_due";
118
+ unpaid: "unpaid";
119
+ paused: "paused";
120
+ }>;
121
+ currentPeriodEnd: z.ZodISODateTime;
122
+ cancelAtPeriodEnd: z.ZodBoolean;
123
+ }, z.core.$strict>;
124
+ export type SubscriptionReflection = z.infer<typeof subscriptionReflection>;
125
+ /** 反映の結果(applied: 状態を変えた、duplicate: 同じイベントを反映済み、stale: 取得の時刻が反映済みの状態より古い) */
126
+ export type ReflectionResult = Readonly<{
127
+ outcome: 'applied' | 'duplicate' | 'stale';
128
+ id: string | null;
129
+ }>;
@@ -0,0 +1,92 @@
1
+ /** 一覧の1要求で返す件数と走査する行の数 */
2
+ export declare const READ_PAGE_LIMITS: {
3
+ /** 件数の指定がないときの件数 */
4
+ readonly itemsDefault: 50;
5
+ /** 指定できる件数の最大(超える指定は拒否) */
6
+ readonly itemsMax: 100;
7
+ /** 1要求で読む行の数の最大(読めない行も数える。達したら続きのカーソルを返す) */
8
+ readonly scannedRowsMax: 1000;
9
+ /** 絞り込みのある件数で数える行の数の最大(達したら capped) */
10
+ readonly countedRowsMax: 10000;
11
+ };
12
+ /** 配信の API の変更の一覧(/v1/changes)の1要求の件数(変更の記録を位置の順に読むだけで、行ごとの読み直しがないため一覧より大きい) */
13
+ export declare const CHANGES_PAGE_LIMITS: {
14
+ readonly itemsDefault: 100;
15
+ readonly itemsMax: 1000;
16
+ };
17
+ /**
18
+ * 資源の集合ごとの件数の上限(作成で超える分を拒み、一覧は上限内の全件を1ページで返す。上限は1ページの件数の最大以下)
19
+ * - 一覧の宣言の boundedList はこのキーを必須にする。キーのない一覧は索引と keyset で読む(docs/specs/http-api.md の「一覧」)
20
+ * - コードとアプリの宣言から導く一覧は、宣言の数の想定の上限(超えた分は次のページ)
21
+ */
22
+ export declare const COLLECTION_SIZE_LIMITS: {
23
+ /** 保存したビュー(コレクションごとの、個人とチームのビューの合計) */
24
+ readonly views: 50;
25
+ /** プロジェクトのチャネル(動いているチャネルの全部の種類の合計) */
26
+ readonly channels: 50;
27
+ /** プロジェクトのロール */
28
+ readonly roles: 50;
29
+ /** 保留中の招待 */
30
+ readonly invitations: 100;
31
+ /** 運営者のサポートのアクセスの付与(取り消していないもの) */
32
+ readonly supportAccess: 20;
33
+ /** 運営者 */
34
+ readonly operators: 50;
35
+ /** プロジェクトのアプリのインストール(サイトとデプロイを含む) */
36
+ readonly installations: 100;
37
+ /** 登録したアプリ(基盤の全体) */
38
+ readonly apps: 100;
39
+ /** コードのアプリ(標準アプリとその候補) */
40
+ readonly codeApps: 50;
41
+ /** インストールしたアプリの埋め込みの宣言(場所ごと) */
42
+ readonly embeds: 100;
43
+ /** アプリが宣言する秘密値(インストールごと、アプリの宣言の上限と同じ) */
44
+ readonly installationSecrets: 20;
45
+ /** ジョブの宣言 */
46
+ readonly jobs: 50;
47
+ /** ロールの表の対象(コレクションとアプリ) */
48
+ readonly permissionTargets: 100;
49
+ /** 通知の1つの提供元の件数 */
50
+ readonly notices: 100;
51
+ /** Webhook */
52
+ readonly webhooks: 50;
53
+ /** 外部の関数 */
54
+ readonly functions: 50;
55
+ /** 外部の画面 */
56
+ readonly screens: 50;
57
+ /** 読み取りのトークン */
58
+ readonly readTokens: 50;
59
+ /** API キー */
60
+ readonly apiKeys: 50;
61
+ /** 送信のドメイン */
62
+ readonly mailDomains: 10;
63
+ /** MCP の接続(プロジェクトの全アカウントの合計) */
64
+ readonly mcpConnections: 100;
65
+ /** プロジェクトの環境 */
66
+ readonly environments: 20;
67
+ /** 定期の書き出し(対象ごと。daily の30日と monthly の365日の保持の期間で決まる、terraform/main.tf のライフサイクル) */
68
+ readonly backups: 50;
69
+ /** 組織のメンバー(招待中を含む。正は platform で、platform の一覧にページ送りがない) */
70
+ readonly organizationMembers: 100;
71
+ /** 記事の作成の絵のタッチ(標準アプリ writing) */
72
+ readonly artStyles: 50;
73
+ /** エンドユーザーのチャネルのブロック(人ごと。プロジェクトのチャネルと、宛先の email と sms) */
74
+ readonly consentChannels: 60;
75
+ /** 閲覧数の順位の件数(標準アプリ content-views の順位の limit の最大) */
76
+ readonly rankingRecords: 100;
77
+ };
78
+ /** 件数の上限の定数のキー */
79
+ export type CollectionSize = keyof typeof COLLECTION_SIZE_LIMITS;
80
+ /**
81
+ * プロジェクトの DB の表のうち、行の数が件数の上限の定数で決まる表(値は上限のキー)
82
+ * - どの一覧の中の読み込みでも、表の全件の走査と並べ替えを許す(一覧の構造の試験が読む)
83
+ * - インストールの部品は、インストールごとにマニフェストの宣言の数まで
84
+ */
85
+ export declare const BOUNDED_TABLES: {
86
+ readonly installation_states: "installations";
87
+ readonly installation_parts: "installations";
88
+ readonly roles: "roles";
89
+ readonly webhooks: "webhooks";
90
+ readonly functions: "functions";
91
+ readonly read_tokens: "readTokens";
92
+ };
@@ -53,8 +53,8 @@ export type User = Readonly<{
53
53
  staffCollections: readonly string[];
54
54
  }>;
55
55
  }>;
56
- /** 管理の領域 admin だけを条件にする操作の ID(/api/me の can でこの操作を見て、管理の領域を扱えるかを決める) */
57
- export declare const ADMIN_AREA_OPERATION = "job.run";
56
+ /** 管理の領域 admin を扱えるかの可否の ID(/api/me の can。操作の宣言の ID と重ならない専用の ID) */
57
+ export declare const ADMIN_AREA_OPERATION = "area.admin";
58
58
  /** ロールの表示の確認で、確かめるロールの ID を送るヘッダー(画面のログインの GET だけ。主体をそのロールの権限の表に替える) */
59
59
  export declare const VIEW_AS_HEADER = "tunasand-view-as";
60
60
  /** 設定を扱える(管理者のロールの)アカウントか */
@@ -1,6 +1,7 @@
1
1
  import { type ParamValue } from '../../i18n/src/index.js';
2
+ import type { AppSettingRowField } from './appDependencies.js';
2
3
  /** アプリの設定値の問題のコード */
3
- export declare const SETTING_PROBLEMS: readonly ["text", "integer_min", "integer_max", "boolean", "text_list", "choice", "duplicate", "required", "shape"];
4
+ export declare const SETTING_PROBLEMS: readonly ["text", "integer_min", "integer_max", "boolean", "text_list", "choice", "duplicate", "required", "shape", "row_text"];
4
5
  export type SettingProblemCode = (typeof SETTING_PROBLEMS)[number];
5
6
  /** アプリの設定値の問題(key は設定値のキー、params は文に差し込む値) */
6
7
  export declare class SettingProblem extends Error {
@@ -11,3 +12,19 @@ export declare class SettingProblem extends Error {
11
12
  }
12
13
  /** 設定値の問題の既定の形(field は項目名) */
13
14
  export declare const settingProblemText: (p: SettingProblem, field: string) => string;
15
+ /** 繰り返しフィールドの行(必須のフィールドは文字列、任意のフィールドは空なら除外) */
16
+ export type SettingRow<F extends readonly AppSettingRowField[] = readonly AppSettingRowField[]> = Readonly<{
17
+ [K in F[number] as K extends {
18
+ required: true;
19
+ } ? K['key'] : never]: string;
20
+ } & {
21
+ [K in F[number] as K extends {
22
+ required: true;
23
+ } ? never : K['key']]?: string;
24
+ }>;
25
+ /**
26
+ * 繰り返しフィールド(repeater)の値の検証(不正な値は例外)
27
+ * - 行番号 row は1から、sub はフィールドの表示名
28
+ * - 定義にないフィールドと、任意のフィールドの空文字は除外する
29
+ */
30
+ export declare function settingRowsOf<const F extends readonly AppSettingRowField[]>(key: string, value: unknown, fields: F): SettingRow<F>[];