@voyant-travel/apps 0.2.0 → 0.4.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 (41) hide show
  1. package/dist/access-boundary.d.ts +29 -0
  2. package/dist/access-boundary.js +33 -0
  3. package/dist/api-runtime.d.ts +15 -0
  4. package/dist/api-runtime.js +15 -1
  5. package/dist/app-api-contracts.d.ts +51 -0
  6. package/dist/app-api-contracts.js +50 -0
  7. package/dist/app-api-routes.d.ts +28 -0
  8. package/dist/app-api-routes.js +141 -0
  9. package/dist/app-api-service.d.ts +1263 -0
  10. package/dist/app-api-service.js +244 -0
  11. package/dist/app-api-service.test.d.ts +1 -0
  12. package/dist/app-api-service.test.js +109 -0
  13. package/dist/consent.d.ts +15 -0
  14. package/dist/consent.js +65 -0
  15. package/dist/consent.test.d.ts +1 -0
  16. package/dist/consent.test.js +104 -0
  17. package/dist/contracts.d.ts +82 -3
  18. package/dist/contracts.js +50 -0
  19. package/dist/index.d.ts +8 -1
  20. package/dist/index.js +8 -1
  21. package/dist/installation-reconciliation.d.ts +1 -1
  22. package/dist/installation-reconciliation.js +5 -1
  23. package/dist/installation-service.d.ts +13 -2
  24. package/dist/installation-service.js +22 -7
  25. package/dist/oauth-crypto.d.ts +8 -0
  26. package/dist/oauth-crypto.js +23 -0
  27. package/dist/oauth-crypto.test.d.ts +1 -0
  28. package/dist/oauth-crypto.test.js +11 -0
  29. package/dist/oauth-service.d.ts +66 -0
  30. package/dist/oauth-service.js +398 -0
  31. package/dist/oauth-service.test.d.ts +1 -0
  32. package/dist/oauth-service.test.js +60 -0
  33. package/dist/routes.d.ts +8 -1
  34. package/dist/routes.js +70 -1
  35. package/dist/schema.d.ts +536 -4
  36. package/dist/schema.js +52 -1
  37. package/dist/service.d.ts +16 -16
  38. package/dist/voyant.js +87 -1
  39. package/migrations/20260717143000_app_oauth_authorization.sql +47 -0
  40. package/migrations/meta/_journal.json +7 -0
  41. package/package.json +40 -4
package/dist/schema.d.ts CHANGED
@@ -7,9 +7,10 @@ export declare const appInstallationStatusEnum: import("drizzle-orm/pg-core").Pg
7
7
  export declare const appInstallationUpdatePolicyEnum: import("drizzle-orm/pg-core").PgEnum<["manual", "compatible", "patch", "pinned"]>;
8
8
  export declare const appGrantStatusEnum: import("drizzle-orm/pg-core").PgEnum<["requested", "granted", "optional", "revoked"]>;
9
9
  export declare const appAccessCredentialStatusEnum: import("drizzle-orm/pg-core").PgEnum<["active", "inactive", "revoked"]>;
10
+ export declare const appAccessTokenModeEnum: import("drizzle-orm/pg-core").PgEnum<["offline", "online"]>;
10
11
  export declare const appInstallationRegistrationStatusEnum: import("drizzle-orm/pg-core").PgEnum<["active", "inactive"]>;
11
12
  export declare const appWebhookSubscriptionStatusEnum: import("drizzle-orm/pg-core").PgEnum<["active", "inactive", "failed"]>;
12
- export declare const appAuditEventKindEnum: import("drizzle-orm/pg-core").PgEnum<["lifecycle", "grant", "credential", "reconciliation", "purge"]>;
13
+ export declare const appAuditEventKindEnum: import("drizzle-orm/pg-core").PgEnum<["lifecycle", "grant", "consent", "credential", "token", "reconciliation", "purge"]>;
13
14
  export declare const apps: import("drizzle-orm/pg-core").PgTableWithColumns<{
14
15
  name: "apps";
15
16
  schema: undefined;
@@ -1062,6 +1063,23 @@ export declare const appInstallations: import("drizzle-orm/pg-core").PgTableWith
1062
1063
  identity: undefined;
1063
1064
  generated: undefined;
1064
1065
  }, {}, {}>;
1066
+ credentialGeneration: import("drizzle-orm/pg-core").PgColumn<{
1067
+ name: "credential_generation";
1068
+ tableName: "app_installations";
1069
+ dataType: "number";
1070
+ columnType: "PgInteger";
1071
+ data: number;
1072
+ driverParam: string | number;
1073
+ notNull: true;
1074
+ hasDefault: true;
1075
+ isPrimaryKey: false;
1076
+ isAutoincrement: false;
1077
+ hasRuntimeDefault: false;
1078
+ enumValues: undefined;
1079
+ baseColumn: never;
1080
+ identity: undefined;
1081
+ generated: undefined;
1082
+ }, {}, {}>;
1065
1083
  updatePolicy: import("drizzle-orm/pg-core").PgColumn<{
1066
1084
  name: "update_policy";
1067
1085
  tableName: "app_installations";
@@ -1363,7 +1381,7 @@ export declare const appGrants: import("drizzle-orm/pg-core").PgTableWithColumns
1363
1381
  tableName: "app_grants";
1364
1382
  dataType: "string";
1365
1383
  columnType: "PgEnumColumn";
1366
- data: "optional" | "requested" | "revoked" | "granted";
1384
+ data: "revoked" | "requested" | "granted" | "optional";
1367
1385
  driverParam: string;
1368
1386
  notNull: true;
1369
1387
  hasDefault: false;
@@ -1501,6 +1519,23 @@ export declare const appAccessCredentials: import("drizzle-orm/pg-core").PgTable
1501
1519
  identity: undefined;
1502
1520
  generated: undefined;
1503
1521
  }, {}, {}>;
1522
+ tokenMode: import("drizzle-orm/pg-core").PgColumn<{
1523
+ name: "token_mode";
1524
+ tableName: "app_access_credentials";
1525
+ dataType: "string";
1526
+ columnType: "PgEnumColumn";
1527
+ data: "offline" | "online";
1528
+ driverParam: string;
1529
+ notNull: true;
1530
+ hasDefault: true;
1531
+ isPrimaryKey: false;
1532
+ isAutoincrement: false;
1533
+ hasRuntimeDefault: false;
1534
+ enumValues: ["offline", "online"];
1535
+ baseColumn: never;
1536
+ identity: undefined;
1537
+ generated: undefined;
1538
+ }, {}, {}>;
1504
1539
  credentialHash: import("drizzle-orm/pg-core").PgColumn<{
1505
1540
  name: "credential_hash";
1506
1541
  tableName: "app_access_credentials";
@@ -1554,6 +1589,40 @@ export declare const appAccessCredentials: import("drizzle-orm/pg-core").PgTable
1554
1589
  identity: undefined;
1555
1590
  generated: undefined;
1556
1591
  }, {}, {}>;
1592
+ actorId: import("drizzle-orm/pg-core").PgColumn<{
1593
+ name: "actor_id";
1594
+ tableName: "app_access_credentials";
1595
+ dataType: "string";
1596
+ columnType: "PgText";
1597
+ data: string;
1598
+ driverParam: string;
1599
+ notNull: false;
1600
+ hasDefault: false;
1601
+ isPrimaryKey: false;
1602
+ isAutoincrement: false;
1603
+ hasRuntimeDefault: false;
1604
+ enumValues: [string, ...string[]];
1605
+ baseColumn: never;
1606
+ identity: undefined;
1607
+ generated: undefined;
1608
+ }, {}, {}>;
1609
+ viewerId: import("drizzle-orm/pg-core").PgColumn<{
1610
+ name: "viewer_id";
1611
+ tableName: "app_access_credentials";
1612
+ dataType: "string";
1613
+ columnType: "PgText";
1614
+ data: string;
1615
+ driverParam: string;
1616
+ notNull: false;
1617
+ hasDefault: false;
1618
+ isPrimaryKey: false;
1619
+ isAutoincrement: false;
1620
+ hasRuntimeDefault: false;
1621
+ enumValues: [string, ...string[]];
1622
+ baseColumn: never;
1623
+ identity: undefined;
1624
+ generated: undefined;
1625
+ }, {}, {}>;
1557
1626
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
1558
1627
  name: "created_at";
1559
1628
  tableName: "app_access_credentials";
@@ -1608,6 +1677,468 @@ export declare const appAccessCredentials: import("drizzle-orm/pg-core").PgTable
1608
1677
  };
1609
1678
  dialect: "pg";
1610
1679
  }>;
1680
+ export declare const appOAuthAuthorizationCodes: import("drizzle-orm/pg-core").PgTableWithColumns<{
1681
+ name: "app_oauth_authorization_codes";
1682
+ schema: undefined;
1683
+ columns: {
1684
+ id: import("drizzle-orm/pg-core").PgColumn<{
1685
+ name: string;
1686
+ tableName: "app_oauth_authorization_codes";
1687
+ dataType: "string";
1688
+ columnType: "PgText";
1689
+ data: string;
1690
+ driverParam: string;
1691
+ notNull: true;
1692
+ hasDefault: true;
1693
+ isPrimaryKey: true;
1694
+ isAutoincrement: false;
1695
+ hasRuntimeDefault: true;
1696
+ enumValues: [string, ...string[]];
1697
+ baseColumn: never;
1698
+ identity: undefined;
1699
+ generated: undefined;
1700
+ }, {}, {}>;
1701
+ appId: import("drizzle-orm/pg-core").PgColumn<{
1702
+ name: "app_id";
1703
+ tableName: "app_oauth_authorization_codes";
1704
+ dataType: "string";
1705
+ columnType: "PgText";
1706
+ data: string;
1707
+ driverParam: string;
1708
+ notNull: true;
1709
+ hasDefault: false;
1710
+ isPrimaryKey: false;
1711
+ isAutoincrement: false;
1712
+ hasRuntimeDefault: false;
1713
+ enumValues: [string, ...string[]];
1714
+ baseColumn: never;
1715
+ identity: undefined;
1716
+ generated: undefined;
1717
+ }, {}, {}>;
1718
+ installationId: import("drizzle-orm/pg-core").PgColumn<{
1719
+ name: "installation_id";
1720
+ tableName: "app_oauth_authorization_codes";
1721
+ dataType: "string";
1722
+ columnType: "PgText";
1723
+ data: string;
1724
+ driverParam: string;
1725
+ notNull: true;
1726
+ hasDefault: false;
1727
+ isPrimaryKey: false;
1728
+ isAutoincrement: false;
1729
+ hasRuntimeDefault: false;
1730
+ enumValues: [string, ...string[]];
1731
+ baseColumn: never;
1732
+ identity: undefined;
1733
+ generated: undefined;
1734
+ }, {}, {}>;
1735
+ releaseId: import("drizzle-orm/pg-core").PgColumn<{
1736
+ name: "release_id";
1737
+ tableName: "app_oauth_authorization_codes";
1738
+ dataType: "string";
1739
+ columnType: "PgText";
1740
+ data: string;
1741
+ driverParam: string;
1742
+ notNull: true;
1743
+ hasDefault: false;
1744
+ isPrimaryKey: false;
1745
+ isAutoincrement: false;
1746
+ hasRuntimeDefault: false;
1747
+ enumValues: [string, ...string[]];
1748
+ baseColumn: never;
1749
+ identity: undefined;
1750
+ generated: undefined;
1751
+ }, {}, {}>;
1752
+ deploymentId: import("drizzle-orm/pg-core").PgColumn<{
1753
+ name: "deployment_id";
1754
+ tableName: "app_oauth_authorization_codes";
1755
+ dataType: "string";
1756
+ columnType: "PgText";
1757
+ data: string;
1758
+ driverParam: string;
1759
+ notNull: true;
1760
+ hasDefault: false;
1761
+ isPrimaryKey: false;
1762
+ isAutoincrement: false;
1763
+ hasRuntimeDefault: false;
1764
+ enumValues: [string, ...string[]];
1765
+ baseColumn: never;
1766
+ identity: undefined;
1767
+ generated: undefined;
1768
+ }, {}, {}>;
1769
+ codeHash: import("drizzle-orm/pg-core").PgColumn<{
1770
+ name: "code_hash";
1771
+ tableName: "app_oauth_authorization_codes";
1772
+ dataType: "string";
1773
+ columnType: "PgText";
1774
+ data: string;
1775
+ driverParam: string;
1776
+ notNull: true;
1777
+ hasDefault: false;
1778
+ isPrimaryKey: false;
1779
+ isAutoincrement: false;
1780
+ hasRuntimeDefault: false;
1781
+ enumValues: [string, ...string[]];
1782
+ baseColumn: never;
1783
+ identity: undefined;
1784
+ generated: undefined;
1785
+ }, {}, {}>;
1786
+ stateHash: import("drizzle-orm/pg-core").PgColumn<{
1787
+ name: "state_hash";
1788
+ tableName: "app_oauth_authorization_codes";
1789
+ dataType: "string";
1790
+ columnType: "PgText";
1791
+ data: string;
1792
+ driverParam: string;
1793
+ notNull: true;
1794
+ hasDefault: false;
1795
+ isPrimaryKey: false;
1796
+ isAutoincrement: false;
1797
+ hasRuntimeDefault: false;
1798
+ enumValues: [string, ...string[]];
1799
+ baseColumn: never;
1800
+ identity: undefined;
1801
+ generated: undefined;
1802
+ }, {}, {}>;
1803
+ redirectUri: import("drizzle-orm/pg-core").PgColumn<{
1804
+ name: "redirect_uri";
1805
+ tableName: "app_oauth_authorization_codes";
1806
+ dataType: "string";
1807
+ columnType: "PgText";
1808
+ data: string;
1809
+ driverParam: string;
1810
+ notNull: true;
1811
+ hasDefault: false;
1812
+ isPrimaryKey: false;
1813
+ isAutoincrement: false;
1814
+ hasRuntimeDefault: false;
1815
+ enumValues: [string, ...string[]];
1816
+ baseColumn: never;
1817
+ identity: undefined;
1818
+ generated: undefined;
1819
+ }, {}, {}>;
1820
+ codeChallenge: import("drizzle-orm/pg-core").PgColumn<{
1821
+ name: "code_challenge";
1822
+ tableName: "app_oauth_authorization_codes";
1823
+ dataType: "string";
1824
+ columnType: "PgText";
1825
+ data: string;
1826
+ driverParam: string;
1827
+ notNull: true;
1828
+ hasDefault: false;
1829
+ isPrimaryKey: false;
1830
+ isAutoincrement: false;
1831
+ hasRuntimeDefault: false;
1832
+ enumValues: [string, ...string[]];
1833
+ baseColumn: never;
1834
+ identity: undefined;
1835
+ generated: undefined;
1836
+ }, {}, {}>;
1837
+ codeChallengeMethod: import("drizzle-orm/pg-core").PgColumn<{
1838
+ name: "code_challenge_method";
1839
+ tableName: "app_oauth_authorization_codes";
1840
+ dataType: "string";
1841
+ columnType: "PgText";
1842
+ data: string;
1843
+ driverParam: string;
1844
+ notNull: true;
1845
+ hasDefault: false;
1846
+ isPrimaryKey: false;
1847
+ isAutoincrement: false;
1848
+ hasRuntimeDefault: false;
1849
+ enumValues: [string, ...string[]];
1850
+ baseColumn: never;
1851
+ identity: undefined;
1852
+ generated: undefined;
1853
+ }, {}, {}>;
1854
+ requestedScopes: import("drizzle-orm/pg-core").PgColumn<{
1855
+ name: "requested_scopes";
1856
+ tableName: "app_oauth_authorization_codes";
1857
+ dataType: "json";
1858
+ columnType: "PgJsonb";
1859
+ data: string[];
1860
+ driverParam: unknown;
1861
+ notNull: true;
1862
+ hasDefault: false;
1863
+ isPrimaryKey: false;
1864
+ isAutoincrement: false;
1865
+ hasRuntimeDefault: false;
1866
+ enumValues: undefined;
1867
+ baseColumn: never;
1868
+ identity: undefined;
1869
+ generated: undefined;
1870
+ }, {}, {
1871
+ $type: string[];
1872
+ }>;
1873
+ grantedScopes: import("drizzle-orm/pg-core").PgColumn<{
1874
+ name: "granted_scopes";
1875
+ tableName: "app_oauth_authorization_codes";
1876
+ dataType: "json";
1877
+ columnType: "PgJsonb";
1878
+ data: string[];
1879
+ driverParam: unknown;
1880
+ notNull: true;
1881
+ hasDefault: false;
1882
+ isPrimaryKey: false;
1883
+ isAutoincrement: false;
1884
+ hasRuntimeDefault: false;
1885
+ enumValues: undefined;
1886
+ baseColumn: never;
1887
+ identity: undefined;
1888
+ generated: undefined;
1889
+ }, {}, {
1890
+ $type: string[];
1891
+ }>;
1892
+ deniedOptionalScopes: import("drizzle-orm/pg-core").PgColumn<{
1893
+ name: "denied_optional_scopes";
1894
+ tableName: "app_oauth_authorization_codes";
1895
+ dataType: "json";
1896
+ columnType: "PgJsonb";
1897
+ data: string[];
1898
+ driverParam: unknown;
1899
+ notNull: true;
1900
+ hasDefault: false;
1901
+ isPrimaryKey: false;
1902
+ isAutoincrement: false;
1903
+ hasRuntimeDefault: false;
1904
+ enumValues: undefined;
1905
+ baseColumn: never;
1906
+ identity: undefined;
1907
+ generated: undefined;
1908
+ }, {}, {
1909
+ $type: string[];
1910
+ }>;
1911
+ actorId: import("drizzle-orm/pg-core").PgColumn<{
1912
+ name: "actor_id";
1913
+ tableName: "app_oauth_authorization_codes";
1914
+ dataType: "string";
1915
+ columnType: "PgText";
1916
+ data: string;
1917
+ driverParam: string;
1918
+ notNull: true;
1919
+ hasDefault: false;
1920
+ isPrimaryKey: false;
1921
+ isAutoincrement: false;
1922
+ hasRuntimeDefault: false;
1923
+ enumValues: [string, ...string[]];
1924
+ baseColumn: never;
1925
+ identity: undefined;
1926
+ generated: undefined;
1927
+ }, {}, {}>;
1928
+ expiresAt: import("drizzle-orm/pg-core").PgColumn<{
1929
+ name: "expires_at";
1930
+ tableName: "app_oauth_authorization_codes";
1931
+ dataType: "date";
1932
+ columnType: "PgTimestamp";
1933
+ data: Date;
1934
+ driverParam: string;
1935
+ notNull: true;
1936
+ hasDefault: false;
1937
+ isPrimaryKey: false;
1938
+ isAutoincrement: false;
1939
+ hasRuntimeDefault: false;
1940
+ enumValues: undefined;
1941
+ baseColumn: never;
1942
+ identity: undefined;
1943
+ generated: undefined;
1944
+ }, {}, {}>;
1945
+ consumedAt: import("drizzle-orm/pg-core").PgColumn<{
1946
+ name: "consumed_at";
1947
+ tableName: "app_oauth_authorization_codes";
1948
+ dataType: "date";
1949
+ columnType: "PgTimestamp";
1950
+ data: Date;
1951
+ driverParam: string;
1952
+ notNull: false;
1953
+ hasDefault: false;
1954
+ isPrimaryKey: false;
1955
+ isAutoincrement: false;
1956
+ hasRuntimeDefault: false;
1957
+ enumValues: undefined;
1958
+ baseColumn: never;
1959
+ identity: undefined;
1960
+ generated: undefined;
1961
+ }, {}, {}>;
1962
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
1963
+ name: "created_at";
1964
+ tableName: "app_oauth_authorization_codes";
1965
+ dataType: "date";
1966
+ columnType: "PgTimestamp";
1967
+ data: Date;
1968
+ driverParam: string;
1969
+ notNull: true;
1970
+ hasDefault: true;
1971
+ isPrimaryKey: false;
1972
+ isAutoincrement: false;
1973
+ hasRuntimeDefault: false;
1974
+ enumValues: undefined;
1975
+ baseColumn: never;
1976
+ identity: undefined;
1977
+ generated: undefined;
1978
+ }, {}, {}>;
1979
+ };
1980
+ dialect: "pg";
1981
+ }>;
1982
+ export declare const appOAuthRefreshTokens: import("drizzle-orm/pg-core").PgTableWithColumns<{
1983
+ name: "app_oauth_refresh_tokens";
1984
+ schema: undefined;
1985
+ columns: {
1986
+ id: import("drizzle-orm/pg-core").PgColumn<{
1987
+ name: string;
1988
+ tableName: "app_oauth_refresh_tokens";
1989
+ dataType: "string";
1990
+ columnType: "PgText";
1991
+ data: string;
1992
+ driverParam: string;
1993
+ notNull: true;
1994
+ hasDefault: true;
1995
+ isPrimaryKey: true;
1996
+ isAutoincrement: false;
1997
+ hasRuntimeDefault: true;
1998
+ enumValues: [string, ...string[]];
1999
+ baseColumn: never;
2000
+ identity: undefined;
2001
+ generated: undefined;
2002
+ }, {}, {}>;
2003
+ installationId: import("drizzle-orm/pg-core").PgColumn<{
2004
+ name: "installation_id";
2005
+ tableName: "app_oauth_refresh_tokens";
2006
+ dataType: "string";
2007
+ columnType: "PgText";
2008
+ data: string;
2009
+ driverParam: string;
2010
+ notNull: true;
2011
+ hasDefault: false;
2012
+ isPrimaryKey: false;
2013
+ isAutoincrement: false;
2014
+ hasRuntimeDefault: false;
2015
+ enumValues: [string, ...string[]];
2016
+ baseColumn: never;
2017
+ identity: undefined;
2018
+ generated: undefined;
2019
+ }, {}, {}>;
2020
+ tokenHash: import("drizzle-orm/pg-core").PgColumn<{
2021
+ name: "token_hash";
2022
+ tableName: "app_oauth_refresh_tokens";
2023
+ dataType: "string";
2024
+ columnType: "PgText";
2025
+ data: string;
2026
+ driverParam: string;
2027
+ notNull: true;
2028
+ hasDefault: false;
2029
+ isPrimaryKey: false;
2030
+ isAutoincrement: false;
2031
+ hasRuntimeDefault: false;
2032
+ enumValues: [string, ...string[]];
2033
+ baseColumn: never;
2034
+ identity: undefined;
2035
+ generated: undefined;
2036
+ }, {}, {}>;
2037
+ generation: import("drizzle-orm/pg-core").PgColumn<{
2038
+ name: "generation";
2039
+ tableName: "app_oauth_refresh_tokens";
2040
+ dataType: "number";
2041
+ columnType: "PgInteger";
2042
+ data: number;
2043
+ driverParam: string | number;
2044
+ notNull: true;
2045
+ hasDefault: false;
2046
+ isPrimaryKey: false;
2047
+ isAutoincrement: false;
2048
+ hasRuntimeDefault: false;
2049
+ enumValues: undefined;
2050
+ baseColumn: never;
2051
+ identity: undefined;
2052
+ generated: undefined;
2053
+ }, {}, {}>;
2054
+ status: import("drizzle-orm/pg-core").PgColumn<{
2055
+ name: "status";
2056
+ tableName: "app_oauth_refresh_tokens";
2057
+ dataType: "string";
2058
+ columnType: "PgEnumColumn";
2059
+ data: "active" | "revoked" | "inactive";
2060
+ driverParam: string;
2061
+ notNull: true;
2062
+ hasDefault: true;
2063
+ isPrimaryKey: false;
2064
+ isAutoincrement: false;
2065
+ hasRuntimeDefault: false;
2066
+ enumValues: ["active", "inactive", "revoked"];
2067
+ baseColumn: never;
2068
+ identity: undefined;
2069
+ generated: undefined;
2070
+ }, {}, {}>;
2071
+ rotatedFromId: import("drizzle-orm/pg-core").PgColumn<{
2072
+ name: "rotated_from_id";
2073
+ tableName: "app_oauth_refresh_tokens";
2074
+ dataType: "string";
2075
+ columnType: "PgText";
2076
+ data: string;
2077
+ driverParam: string;
2078
+ notNull: false;
2079
+ hasDefault: false;
2080
+ isPrimaryKey: false;
2081
+ isAutoincrement: false;
2082
+ hasRuntimeDefault: false;
2083
+ enumValues: [string, ...string[]];
2084
+ baseColumn: never;
2085
+ identity: undefined;
2086
+ generated: undefined;
2087
+ }, {}, {}>;
2088
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
2089
+ name: "created_at";
2090
+ tableName: "app_oauth_refresh_tokens";
2091
+ dataType: "date";
2092
+ columnType: "PgTimestamp";
2093
+ data: Date;
2094
+ driverParam: string;
2095
+ notNull: true;
2096
+ hasDefault: true;
2097
+ isPrimaryKey: false;
2098
+ isAutoincrement: false;
2099
+ hasRuntimeDefault: false;
2100
+ enumValues: undefined;
2101
+ baseColumn: never;
2102
+ identity: undefined;
2103
+ generated: undefined;
2104
+ }, {}, {}>;
2105
+ expiresAt: import("drizzle-orm/pg-core").PgColumn<{
2106
+ name: "expires_at";
2107
+ tableName: "app_oauth_refresh_tokens";
2108
+ dataType: "date";
2109
+ columnType: "PgTimestamp";
2110
+ data: Date;
2111
+ driverParam: string;
2112
+ notNull: false;
2113
+ hasDefault: false;
2114
+ isPrimaryKey: false;
2115
+ isAutoincrement: false;
2116
+ hasRuntimeDefault: false;
2117
+ enumValues: undefined;
2118
+ baseColumn: never;
2119
+ identity: undefined;
2120
+ generated: undefined;
2121
+ }, {}, {}>;
2122
+ revokedAt: import("drizzle-orm/pg-core").PgColumn<{
2123
+ name: "revoked_at";
2124
+ tableName: "app_oauth_refresh_tokens";
2125
+ dataType: "date";
2126
+ columnType: "PgTimestamp";
2127
+ data: Date;
2128
+ driverParam: string;
2129
+ notNull: false;
2130
+ hasDefault: false;
2131
+ isPrimaryKey: false;
2132
+ isAutoincrement: false;
2133
+ hasRuntimeDefault: false;
2134
+ enumValues: undefined;
2135
+ baseColumn: never;
2136
+ identity: undefined;
2137
+ generated: undefined;
2138
+ }, {}, {}>;
2139
+ };
2140
+ dialect: "pg";
2141
+ }>;
1611
2142
  export declare const appInstallationSettings: import("drizzle-orm/pg-core").PgTableWithColumns<{
1612
2143
  name: "app_installation_settings";
1613
2144
  schema: undefined;
@@ -2329,14 +2860,14 @@ export declare const appAuditEvents: import("drizzle-orm/pg-core").PgTableWithCo
2329
2860
  tableName: "app_audit_events";
2330
2861
  dataType: "string";
2331
2862
  columnType: "PgEnumColumn";
2332
- data: "lifecycle" | "grant" | "credential" | "reconciliation" | "purge";
2863
+ data: "lifecycle" | "grant" | "consent" | "credential" | "token" | "reconciliation" | "purge";
2333
2864
  driverParam: string;
2334
2865
  notNull: true;
2335
2866
  hasDefault: false;
2336
2867
  isPrimaryKey: false;
2337
2868
  isAutoincrement: false;
2338
2869
  hasRuntimeDefault: false;
2339
- enumValues: ["lifecycle", "grant", "credential", "reconciliation", "purge"];
2870
+ enumValues: ["lifecycle", "grant", "consent", "credential", "token", "reconciliation", "purge"];
2340
2871
  baseColumn: never;
2341
2872
  identity: undefined;
2342
2873
  generated: undefined;
@@ -2403,3 +2934,4 @@ export type AppRelease = typeof appReleases.$inferSelect;
2403
2934
  export type NewAppRelease = typeof appReleases.$inferInsert;
2404
2935
  export type AppInstallation = typeof appInstallations.$inferSelect;
2405
2936
  export type NewAppInstallation = typeof appInstallations.$inferInsert;
2937
+ export type AppAccessCredential = typeof appAccessCredentials.$inferSelect;
package/dist/schema.js CHANGED
@@ -39,6 +39,7 @@ export const appAccessCredentialStatusEnum = pgEnum("app_access_credential_statu
39
39
  "inactive",
40
40
  "revoked",
41
41
  ]);
42
+ export const appAccessTokenModeEnum = pgEnum("app_access_token_mode", ["offline", "online"]);
42
43
  export const appInstallationRegistrationStatusEnum = pgEnum("app_installation_registration_status", ["active", "inactive"]);
43
44
  export const appWebhookSubscriptionStatusEnum = pgEnum("app_webhook_subscription_status", [
44
45
  "active",
@@ -48,7 +49,9 @@ export const appWebhookSubscriptionStatusEnum = pgEnum("app_webhook_subscription
48
49
  export const appAuditEventKindEnum = pgEnum("app_audit_event_kind", [
49
50
  "lifecycle",
50
51
  "grant",
52
+ "consent",
51
53
  "credential",
54
+ "token",
52
55
  "reconciliation",
53
56
  "purge",
54
57
  ]);
@@ -158,6 +161,7 @@ export const appInstallations = pgTable("app_installations", {
158
161
  status: appInstallationStatusEnum("status").notNull().default("pending"),
159
162
  namespace: text("namespace").notNull(),
160
163
  installedBy: text("installed_by").notNull(),
164
+ credentialGeneration: integer("credential_generation").notNull().default(0),
161
165
  updatePolicy: appInstallationUpdatePolicyEnum("update_policy").notNull().default("compatible"),
162
166
  lastCompatibleReleaseCheckAt: timestamp("last_compatible_release_check_at", {
163
167
  withTimezone: true,
@@ -202,15 +206,62 @@ export const appAccessCredentials = pgTable("app_access_credentials", {
202
206
  .notNull()
203
207
  .references(() => appInstallations.id, { onDelete: "cascade" }),
204
208
  generation: integer("generation").notNull(),
209
+ tokenMode: appAccessTokenModeEnum("token_mode").notNull().default("offline"),
205
210
  credentialHash: text("credential_hash").notNull(),
206
211
  encryptedMetadata: jsonb("encrypted_metadata").$type().notNull(),
207
212
  status: appAccessCredentialStatusEnum("status").notNull().default("active"),
213
+ actorId: text("actor_id"),
214
+ viewerId: text("viewer_id"),
208
215
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
209
216
  expiresAt: timestamp("expires_at", { withTimezone: true }),
210
217
  deactivatedAt: timestamp("deactivated_at", { withTimezone: true }),
211
218
  }, (table) => [
212
219
  index("idx_app_access_credentials_installation").on(table.installationId, table.status),
213
- uniqueIndex("uidx_app_access_credentials_generation").on(table.installationId, table.generation),
220
+ index("idx_app_access_credentials_generation").on(table.installationId, table.tokenMode, table.generation),
221
+ ]);
222
+ export const appOAuthAuthorizationCodes = pgTable("app_oauth_authorization_codes", {
223
+ id: typeId("app_oauth_authorization_codes"),
224
+ appId: text("app_id")
225
+ .notNull()
226
+ .references(() => apps.id, { onDelete: "cascade" }),
227
+ installationId: text("installation_id")
228
+ .notNull()
229
+ .references(() => appInstallations.id, { onDelete: "cascade" }),
230
+ releaseId: text("release_id")
231
+ .notNull()
232
+ .references(() => appReleases.id, { onDelete: "cascade" }),
233
+ deploymentId: text("deployment_id").notNull(),
234
+ codeHash: text("code_hash").notNull(),
235
+ stateHash: text("state_hash").notNull(),
236
+ redirectUri: text("redirect_uri").notNull(),
237
+ codeChallenge: text("code_challenge").notNull(),
238
+ codeChallengeMethod: text("code_challenge_method").notNull(),
239
+ requestedScopes: jsonb("requested_scopes").$type().notNull(),
240
+ grantedScopes: jsonb("granted_scopes").$type().notNull(),
241
+ deniedOptionalScopes: jsonb("denied_optional_scopes").$type().notNull(),
242
+ actorId: text("actor_id").notNull(),
243
+ expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
244
+ consumedAt: timestamp("consumed_at", { withTimezone: true }),
245
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
246
+ }, (table) => [
247
+ uniqueIndex("uidx_app_oauth_codes_hash").on(table.codeHash),
248
+ index("idx_app_oauth_codes_installation").on(table.installationId, table.expiresAt),
249
+ ]);
250
+ export const appOAuthRefreshTokens = pgTable("app_oauth_refresh_tokens", {
251
+ id: typeId("app_oauth_refresh_tokens"),
252
+ installationId: text("installation_id")
253
+ .notNull()
254
+ .references(() => appInstallations.id, { onDelete: "cascade" }),
255
+ tokenHash: text("token_hash").notNull(),
256
+ generation: integer("generation").notNull(),
257
+ status: appAccessCredentialStatusEnum("status").notNull().default("active"),
258
+ rotatedFromId: text("rotated_from_id"),
259
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
260
+ expiresAt: timestamp("expires_at", { withTimezone: true }),
261
+ revokedAt: timestamp("revoked_at", { withTimezone: true }),
262
+ }, (table) => [
263
+ uniqueIndex("uidx_app_oauth_refresh_tokens_hash").on(table.tokenHash),
264
+ index("idx_app_oauth_refresh_tokens_installation").on(table.installationId, table.status),
214
265
  ]);
215
266
  export const appInstallationSettings = pgTable("app_installation_settings", {
216
267
  id: typeId("app_installation_settings"),