casualos 3.7.0-alpha.16977445547 → 3.7.0-alpha.17049743052

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 (2) hide show
  1. package/dist/cli.js +1068 -1070
  2. package/package.json +4 -4
package/dist/cli.js CHANGED
@@ -97334,7 +97334,7 @@ var trace = TraceAPI.getInstance();
97334
97334
  function hashLowEntropyPasswordWithSalt2(password, salt) {
97335
97335
  const tracer = trace.getTracer(
97336
97336
  "InstrumentedHashHelpers",
97337
- false ? void 0 : "v3.7.0-alpha.16977445547"
97337
+ false ? void 0 : "v3.7.0-alpha.17049743052"
97338
97338
  );
97339
97339
  return tracer.startActiveSpan(
97340
97340
  "hashLowEntropyPasswordWithSalt",
@@ -97352,7 +97352,7 @@ function hashLowEntropyPasswordWithSalt2(password, salt) {
97352
97352
  function hashHighEntropyPasswordWithSalt2(password, salt) {
97353
97353
  const tracer = trace.getTracer(
97354
97354
  "InstrumentedHashHelpers",
97355
- false ? void 0 : "v3.7.0-alpha.16977445547"
97355
+ false ? void 0 : "v3.7.0-alpha.17049743052"
97356
97356
  );
97357
97357
  return tracer.startActiveSpan(
97358
97358
  "hashHighEntropyPasswordWithSalt",
@@ -97370,7 +97370,7 @@ function hashHighEntropyPasswordWithSalt2(password, salt) {
97370
97370
  function verifyPasswordAgainstHashes2(password, salt, hashes) {
97371
97371
  const tracer = trace.getTracer(
97372
97372
  "InstrumentedHashHelpers",
97373
- false ? void 0 : "v3.7.0-alpha.16977445547"
97373
+ false ? void 0 : "v3.7.0-alpha.17049743052"
97374
97374
  );
97375
97375
  return tracer.startActiveSpan(
97376
97376
  "verifyPasswordAgainstHashes",
@@ -100837,134 +100837,678 @@ function randomCode() {
100837
100837
  return str2;
100838
100838
  }
100839
100839
 
100840
- // ../../node_modules/.pnpm/@simplewebauthn+server@9.0.3_encoding@0.1.13/node_modules/@simplewebauthn/server/esm/helpers/iso/isoBase64URL.js
100841
- var isoBase64URL_exports = {};
100842
- __export(isoBase64URL_exports, {
100843
- fromBuffer: () => fromBuffer,
100844
- fromString: () => fromString,
100845
- isBase64: () => isBase64,
100846
- isBase64url: () => isBase64url,
100847
- toBase64: () => toBase64,
100848
- toBuffer: () => toBuffer,
100849
- toString: () => toString3
100840
+ // ../aux-records/SubscriptionConfiguration.ts
100841
+ var webhookFeaturesSchema = z.object({
100842
+ allowed: z.boolean().describe(
100843
+ "Whether webhook features are granted for the subscription."
100844
+ ),
100845
+ maxItems: z.number().describe(
100846
+ "The maximum number of webhook items that are allowed for the subscription. If not specified, then there is no limit."
100847
+ ).int().optional(),
100848
+ tokenLifetimeMs: z.number().describe(
100849
+ "The lifetime of session tokens that are issued to the webhook in miliseconds. Defaults to 5 minutes."
100850
+ ).int().positive().optional().nullable().default(5 * 60 * 1e3),
100851
+ initTimeoutMs: z.number().describe(
100852
+ "The maximum number of miliseconds that the webhook has to initialize. Defaults to 5000ms."
100853
+ ).int().positive().optional().nullable().default(5e3),
100854
+ requestTimeoutMs: z.number().describe(
100855
+ "The maximum number of miliseconds that the webhook has to respond to a request after being initialized. Defaults to 5000ms"
100856
+ ).int().positive().optional().nullable().default(5e3),
100857
+ fetchTimeoutMs: z.number().describe(
100858
+ "The maximum number of miliseconds that the system will take to fetch the AUX state for the webhook. Defaults to 5000ms."
100859
+ ).int().positive().optional().nullable().default(5e3),
100860
+ addStateTimeoutMs: z.number().describe(
100861
+ "The maximum number of miliseconds that the system will take to add the AUX state to the webhook simulation. Defaults to 1000ms."
100862
+ ).int().positive().optional().nullable().default(1e3),
100863
+ maxRunsPerPeriod: z.number().describe(
100864
+ "The maximum number of webhook runs allowed per subscription period. If not specified, then there is no limit."
100865
+ ).int().positive().optional(),
100866
+ maxRunsPerHour: z.number().describe(
100867
+ "The maximum number of webhook runs allowed per hour for the subscription. If not specified, then there is no limit."
100868
+ ).int().positive().optional()
100869
+ }).describe(
100870
+ "The configuration for webhook features. Defaults to not allowed."
100871
+ ).optional().default({
100872
+ allowed: false
100850
100873
  });
100851
-
100852
- // ../../node_modules/.pnpm/@levischuck+tiny-cbor@0.2.11/node_modules/@levischuck/tiny-cbor/esm/index.js
100853
- var esm_exports = {};
100854
- __export(esm_exports, {
100855
- CBORTag: () => CBORTag,
100856
- decodeCBOR: () => decodeCBOR,
100857
- decodePartialCBOR: () => decodePartialCBOR,
100858
- encodeCBOR: () => encodeCBOR
100874
+ var subscriptionFeaturesSchema = z.object({
100875
+ records: z.object({
100876
+ allowed: z.boolean().describe(
100877
+ "Whether records are allowed for the subscription. If false, then every request to create or update a record will be rejected."
100878
+ ),
100879
+ maxRecords: z.number().describe(
100880
+ "The maximum number of records allowed for the subscription."
100881
+ ).int().positive().optional()
100882
+ }).describe("The configuration for record features.").optional(),
100883
+ data: z.object({
100884
+ allowed: z.boolean().describe(
100885
+ "Whether data resources are allowed for the subscription. If false, then every request to create or update a data resource will be rejected."
100886
+ ),
100887
+ maxItems: z.number({}).describe(
100888
+ "The maximum number of data resource items allowed for the subscription. If omitted, then there is no limit."
100889
+ ).int().positive().optional(),
100890
+ maxReadsPerPeriod: z.number().describe(
100891
+ "The maximum number of data item reads allowed per subscription period. If omitted, then there is no limit."
100892
+ ).int().positive().optional(),
100893
+ maxWritesPerPeriod: z.number().describe(
100894
+ "The maximum number of data item writes allowed per subscription period. If omitted, then there is no limit."
100895
+ ).int().positive().optional(),
100896
+ maxItemSizeInBytes: z.number().describe(
100897
+ "The maximum number of bytes that can be stored in a single data item. If set to null, then there is no limit. If omitted, then the limit is 500,000 bytes (500KB)"
100898
+ ).int().positive().nullable().optional().default(5e5)
100899
+ }),
100900
+ files: z.object({
100901
+ allowed: z.boolean().describe(
100902
+ "Whether file resources are allowed for the subscription. If false, then every request to create or update a file resource will be rejected."
100903
+ ),
100904
+ maxFiles: z.number().describe(
100905
+ "The maximum number of files allowed for the subscription. If omitted, then there is no limit."
100906
+ ).int().positive().optional(),
100907
+ maxBytesPerFile: z.number().describe(
100908
+ "The maximum number of bytes per file allowed for the subscription. If omitted, then there is no limit."
100909
+ ).int().positive().optional(),
100910
+ maxBytesTotal: z.number().describe(
100911
+ "The maximum number of file bytes that can be stored for the subscription. If omitted, then there is no limit."
100912
+ ).int().positive().optional()
100913
+ }),
100914
+ events: z.object({
100915
+ allowed: z.boolean().describe(
100916
+ "Whether event resources are allowed for the subscription. If false, then every request to increment or count events will be rejected."
100917
+ ),
100918
+ maxEvents: z.number().describe(
100919
+ "The maximum number of distinct event names that are allowed for the subscription. If omitted, then there is no limit."
100920
+ ).int().positive().optional(),
100921
+ maxUpdatesPerPeriod: z.number().describe("Not currently implemented.").int().positive().optional()
100922
+ }),
100923
+ policies: z.object({
100924
+ allowed: z.boolean().describe(
100925
+ "Whether policy resources are allowed for the subscription. If false, then every request to create or update a policy will be rejected."
100926
+ ),
100927
+ maxPolicies: z.number().describe("Not currently implemented.").int().positive().optional()
100928
+ }),
100929
+ ai: z.object({
100930
+ chat: z.object({
100931
+ allowed: z.boolean().describe(
100932
+ "Whether AI chat requests are allowed for the subscription. If false, then every request to generate AI chat will be rejected."
100933
+ ),
100934
+ maxTokensPerPeriod: z.number().describe(
100935
+ "The maximum number of AI chat tokens allowed per subscription period. If omitted, then there is no limit."
100936
+ ).int().positive().optional(),
100937
+ allowedModels: z.array(z.string()).describe(
100938
+ "The list of model IDs that are allowed for the subscription. If omitted, then all models are allowed."
100939
+ ).optional()
100940
+ }),
100941
+ images: z.object({
100942
+ allowed: z.boolean().describe(
100943
+ "Whether AI image requests are allowed for the subscription. If false, then every request to generate AI images will be rejected."
100944
+ ),
100945
+ maxSquarePixelsPerPeriod: z.number().describe(
100946
+ "The maximum number of square pixels (pixels squared) that are allowed to be generated per subscription period. If omitted, then there is no limit."
100947
+ ).int().positive().optional()
100948
+ }),
100949
+ skyboxes: z.object({
100950
+ allowed: z.boolean().describe(
100951
+ "Whether AI Skybox requests are allowed for the subscription. If false, then every request to generate AI skyboxes will be rejected."
100952
+ ),
100953
+ maxSkyboxesPerPeriod: z.number().describe(
100954
+ "The maximum number of skyboxes that are allowed to be generated per subscription period. If omitted, then there is no limit."
100955
+ ).int().positive().optional()
100956
+ }),
100957
+ hume: z.object({
100958
+ allowed: z.boolean().describe(
100959
+ "Whether Hume AI features are allowed for the subscription. If false, then every request to generate Hume AI will be rejected."
100960
+ )
100961
+ }).describe(
100962
+ "The configuration for Hume AI features for the subscription. Defaults to not allowed if omitted."
100963
+ ).optional().default({
100964
+ allowed: false
100965
+ }),
100966
+ sloyd: z.object({
100967
+ allowed: z.boolean().describe(
100968
+ "Whether Sloyd AI features are allowed for the subscription. If false, then every request to generate Sloyd AI will be rejected."
100969
+ ),
100970
+ maxModelsPerPeriod: z.number().describe(
100971
+ "The maximum number of models that can be generated per subscription period. If omitted, then there is no limit."
100972
+ ).positive().int().optional()
100973
+ }).describe(
100974
+ "The configuration for Sloyd AI features for the subscription. Defaults to not allowed if omitted."
100975
+ ).optional().default({
100976
+ allowed: false
100977
+ }),
100978
+ openai: z.object({
100979
+ realtime: z.object({
100980
+ allowed: z.boolean().describe(
100981
+ "Whether OpenAI realtime API features are allowed."
100982
+ ),
100983
+ maxSessionsPerPeriod: z.number().describe(
100984
+ "The maximum number of realtime sessions that can be initiated per subscription period. If omitted, then there is no limit."
100985
+ ).int().positive().optional(),
100986
+ maxResponseOutputTokens: z.number().describe(
100987
+ "The maximum number of output tokens that can be generated per response per session. If omitted, then there is no limit."
100988
+ ).int().positive().optional(),
100989
+ allowedModels: z.array(z.string()).describe(
100990
+ "The list of models that are allowed to be used with the realtime API. If ommited, then all models are allowed."
100991
+ ).optional()
100992
+ }).describe(
100993
+ "The configuration for OpenAI realtime API features."
100994
+ ).optional().default({
100995
+ allowed: false
100996
+ })
100997
+ }).describe(
100998
+ "The configuration for Open AI-specific features for the subscription. Defaults to not allowed if omitted."
100999
+ ).optional().default({})
101000
+ }),
101001
+ insts: z.object({
101002
+ allowed: z.boolean().describe(
101003
+ "Whether insts are allowed for the subscription. If false, then every request to create or update an inst will be rejected."
101004
+ ),
101005
+ maxInsts: z.number().describe(
101006
+ "The maximum number of private insts that are allowed for the subscription. If omitted, then there is no limit."
101007
+ ).int().positive().optional(),
101008
+ maxBytesPerInst: z.number().describe(
101009
+ "The maximum number of bytes that can be stored in an inst. If omitted, then there is no limit."
101010
+ ).int().positive().optional(),
101011
+ maxActiveConnectionsPerInst: z.number().describe(
101012
+ "The maximum number of active websocket connections that an inst can have. If omitted, then there is no limit."
101013
+ ).int().positive().optional()
101014
+ }),
101015
+ comId: z.object({
101016
+ allowed: z.boolean().describe("Whether comId features are granted to the studio."),
101017
+ // allowCustomComId: z
101018
+ // .boolean()
101019
+ // .describe(
101020
+ // 'Whether the studio is allowed to set their own comId. If false, then the user will be able to request changes to their comId, but they will not automatically apply.'
101021
+ // ),
101022
+ maxStudios: z.number().describe(
101023
+ "The maximum number of studios that can be created in this comId. If omitted, then there is no limit."
101024
+ ).positive().int().optional()
101025
+ }).describe(
101026
+ "The configuration for comId features for studios. Defaults to not allowed."
101027
+ ).optional().default({
101028
+ allowed: false
101029
+ // allowCustomComId: false,
101030
+ }),
101031
+ loom: z.object({
101032
+ allowed: z.boolean().describe("Whether loom features are granted to the studio.")
101033
+ }).describe(
101034
+ "The configuration for loom features for studios. Defaults to not allowed."
101035
+ ).optional().default({
101036
+ allowed: false
101037
+ }),
101038
+ webhooks: webhookFeaturesSchema,
101039
+ notifications: z.object({
101040
+ allowed: z.boolean().describe(
101041
+ "Whether notifications are allowed for the subscription."
101042
+ ),
101043
+ maxItems: z.number().describe(
101044
+ "The maximum number of notification items that are allowed for the subscription. If not specified, then there is no limit."
101045
+ ).int().positive().optional(),
101046
+ maxSubscribersPerItem: z.number().describe(
101047
+ "The maximum number of subscribers that a notification can have in the subscription. If not specified, then there is no limit."
101048
+ ).int().positive().optional(),
101049
+ maxSentNotificationsPerPeriod: z.number().describe(
101050
+ 'The maximum number of notifications that can be sent per subscription period. This tracks the number of times the "sendNotification" operation was called. If not specified, then there is no limit.'
101051
+ ).int().positive().optional(),
101052
+ maxSentPushNotificationsPerPeriod: z.number().describe(
101053
+ "The maximum number of push notifications that can be sent per subscription period. This tracks the actual number of push notifications that were sent to users. If not specified, then there is no limit."
101054
+ ).int().positive().optional()
101055
+ }).describe(
101056
+ "The configuration for notification features. Defaults to not allowed."
101057
+ ).optional().default({
101058
+ allowed: false
101059
+ }),
101060
+ packages: z.object({
101061
+ allowed: z.boolean().describe("Whether packages are allowed for the subscription."),
101062
+ maxItems: z.number().describe(
101063
+ "The maximum number of packages that are allowed for the subscription. If not specified, then there is no limit."
101064
+ ).int().positive().optional(),
101065
+ maxPackageVersions: z.number().describe(
101066
+ "The maximum number of package versions that are allowed for the subscription. If not specified, then there is no limit."
101067
+ ).int().positive().optional(),
101068
+ maxPackageVersionSizeInBytes: z.number().describe(
101069
+ "The maximum number of bytes that a single package version can be. If not specified, then there is no limit."
101070
+ ).int().positive().optional(),
101071
+ maxPackageBytesTotal: z.number().describe(
101072
+ "The maximum number of bytes that all package versions in the subscription can be. If not specified, then there is no limit."
101073
+ ).int().positive().optional()
101074
+ }).describe(
101075
+ "The configuration for package features. Defaults to allowed."
101076
+ ).optional().default({
101077
+ allowed: true
101078
+ }),
101079
+ search: z.object({
101080
+ allowed: z.boolean().describe(
101081
+ "Whether search records are allowed for the subscription."
101082
+ ),
101083
+ maxItems: z.number().describe(
101084
+ "The maximum number of search records that can be created for the subscription. If not specified, then there is no limit."
101085
+ ).int().positive().optional()
101086
+ }).describe(
101087
+ "The configuration for search records features. Defaults to allowed."
101088
+ ).optional().default({
101089
+ allowed: true
101090
+ })
100859
101091
  });
100860
-
100861
- // ../../node_modules/.pnpm/@levischuck+tiny-cbor@0.2.11/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor_internal.js
100862
- function decodeLength(data, argument, index) {
100863
- if (argument < 24) {
100864
- return [argument, 1];
100865
- }
100866
- const remainingDataLength = data.byteLength - index - 1;
100867
- const view = new DataView(data.buffer, index + 1);
100868
- let output;
100869
- let bytes = 0;
100870
- switch (argument) {
100871
- case 24: {
100872
- if (remainingDataLength > 0) {
100873
- output = view.getUint8(0);
100874
- bytes = 2;
100875
- }
100876
- break;
100877
- }
100878
- case 25: {
100879
- if (remainingDataLength > 1) {
100880
- output = view.getUint16(0, false);
100881
- bytes = 3;
100882
- }
100883
- break;
100884
- }
100885
- case 26: {
100886
- if (remainingDataLength > 3) {
100887
- output = view.getUint32(0, false);
100888
- bytes = 5;
100889
- }
100890
- break;
100891
- }
100892
- case 27: {
100893
- if (remainingDataLength > 7) {
100894
- const bigOutput = view.getBigUint64(0, false);
100895
- if (bigOutput >= 24n && bigOutput <= Number.MAX_SAFE_INTEGER) {
100896
- return [Number(bigOutput), 9];
101092
+ var subscriptionConfigSchema = z.object({
101093
+ webhookSecret: z.string().describe(
101094
+ "The Stripe Webhook secret. Used to validate that webhooks are actually coming from Stripe."
101095
+ ).nonempty(),
101096
+ successUrl: z.string().describe(
101097
+ "The URL that successful Stripe checkout sessions should be redirected to."
101098
+ ).nonempty(),
101099
+ cancelUrl: z.string().describe(
101100
+ "The URL that canceled Stripe checkout sessions should be redirected to."
101101
+ ).nonempty(),
101102
+ returnUrl: z.string().describe(
101103
+ "The URL that users should be redirected to when exiting the Stripe subscription management customer portal."
101104
+ ).nonempty(),
101105
+ portalConfig: z.object({}).describe(
101106
+ "Additional options that should be passed to stripe.billingPortal.sessions.create()."
101107
+ ).passthrough().optional().nullable(),
101108
+ checkoutConfig: z.object({}).describe(
101109
+ "Additional options that should be passed to stripe.checkout.sessions.create()."
101110
+ ).passthrough().optional().nullable(),
101111
+ subscriptions: z.array(
101112
+ z.object({
101113
+ id: z.string().describe(
101114
+ "The ID of the subscription. Can be anything, but it must be unique to each subscription and never change."
101115
+ ).nonempty(),
101116
+ product: z.string().describe(
101117
+ "The ID of the Stripe product that is being offered by this subscription. If omitted, then this subscription will be shown but not able to be purchased."
101118
+ ).nonempty().optional(),
101119
+ featureList: z.array(z.string().nonempty()).describe(
101120
+ "The list of features that should be shown for this subscription tier."
101121
+ ),
101122
+ eligibleProducts: z.array(z.string().nonempty()).describe(
101123
+ "The list of Stripe product IDs that count as eligible for this subscription. Useful if you want to change the product of this subscription, but grandfather in existing users."
101124
+ ).optional(),
101125
+ defaultSubscription: z.boolean().describe(
101126
+ "Whether this subscription should be granted to users if they don't already have a subscription. The first in the list of subscriptions that is marked as the default will be used. Defaults to false"
101127
+ ).optional(),
101128
+ purchasable: z.boolean().describe(
101129
+ "Whether this subscription is purchasable and should be offered to users who do not already have a subscription. If false, then this subscription will not be shown to users unless they already have an active subscription for it. Defaults to true."
101130
+ ).optional(),
101131
+ name: z.string().describe(
101132
+ "The name of the subscription. Ignored if a Stripe product is specified."
101133
+ ).nonempty().optional(),
101134
+ description: z.string().describe(
101135
+ "The description of the subscription. Ignored if a Stripe product is specified."
101136
+ ).nonempty().optional(),
101137
+ tier: z.string().describe(
101138
+ 'The tier of this subscription. Useful for grouping multiple subscriptions into the same set of features. Defaults to "beta"'
101139
+ ).nonempty().optional(),
101140
+ userOnly: z.boolean().describe(
101141
+ "Whether this subscription can only be purchased by individual users. Defaults to false."
101142
+ ).optional(),
101143
+ studioOnly: z.boolean().describe(
101144
+ "Whether this subscription can only be purchased by studios. Defaults to false."
101145
+ ).optional()
101146
+ })
101147
+ ).describe("The list of subscriptions that are in use."),
101148
+ tiers: z.object({}).describe(
101149
+ "The configuration for the subscription tiers. Each key should be a tier."
101150
+ ).catchall(
101151
+ z.object({
101152
+ features: subscriptionFeaturesSchema.optional()
101153
+ }).describe("The configuration for an individual tier.")
101154
+ ).optional(),
101155
+ defaultFeatures: z.object({
101156
+ user: subscriptionFeaturesSchema.describe(
101157
+ "The features that are available for users who either dont have a subscription for have a subscription for a tier that is not listed in the tiers configuration. Defaults to an object that allows all features."
101158
+ ).optional(),
101159
+ studio: subscriptionFeaturesSchema.describe(
101160
+ "The features that are available for studios who either dont have a subscription for have a subscription for a tier that is not listed in the tiers configuration. Defaults to an object that allows all features."
101161
+ ).optional(),
101162
+ defaultPeriodLength: z.object({
101163
+ days: z.number().int().nonnegative().optional(),
101164
+ months: z.number().int().nonnegative().optional()
101165
+ }).describe(
101166
+ "The length of the period for users that do not have a subscription. Defaults to 1 month and 0 days."
101167
+ ).optional().default({
101168
+ days: 0,
101169
+ months: 1
101170
+ }),
101171
+ publicInsts: z.object({
101172
+ allowed: z.boolean().describe(
101173
+ "Whether public (temp) insts are allowed. If false, then every request to create or update a public inst will be rejected."
101174
+ ),
101175
+ maxBytesPerInst: z.number().describe(
101176
+ "The maximum number of bytes that can be stored for a public inst. If omitted, then there is no limit."
101177
+ ).int().positive().optional(),
101178
+ maxActiveConnectionsPerInst: z.number().describe(
101179
+ "The maximum number of active connections that are allowed for a public inst. If omitted, then there is no limit."
101180
+ ).int().positive().optional()
101181
+ }).describe(
101182
+ "The feature limits for public insts (insts that do not belong to a record and will expire after a preset time). Defaults to an object that allows all features."
101183
+ ).optional()
101184
+ }).optional()
101185
+ });
101186
+ function allowAllFeatures() {
101187
+ return {
101188
+ records: {
101189
+ allowed: true
101190
+ },
101191
+ ai: {
101192
+ chat: {
101193
+ allowed: true
101194
+ },
101195
+ images: {
101196
+ allowed: true
101197
+ },
101198
+ skyboxes: {
101199
+ allowed: true
101200
+ },
101201
+ hume: {
101202
+ allowed: true
101203
+ },
101204
+ sloyd: {
101205
+ allowed: true
101206
+ },
101207
+ openai: {
101208
+ realtime: {
101209
+ allowed: true
100897
101210
  }
100898
101211
  }
100899
- break;
100900
- }
100901
- }
100902
- if (output && output >= 24) {
100903
- return [output, bytes];
100904
- }
100905
- throw new Error("Length not supported or not well formed");
100906
- }
100907
- var MAJOR_TYPE_UNSIGNED_INTEGER = 0;
100908
- var MAJOR_TYPE_NEGATIVE_INTEGER = 1;
100909
- var MAJOR_TYPE_BYTE_STRING = 2;
100910
- var MAJOR_TYPE_TEXT_STRING = 3;
100911
- var MAJOR_TYPE_ARRAY = 4;
100912
- var MAJOR_TYPE_MAP = 5;
100913
- var MAJOR_TYPE_TAG = 6;
100914
- var MAJOR_TYPE_SIMPLE_OR_FLOAT = 7;
100915
- function encodeLength(major2, argument) {
100916
- const majorEncoded = major2 << 5;
100917
- if (argument < 0) {
100918
- throw new Error("CBOR Data Item argument must not be negative");
100919
- }
100920
- let bigintArgument;
100921
- if (typeof argument == "number") {
100922
- if (!Number.isInteger(argument)) {
100923
- throw new Error("CBOR Data Item argument must be an integer");
100924
- }
100925
- bigintArgument = BigInt(argument);
100926
- } else {
100927
- bigintArgument = argument;
100928
- }
100929
- if (major2 == MAJOR_TYPE_NEGATIVE_INTEGER) {
100930
- if (bigintArgument == 0n) {
100931
- throw new Error("CBOR Data Item argument cannot be zero when negative");
101212
+ },
101213
+ data: {
101214
+ allowed: true
101215
+ },
101216
+ events: {
101217
+ allowed: true
101218
+ },
101219
+ files: {
101220
+ allowed: true
101221
+ },
101222
+ insts: {
101223
+ allowed: true
101224
+ },
101225
+ notifications: {
101226
+ allowed: true
101227
+ },
101228
+ packages: {
101229
+ allowed: true
101230
+ },
101231
+ search: {
101232
+ allowed: true
100932
101233
  }
100933
- bigintArgument = bigintArgument - 1n;
100934
- }
100935
- if (bigintArgument > 18446744073709551615n) {
100936
- throw new Error("CBOR number out of range");
100937
- }
100938
- const buffer = new Uint8Array(8);
100939
- const view = new DataView(buffer.buffer);
100940
- view.setBigUint64(0, bigintArgument, false);
100941
- if (bigintArgument <= 23) {
100942
- return [majorEncoded | buffer[7]];
100943
- } else if (bigintArgument <= 255) {
100944
- return [majorEncoded | 24, buffer[7]];
100945
- } else if (bigintArgument <= 65535) {
100946
- return [majorEncoded | 25, ...buffer.slice(6)];
100947
- } else if (bigintArgument <= 4294967295) {
100948
- return [
100949
- majorEncoded | 26,
100950
- ...buffer.slice(4)
100951
- ];
100952
- } else {
100953
- return [
100954
- majorEncoded | 27,
100955
- ...buffer
100956
- ];
100957
- }
101234
+ };
100958
101235
  }
100959
-
100960
- // ../../node_modules/.pnpm/@levischuck+tiny-cbor@0.2.11/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor.js
100961
- var CBORTag = class {
100962
- /**
100963
- * Wrap a value with a tag number.
100964
- * When encoded, this tag will be attached to the value.
100965
- *
100966
- * @param tag Tag number
100967
- * @param value Wrapped value
101236
+ function getSearchFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
101237
+ const features = getSubscriptionFeatures(
101238
+ config2,
101239
+ subscriptionStatus,
101240
+ subscriptionId,
101241
+ type,
101242
+ periodStartMs,
101243
+ periodEndMs,
101244
+ nowMs
101245
+ );
101246
+ return features.search ?? { allowed: true };
101247
+ }
101248
+ function getPackageFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
101249
+ const features = getSubscriptionFeatures(
101250
+ config2,
101251
+ subscriptionStatus,
101252
+ subscriptionId,
101253
+ type,
101254
+ periodStartMs,
101255
+ periodEndMs,
101256
+ nowMs
101257
+ );
101258
+ return features.packages ?? { allowed: true };
101259
+ }
101260
+ function getNotificationFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
101261
+ const features = getSubscriptionFeatures(
101262
+ config2,
101263
+ subscriptionStatus,
101264
+ subscriptionId,
101265
+ type,
101266
+ periodStartMs,
101267
+ periodEndMs,
101268
+ nowMs
101269
+ );
101270
+ return features.notifications ?? { allowed: false };
101271
+ }
101272
+ function getWebhookFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
101273
+ const features = getSubscriptionFeatures(
101274
+ config2,
101275
+ subscriptionStatus,
101276
+ subscriptionId,
101277
+ type,
101278
+ periodStartMs,
101279
+ periodEndMs,
101280
+ nowMs
101281
+ );
101282
+ return features.webhooks ?? webhookFeaturesSchema.parse({ allowed: false });
101283
+ }
101284
+ function getComIdFeatures(config2, subscriptionStatus, subscriptionId, periodStartMs, periodEndMs, nowMs = Date.now()) {
101285
+ const features = getSubscriptionFeatures(
101286
+ config2,
101287
+ subscriptionStatus,
101288
+ subscriptionId,
101289
+ "studio",
101290
+ periodStartMs,
101291
+ periodEndMs,
101292
+ nowMs
101293
+ );
101294
+ return features.comId ?? {
101295
+ allowed: false
101296
+ // allowCustomComId: false,
101297
+ };
101298
+ }
101299
+ function getLoomFeatures(config2, subscriptionStatus, subscriptionId, periodStartMs, periodEndMs, nowMs = Date.now()) {
101300
+ const features = getSubscriptionFeatures(
101301
+ config2,
101302
+ subscriptionStatus,
101303
+ subscriptionId,
101304
+ "studio",
101305
+ periodStartMs,
101306
+ periodEndMs,
101307
+ nowMs
101308
+ );
101309
+ return features.loom ?? { allowed: false };
101310
+ }
101311
+ function getHumeAiFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
101312
+ const features = getSubscriptionFeatures(
101313
+ config2,
101314
+ subscriptionStatus,
101315
+ subscriptionId,
101316
+ type,
101317
+ periodStartMs,
101318
+ periodEndMs,
101319
+ nowMs
101320
+ );
101321
+ return features.ai.hume ?? { allowed: false };
101322
+ }
101323
+ function getSubscriptionFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
101324
+ const sub = getSubscription(
101325
+ config2,
101326
+ subscriptionStatus,
101327
+ subscriptionId,
101328
+ type,
101329
+ periodStartMs,
101330
+ periodEndMs,
101331
+ nowMs
101332
+ );
101333
+ if (typeof sub === "undefined") {
101334
+ return allowAllFeatures();
101335
+ } else if (sub) {
101336
+ const tier = sub?.tier;
101337
+ const features = tier ? config2?.tiers?.[tier]?.features : null;
101338
+ if (features) {
101339
+ return features;
101340
+ }
101341
+ }
101342
+ return config2.defaultFeatures?.[type] ?? allowAllFeatures();
101343
+ }
101344
+ function getSubscription(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
101345
+ if (!config2) {
101346
+ return void 0;
101347
+ }
101348
+ if (config2.tiers) {
101349
+ const roleSubscriptions = config2.subscriptions.filter(
101350
+ (s3) => subscriptionMatchesRole(s3, type)
101351
+ );
101352
+ if (isActiveSubscription(
101353
+ subscriptionStatus,
101354
+ periodStartMs,
101355
+ periodEndMs,
101356
+ nowMs
101357
+ )) {
101358
+ const sub2 = roleSubscriptions.find((s3) => s3.id === subscriptionId);
101359
+ if (sub2) {
101360
+ return sub2;
101361
+ }
101362
+ }
101363
+ const sub = roleSubscriptions.find((s3) => s3.defaultSubscription);
101364
+ if (sub) {
101365
+ return sub;
101366
+ }
101367
+ }
101368
+ return null;
101369
+ }
101370
+ function getSubscriptionTier(config2, subscriptionStatus, subId, type) {
101371
+ const sub = getSubscription(config2, subscriptionStatus, subId, type);
101372
+ if (!sub) {
101373
+ return null;
101374
+ }
101375
+ return sub?.tier ?? null;
101376
+ }
101377
+ function subscriptionMatchesRole(subscription, role) {
101378
+ const isUserOnly = subscription.userOnly ?? false;
101379
+ const isStudioOnly = subscription.studioOnly ?? false;
101380
+ const matchesRole = isUserOnly && role === "user" || isStudioOnly && role === "studio" || !isUserOnly && !isStudioOnly;
101381
+ return matchesRole;
101382
+ }
101383
+
101384
+ // ../../node_modules/.pnpm/@simplewebauthn+server@9.0.3_encoding@0.1.13/node_modules/@simplewebauthn/server/esm/helpers/iso/isoBase64URL.js
101385
+ var isoBase64URL_exports = {};
101386
+ __export(isoBase64URL_exports, {
101387
+ fromBuffer: () => fromBuffer,
101388
+ fromString: () => fromString,
101389
+ isBase64: () => isBase64,
101390
+ isBase64url: () => isBase64url,
101391
+ toBase64: () => toBase64,
101392
+ toBuffer: () => toBuffer,
101393
+ toString: () => toString3
101394
+ });
101395
+
101396
+ // ../../node_modules/.pnpm/@levischuck+tiny-cbor@0.2.11/node_modules/@levischuck/tiny-cbor/esm/index.js
101397
+ var esm_exports = {};
101398
+ __export(esm_exports, {
101399
+ CBORTag: () => CBORTag,
101400
+ decodeCBOR: () => decodeCBOR,
101401
+ decodePartialCBOR: () => decodePartialCBOR,
101402
+ encodeCBOR: () => encodeCBOR
101403
+ });
101404
+
101405
+ // ../../node_modules/.pnpm/@levischuck+tiny-cbor@0.2.11/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor_internal.js
101406
+ function decodeLength(data, argument, index) {
101407
+ if (argument < 24) {
101408
+ return [argument, 1];
101409
+ }
101410
+ const remainingDataLength = data.byteLength - index - 1;
101411
+ const view = new DataView(data.buffer, index + 1);
101412
+ let output;
101413
+ let bytes = 0;
101414
+ switch (argument) {
101415
+ case 24: {
101416
+ if (remainingDataLength > 0) {
101417
+ output = view.getUint8(0);
101418
+ bytes = 2;
101419
+ }
101420
+ break;
101421
+ }
101422
+ case 25: {
101423
+ if (remainingDataLength > 1) {
101424
+ output = view.getUint16(0, false);
101425
+ bytes = 3;
101426
+ }
101427
+ break;
101428
+ }
101429
+ case 26: {
101430
+ if (remainingDataLength > 3) {
101431
+ output = view.getUint32(0, false);
101432
+ bytes = 5;
101433
+ }
101434
+ break;
101435
+ }
101436
+ case 27: {
101437
+ if (remainingDataLength > 7) {
101438
+ const bigOutput = view.getBigUint64(0, false);
101439
+ if (bigOutput >= 24n && bigOutput <= Number.MAX_SAFE_INTEGER) {
101440
+ return [Number(bigOutput), 9];
101441
+ }
101442
+ }
101443
+ break;
101444
+ }
101445
+ }
101446
+ if (output && output >= 24) {
101447
+ return [output, bytes];
101448
+ }
101449
+ throw new Error("Length not supported or not well formed");
101450
+ }
101451
+ var MAJOR_TYPE_UNSIGNED_INTEGER = 0;
101452
+ var MAJOR_TYPE_NEGATIVE_INTEGER = 1;
101453
+ var MAJOR_TYPE_BYTE_STRING = 2;
101454
+ var MAJOR_TYPE_TEXT_STRING = 3;
101455
+ var MAJOR_TYPE_ARRAY = 4;
101456
+ var MAJOR_TYPE_MAP = 5;
101457
+ var MAJOR_TYPE_TAG = 6;
101458
+ var MAJOR_TYPE_SIMPLE_OR_FLOAT = 7;
101459
+ function encodeLength(major2, argument) {
101460
+ const majorEncoded = major2 << 5;
101461
+ if (argument < 0) {
101462
+ throw new Error("CBOR Data Item argument must not be negative");
101463
+ }
101464
+ let bigintArgument;
101465
+ if (typeof argument == "number") {
101466
+ if (!Number.isInteger(argument)) {
101467
+ throw new Error("CBOR Data Item argument must be an integer");
101468
+ }
101469
+ bigintArgument = BigInt(argument);
101470
+ } else {
101471
+ bigintArgument = argument;
101472
+ }
101473
+ if (major2 == MAJOR_TYPE_NEGATIVE_INTEGER) {
101474
+ if (bigintArgument == 0n) {
101475
+ throw new Error("CBOR Data Item argument cannot be zero when negative");
101476
+ }
101477
+ bigintArgument = bigintArgument - 1n;
101478
+ }
101479
+ if (bigintArgument > 18446744073709551615n) {
101480
+ throw new Error("CBOR number out of range");
101481
+ }
101482
+ const buffer = new Uint8Array(8);
101483
+ const view = new DataView(buffer.buffer);
101484
+ view.setBigUint64(0, bigintArgument, false);
101485
+ if (bigintArgument <= 23) {
101486
+ return [majorEncoded | buffer[7]];
101487
+ } else if (bigintArgument <= 255) {
101488
+ return [majorEncoded | 24, buffer[7]];
101489
+ } else if (bigintArgument <= 65535) {
101490
+ return [majorEncoded | 25, ...buffer.slice(6)];
101491
+ } else if (bigintArgument <= 4294967295) {
101492
+ return [
101493
+ majorEncoded | 26,
101494
+ ...buffer.slice(4)
101495
+ ];
101496
+ } else {
101497
+ return [
101498
+ majorEncoded | 27,
101499
+ ...buffer
101500
+ ];
101501
+ }
101502
+ }
101503
+
101504
+ // ../../node_modules/.pnpm/@levischuck+tiny-cbor@0.2.11/node_modules/@levischuck/tiny-cbor/esm/cbor/cbor.js
101505
+ var CBORTag = class {
101506
+ /**
101507
+ * Wrap a value with a tag number.
101508
+ * When encoded, this tag will be attached to the value.
101509
+ *
101510
+ * @param tag Tag number
101511
+ * @param value Wrapped value
100968
101512
  */
100969
101513
  constructor(tag, value) {
100970
101514
  Object.defineProperty(this, "tagId", {
@@ -104202,7 +104746,7 @@ var import_semantic_conventions = __toESM(require_src3());
104202
104746
  function traced(tracerName, options = {}, metricOptions = {}) {
104203
104747
  const tracer = trace.getTracer(
104204
104748
  tracerName,
104205
- false ? void 0 : "v3.7.0-alpha.16977445547"
104749
+ false ? void 0 : "v3.7.0-alpha.17049743052"
104206
104750
  );
104207
104751
  return function(target, propertyKey, descriptor) {
104208
104752
  const originalMethod = descriptor.value;
@@ -104284,7 +104828,7 @@ function getHistogram(meter) {
104284
104828
  }
104285
104829
  return metrics.getMeter(
104286
104830
  meter.meter,
104287
- false ? void 0 : "v3.7.0-alpha.16977445547"
104831
+ false ? void 0 : "v3.7.0-alpha.17049743052"
104288
104832
  ).createHistogram(meter.name, meter.options);
104289
104833
  }
104290
104834
  function getCounter(meter) {
@@ -104293,7 +104837,7 @@ function getCounter(meter) {
104293
104837
  }
104294
104838
  return metrics.getMeter(
104295
104839
  meter.meter,
104296
- false ? void 0 : "v3.7.0-alpha.16977445547"
104840
+ false ? void 0 : "v3.7.0-alpha.17049743052"
104297
104841
  ).createCounter(meter.name, meter.options);
104298
104842
  }
104299
104843
  function traceHttpResponse(options = {}) {
@@ -104335,12 +104879,11 @@ var MAX_EMAIL_ADDRESS_LENGTH = 200;
104335
104879
  var MAX_SMS_ADDRESS_LENGTH = 30;
104336
104880
  var PRIVO_OPEN_ID_PROVIDER = "privo";
104337
104881
  var AuthController = class {
104338
- constructor(authStore, messenger, configStore, forceAllowSubscriptionFeatures = false, privoClient = null, relyingParties = []) {
104882
+ constructor(authStore, messenger, configStore, privoClient = null, relyingParties = []) {
104339
104883
  this._privoClient = null;
104340
104884
  this._store = authStore;
104341
104885
  this._messenger = messenger;
104342
104886
  this._config = configStore;
104343
- this._forceAllowSubscriptionFeatures = forceAllowSubscriptionFeatures;
104344
104887
  this._privoClient = privoClient;
104345
104888
  this._webAuthNRelyingParties = relyingParties;
104346
104889
  this._privoEnabled = this._privoClient !== null;
@@ -106340,41 +106883,25 @@ var AuthController = class {
106340
106883
  }
106341
106884
  }
106342
106885
  async _getSubscriptionInfo(user) {
106343
- const hasActiveSubscription = this._forceAllowSubscriptionFeatures || isActiveSubscription(user.subscriptionStatus);
106344
106886
  let tier = null;
106345
- let sub = null;
106346
106887
  const subscriptionConfig = await this._config.getSubscriptionConfiguration();
106347
- if (hasActiveSubscription) {
106348
- if (user.subscriptionId) {
106349
- sub = subscriptionConfig?.subscriptions.find(
106350
- (s3) => s3.id === user.subscriptionId
106351
- );
106352
- }
106353
- if (!sub) {
106354
- sub = subscriptionConfig?.subscriptions[0];
106355
- if (sub) {
106356
- console.log(
106357
- "[AuthController] [getUserInfo] Using first subscription for user."
106358
- );
106359
- }
106360
- }
106361
- tier = "beta";
106362
- }
106363
- if (!sub) {
106364
- sub = subscriptionConfig?.subscriptions.find(
106365
- (s3) => s3.defaultSubscription
106366
- );
106367
- if (sub) {
106368
- console.log(
106369
- "[AuthController] [getUserInfo] Using default subscription for user."
106370
- );
106371
- }
106372
- }
106888
+ const sub = getSubscription(
106889
+ subscriptionConfig,
106890
+ user.subscriptionStatus,
106891
+ user.subscriptionId,
106892
+ "user",
106893
+ user.subscriptionPeriodStartMs,
106894
+ user.subscriptionPeriodEndMs
106895
+ );
106373
106896
  if (sub) {
106374
106897
  tier = sub.tier || "beta";
106375
106898
  }
106376
106899
  return {
106377
- hasActiveSubscription,
106900
+ hasActiveSubscription: !!sub && isActiveSubscription(
106901
+ user.subscriptionStatus,
106902
+ user.subscriptionPeriodStartMs,
106903
+ user.subscriptionPeriodEndMs
106904
+ ),
106378
106905
  subscriptionId: sub?.id,
106379
106906
  subscriptionTier: tier
106380
106907
  };
@@ -106511,926 +107038,395 @@ var AuthController = class {
106511
107038
  span?.setStatus({ code: SpanStatusCode.ERROR });
106512
107039
  console.error(
106513
107040
  "[AuthController] Error ocurred while requesting a change in privacy features",
106514
- err
106515
- );
106516
- return {
106517
- success: false,
106518
- errorCode: "server_error",
106519
- errorMessage: "A server error occurred."
106520
- };
106521
- }
106522
- }
106523
- async listEmailRules() {
106524
- try {
106525
- const rules = await this._store.listEmailRules();
106526
- return {
106527
- success: true,
106528
- rules
106529
- };
106530
- } catch (err) {
106531
- const span = trace.getActiveSpan();
106532
- span?.recordException(err);
106533
- span?.setStatus({ code: SpanStatusCode.ERROR });
106534
- console.error(
106535
- "[AuthController] Error ocurred while listing email rules",
106536
- err
106537
- );
106538
- return {
106539
- success: false,
106540
- errorCode: "server_error",
106541
- errorMessage: "A server error occurred."
106542
- };
106543
- }
106544
- }
106545
- async listSmsRules() {
106546
- try {
106547
- const rules = await this._store.listSmsRules();
106548
- return {
106549
- success: true,
106550
- rules
106551
- };
106552
- } catch (err) {
106553
- const span = trace.getActiveSpan();
106554
- span?.recordException(err);
106555
- span?.setStatus({ code: SpanStatusCode.ERROR });
106556
- console.error(
106557
- "[AuthController] Error ocurred while listing email rules",
106558
- err
106559
- );
106560
- return {
106561
- success: false,
106562
- errorCode: "server_error",
106563
- errorMessage: "A server error occurred."
106564
- };
106565
- }
106566
- }
106567
- async isValidEmailAddress(email) {
106568
- try {
106569
- const valid = await this._validateAddress(email, "email");
106570
- if (!valid) {
106571
- return {
106572
- success: true,
106573
- allowed: false
106574
- };
106575
- }
106576
- if (this._privoClient) {
106577
- const config2 = await this._config.getPrivoConfiguration();
106578
- if (config2) {
106579
- const result = await this._privoClient.checkEmail(email);
106580
- const allowed = result.available && !result.profanity;
106581
- return {
106582
- success: true,
106583
- allowed,
106584
- suggestions: result.suggestions,
106585
- profanity: result.profanity
106586
- };
106587
- }
106588
- }
106589
- return {
106590
- success: true,
106591
- allowed: true
106592
- };
106593
- } catch (err) {
106594
- const span = trace.getActiveSpan();
106595
- span?.recordException(err);
106596
- span?.setStatus({ code: SpanStatusCode.ERROR });
106597
- console.error(
106598
- "[AuthController] Error ocurred while checking if email address is valid",
106599
- err
106600
- );
106601
- return {
106602
- success: false,
106603
- errorCode: "server_error",
106604
- errorMessage: "A server error occurred."
106605
- };
106606
- }
106607
- }
106608
- async isValidDisplayName(displayName, name) {
106609
- try {
106610
- if (this._privoClient) {
106611
- if (name) {
106612
- const lowercaseName = name.trim().toLowerCase();
106613
- const lowercaseDisplayName = displayName.trim().toLowerCase();
106614
- if (lowercaseDisplayName.includes(lowercaseName)) {
106615
- return {
106616
- success: true,
106617
- allowed: false,
106618
- containsName: true
106619
- };
106620
- }
106621
- }
106622
- const config2 = await this._config.getPrivoConfiguration();
106623
- if (config2) {
106624
- const result = await this._privoClient.checkDisplayName(
106625
- displayName
106626
- );
106627
- const allowed = result.available && !result.profanity;
106628
- return {
106629
- success: true,
106630
- allowed,
106631
- suggestions: result.suggestions,
106632
- profanity: result.profanity
106633
- };
106634
- }
106635
- }
106636
- return {
106637
- success: true,
106638
- allowed: true
106639
- };
106640
- } catch (err) {
106641
- const span = trace.getActiveSpan();
106642
- span?.recordException(err);
106643
- span?.setStatus({ code: SpanStatusCode.ERROR });
106644
- console.error(
106645
- "[AuthController] Error ocurred while checking if display name is valid",
106646
- err
106647
- );
106648
- return {
106649
- success: false,
106650
- errorCode: "server_error",
106651
- errorMessage: "A server error occurred."
106652
- };
106653
- }
106654
- }
106655
- /**
106656
- * Issues a new session for the given user.
106657
- * @param userId The ID of the user to issue the session for.
106658
- * @param lifetimeMs The lifetime of the session in milliseconds. If null, then the session will not expire.
106659
- * @param previousSession The previous session that this session is replacing. If null, then this session is not related to another session.
106660
- * @param ipAddress The IP address that the session is being issued to. Should be null if the ip address is not known.
106661
- */
106662
- async _issueSession({
106663
- userId,
106664
- lifetimeMs,
106665
- previousSession,
106666
- ipAddress,
106667
- requestId,
106668
- ...rest
106669
- }) {
106670
- const now2 = Date.now();
106671
- const newSessionId = (0, import_base64_js10.fromByteArray)((0, import_tweetnacl4.randomBytes)(SESSION_ID_BYTE_LENGTH));
106672
- const newSessionSecret = (0, import_base64_js10.fromByteArray)(
106673
- (0, import_tweetnacl4.randomBytes)(SESSION_SECRET_BYTE_LENGTH)
106674
- );
106675
- const newConnectionSecret = (0, import_base64_js10.fromByteArray)(
106676
- (0, import_tweetnacl4.randomBytes)(SESSION_SECRET_BYTE_LENGTH)
106677
- );
106678
- const newSession = {
106679
- ...rest,
106680
- userId,
106681
- sessionId: newSessionId,
106682
- requestId: requestId ?? null,
106683
- secretHash: this._hashHighEntropyPasswordWithSalt(
106684
- newSessionSecret,
106685
- newSessionId
106686
- ),
106687
- connectionSecret: newConnectionSecret,
106688
- grantedTimeMs: now2,
106689
- revokeTimeMs: null,
106690
- expireTimeMs: lifetimeMs ? now2 + lifetimeMs : null,
106691
- previousSessionId: previousSession?.sessionId ?? null,
106692
- nextSessionId: null,
106693
- ipAddress
106694
- };
106695
- if (requestId) {
106696
- await this._store.markLoginRequestComplete(userId, requestId, now2);
106697
- }
106698
- if (rest.webauthnRequestId) {
106699
- await this._store.markWebAuthnLoginRequestComplete(
106700
- rest.webauthnRequestId,
106701
- userId,
106702
- now2
106703
- );
106704
- }
106705
- if (rest.oidRequestId) {
106706
- await this._store.markOpenIDLoginRequestComplete(
106707
- rest.oidRequestId,
106708
- now2
106709
- );
106710
- }
106711
- if (previousSession) {
106712
- await this._store.replaceSession(previousSession, newSession, now2);
106713
- } else {
106714
- await this._store.saveSession(newSession);
106715
- }
106716
- const metadata = await this._store.findUserLoginMetadata(userId);
106717
- const info = {
106718
- userId,
106719
- sessionKey: formatV1SessionKey(
106720
- userId,
106721
- newSessionId,
106722
- newSessionSecret,
106723
- newSession.expireTimeMs
106724
- ),
106725
- connectionKey: formatV1ConnectionKey(
106726
- userId,
106727
- newSessionId,
106728
- newConnectionSecret,
106729
- newSession.expireTimeMs
106730
- ),
106731
- expireTimeMs: newSession.expireTimeMs,
106732
- metadata: {
106733
- hasUserAuthenticator: metadata?.hasUserAuthenticator ?? false,
106734
- userAuthenticatorCredentialIds: metadata?.userAuthenticatorCredentialIds ?? [],
106735
- hasPushSubscription: metadata?.hasPushSubscription ?? false,
106736
- pushSubscriptionIds: metadata?.pushSubscriptionIds ?? []
106737
- }
106738
- };
106739
- console.log(
106740
- `[AuthController] [issueSession userId: ${userId} newSessionId: ${newSessionId} expiresAt: ${newSession.expireTimeMs}] Issued session.`
106741
- );
106742
- return {
106743
- newSession,
106744
- info
106745
- };
106746
- }
106747
- };
106748
- __decorateClass([
106749
- traced(TRACE_NAME)
106750
- ], AuthController.prototype, "createAccount", 1);
106751
- __decorateClass([
106752
- traced(TRACE_NAME)
106753
- ], AuthController.prototype, "issueSession", 1);
106754
- __decorateClass([
106755
- traced(TRACE_NAME)
106756
- ], AuthController.prototype, "_hashHighEntropyPasswordWithSalt", 1);
106757
- __decorateClass([
106758
- traced(TRACE_NAME)
106759
- ], AuthController.prototype, "requestLogin", 1);
106760
- __decorateClass([
106761
- traced(TRACE_NAME)
106762
- ], AuthController.prototype, "completeLogin", 1);
106763
- __decorateClass([
106764
- traced(TRACE_NAME)
106765
- ], AuthController.prototype, "requestOpenIDLogin", 1);
106766
- __decorateClass([
106767
- traced(TRACE_NAME)
106768
- ], AuthController.prototype, "processOpenIDAuthorizationCode", 1);
106769
- __decorateClass([
106770
- traced(TRACE_NAME)
106771
- ], AuthController.prototype, "completeOpenIDLogin", 1);
106772
- __decorateClass([
106773
- traced(TRACE_NAME)
106774
- ], AuthController.prototype, "requestPrivoSignUp", 1);
106775
- __decorateClass([
106776
- traced(TRACE_NAME)
106777
- ], AuthController.prototype, "requestWebAuthnRegistration", 1);
106778
- __decorateClass([
106779
- traced(TRACE_NAME)
106780
- ], AuthController.prototype, "completeWebAuthnRegistration", 1);
106781
- __decorateClass([
106782
- traced(TRACE_NAME)
106783
- ], AuthController.prototype, "requestWebAuthnLogin", 1);
106784
- __decorateClass([
106785
- traced(TRACE_NAME)
106786
- ], AuthController.prototype, "completeWebAuthnLogin", 1);
106787
- __decorateClass([
106788
- traced(TRACE_NAME)
106789
- ], AuthController.prototype, "listUserAuthenticators", 1);
106790
- __decorateClass([
106791
- traced(TRACE_NAME)
106792
- ], AuthController.prototype, "deleteUserAuthenticator", 1);
106793
- __decorateClass([
106794
- traced(TRACE_NAME)
106795
- ], AuthController.prototype, "validateSessionKey", 1);
106796
- __decorateClass([
106797
- traced(TRACE_NAME)
106798
- ], AuthController.prototype, "verifyPasswordAgainstHashes", 1);
106799
- __decorateClass([
106800
- traced(TRACE_NAME)
106801
- ], AuthController.prototype, "validateConnectionToken", 1);
106802
- __decorateClass([
106803
- traced(TRACE_NAME)
106804
- ], AuthController.prototype, "revokeSession", 1);
106805
- __decorateClass([
106806
- traced(TRACE_NAME)
106807
- ], AuthController.prototype, "revokeAllSessions", 1);
106808
- __decorateClass([
106809
- traced(TRACE_NAME)
106810
- ], AuthController.prototype, "replaceSession", 1);
106811
- __decorateClass([
106812
- traced(TRACE_NAME)
106813
- ], AuthController.prototype, "listSessions", 1);
106814
- __decorateClass([
106815
- traced(TRACE_NAME)
106816
- ], AuthController.prototype, "getUserInfo", 1);
106817
- __decorateClass([
106818
- traced(TRACE_NAME)
106819
- ], AuthController.prototype, "getPublicUserInfo", 1);
106820
- __decorateClass([
106821
- traced(TRACE_NAME)
106822
- ], AuthController.prototype, "updateUserInfo", 1);
106823
- __decorateClass([
106824
- traced(TRACE_NAME)
106825
- ], AuthController.prototype, "requestPrivacyFeaturesChange", 1);
106826
- __decorateClass([
106827
- traced(TRACE_NAME)
106828
- ], AuthController.prototype, "listEmailRules", 1);
106829
- __decorateClass([
106830
- traced(TRACE_NAME)
106831
- ], AuthController.prototype, "listSmsRules", 1);
106832
- __decorateClass([
106833
- traced(TRACE_NAME)
106834
- ], AuthController.prototype, "isValidEmailAddress", 1);
106835
- __decorateClass([
106836
- traced(TRACE_NAME)
106837
- ], AuthController.prototype, "isValidDisplayName", 1);
106838
- async function validateSessionKey(auth7, sessionKey) {
106839
- if (!sessionKey) {
106840
- return {
106841
- success: false,
106842
- userId: null,
106843
- role: null,
106844
- errorCode: "no_session_key",
106845
- errorMessage: "A session key was not provided, but it is required for this operation."
106846
- };
106847
- }
106848
- const result = await auth7.validateSessionKey(sessionKey);
106849
- if (result.success === true) {
106850
- const span = trace.getActiveSpan();
106851
- if (span) {
106852
- span.setAttributes({
106853
- [import_semantic_conventions2.SEMATTRS_ENDUSER_ID]: result.userId,
106854
- ["request.userId"]: result.userId,
106855
- ["request.userRole"]: result.role,
106856
- ["request.sessionId"]: result.sessionId,
106857
- ["request.subscriptionId"]: result.subscriptionId,
106858
- ["request.subscriptionTier"]: result.subscriptionTier
106859
- });
106860
- }
106861
- }
106862
- return result;
106863
- }
106864
- function getPrivacyFeaturesFromPermissions(featureIds, permissions) {
106865
- const publishData = permissions.some(
106866
- (p2) => p2.on && p2.featureId === featureIds.projectDevelopment
106867
- );
106868
- const allowPublicData = publishData && permissions.some(
106869
- (p2) => p2.on && p2.featureId === featureIds.publishProjects
106870
- );
106871
- const allowAI = permissions.some(
106872
- (p2) => p2.on && p2.featureId === featureIds.buildAIEggs
106873
- );
106874
- const allowPublicInsts = publishData && permissions.some(
106875
- (p2) => p2.on && p2.featureId === featureIds.joinAndCollaborate
106876
- );
106877
- return {
106878
- publishData,
106879
- allowPublicData,
106880
- allowAI,
106881
- allowPublicInsts
106882
- };
106883
- }
106884
- function findRelyingPartyForOrigin(relyingParties, originOrHost) {
106885
- if (!originOrHost) {
106886
- return relyingParties[0];
106887
- }
106888
- return relyingParties.find((rp) => {
106889
- const matchesOrigin = rp.origin === originOrHost;
106890
- if (matchesOrigin) {
106891
- return true;
106892
- }
106893
- const originUrl = new URL(rp.origin);
106894
- const host = originUrl.host;
106895
- return originOrHost === host;
106896
- });
106897
- }
106898
-
106899
- // ../aux-records/RecordsController.ts
106900
- var import_tweetnacl5 = __toESM(require_nacl_fast());
106901
- var import_base64_js11 = __toESM(require_base64_js());
106902
-
106903
- // ../aux-records/SubscriptionConfiguration.ts
106904
- var webhookFeaturesSchema = z.object({
106905
- allowed: z.boolean().describe(
106906
- "Whether webhook features are granted for the subscription."
106907
- ),
106908
- maxItems: z.number().describe(
106909
- "The maximum number of webhook items that are allowed for the subscription. If not specified, then there is no limit."
106910
- ).int().optional(),
106911
- tokenLifetimeMs: z.number().describe(
106912
- "The lifetime of session tokens that are issued to the webhook in miliseconds. Defaults to 5 minutes."
106913
- ).int().positive().optional().nullable().default(5 * 60 * 1e3),
106914
- initTimeoutMs: z.number().describe(
106915
- "The maximum number of miliseconds that the webhook has to initialize. Defaults to 5000ms."
106916
- ).int().positive().optional().nullable().default(5e3),
106917
- requestTimeoutMs: z.number().describe(
106918
- "The maximum number of miliseconds that the webhook has to respond to a request after being initialized. Defaults to 5000ms"
106919
- ).int().positive().optional().nullable().default(5e3),
106920
- fetchTimeoutMs: z.number().describe(
106921
- "The maximum number of miliseconds that the system will take to fetch the AUX state for the webhook. Defaults to 5000ms."
106922
- ).int().positive().optional().nullable().default(5e3),
106923
- addStateTimeoutMs: z.number().describe(
106924
- "The maximum number of miliseconds that the system will take to add the AUX state to the webhook simulation. Defaults to 1000ms."
106925
- ).int().positive().optional().nullable().default(1e3),
106926
- maxRunsPerPeriod: z.number().describe(
106927
- "The maximum number of webhook runs allowed per subscription period. If not specified, then there is no limit."
106928
- ).int().positive().optional(),
106929
- maxRunsPerHour: z.number().describe(
106930
- "The maximum number of webhook runs allowed per hour for the subscription. If not specified, then there is no limit."
106931
- ).int().positive().optional()
106932
- }).describe(
106933
- "The configuration for webhook features. Defaults to not allowed."
106934
- ).optional().default({
106935
- allowed: false
106936
- });
106937
- var subscriptionFeaturesSchema = z.object({
106938
- records: z.object({
106939
- allowed: z.boolean().describe(
106940
- "Whether records are allowed for the subscription. If false, then every request to create or update a record will be rejected."
106941
- ),
106942
- maxRecords: z.number().describe(
106943
- "The maximum number of records allowed for the subscription."
106944
- ).int().positive().optional()
106945
- }).describe("The configuration for record features.").optional(),
106946
- data: z.object({
106947
- allowed: z.boolean().describe(
106948
- "Whether data resources are allowed for the subscription. If false, then every request to create or update a data resource will be rejected."
106949
- ),
106950
- maxItems: z.number({}).describe(
106951
- "The maximum number of data resource items allowed for the subscription. If omitted, then there is no limit."
106952
- ).int().positive().optional(),
106953
- maxReadsPerPeriod: z.number().describe(
106954
- "The maximum number of data item reads allowed per subscription period. If omitted, then there is no limit."
106955
- ).int().positive().optional(),
106956
- maxWritesPerPeriod: z.number().describe(
106957
- "The maximum number of data item writes allowed per subscription period. If omitted, then there is no limit."
106958
- ).int().positive().optional(),
106959
- maxItemSizeInBytes: z.number().describe(
106960
- "The maximum number of bytes that can be stored in a single data item. If set to null, then there is no limit. If omitted, then the limit is 500,000 bytes (500KB)"
106961
- ).int().positive().nullable().optional().default(5e5)
106962
- }),
106963
- files: z.object({
106964
- allowed: z.boolean().describe(
106965
- "Whether file resources are allowed for the subscription. If false, then every request to create or update a file resource will be rejected."
106966
- ),
106967
- maxFiles: z.number().describe(
106968
- "The maximum number of files allowed for the subscription. If omitted, then there is no limit."
106969
- ).int().positive().optional(),
106970
- maxBytesPerFile: z.number().describe(
106971
- "The maximum number of bytes per file allowed for the subscription. If omitted, then there is no limit."
106972
- ).int().positive().optional(),
106973
- maxBytesTotal: z.number().describe(
106974
- "The maximum number of file bytes that can be stored for the subscription. If omitted, then there is no limit."
106975
- ).int().positive().optional()
106976
- }),
106977
- events: z.object({
106978
- allowed: z.boolean().describe(
106979
- "Whether event resources are allowed for the subscription. If false, then every request to increment or count events will be rejected."
106980
- ),
106981
- maxEvents: z.number().describe(
106982
- "The maximum number of distinct event names that are allowed for the subscription. If omitted, then there is no limit."
106983
- ).int().positive().optional(),
106984
- maxUpdatesPerPeriod: z.number().describe("Not currently implemented.").int().positive().optional()
106985
- }),
106986
- policies: z.object({
106987
- allowed: z.boolean().describe(
106988
- "Whether policy resources are allowed for the subscription. If false, then every request to create or update a policy will be rejected."
106989
- ),
106990
- maxPolicies: z.number().describe("Not currently implemented.").int().positive().optional()
106991
- }),
106992
- ai: z.object({
106993
- chat: z.object({
106994
- allowed: z.boolean().describe(
106995
- "Whether AI chat requests are allowed for the subscription. If false, then every request to generate AI chat will be rejected."
106996
- ),
106997
- maxTokensPerPeriod: z.number().describe(
106998
- "The maximum number of AI chat tokens allowed per subscription period. If omitted, then there is no limit."
106999
- ).int().positive().optional(),
107000
- allowedModels: z.array(z.string()).describe(
107001
- "The list of model IDs that are allowed for the subscription. If omitted, then all models are allowed."
107002
- ).optional()
107003
- }),
107004
- images: z.object({
107005
- allowed: z.boolean().describe(
107006
- "Whether AI image requests are allowed for the subscription. If false, then every request to generate AI images will be rejected."
107007
- ),
107008
- maxSquarePixelsPerPeriod: z.number().describe(
107009
- "The maximum number of square pixels (pixels squared) that are allowed to be generated per subscription period. If omitted, then there is no limit."
107010
- ).int().positive().optional()
107011
- }),
107012
- skyboxes: z.object({
107013
- allowed: z.boolean().describe(
107014
- "Whether AI Skybox requests are allowed for the subscription. If false, then every request to generate AI skyboxes will be rejected."
107015
- ),
107016
- maxSkyboxesPerPeriod: z.number().describe(
107017
- "The maximum number of skyboxes that are allowed to be generated per subscription period. If omitted, then there is no limit."
107018
- ).int().positive().optional()
107019
- }),
107020
- hume: z.object({
107021
- allowed: z.boolean().describe(
107022
- "Whether Hume AI features are allowed for the subscription. If false, then every request to generate Hume AI will be rejected."
107023
- )
107024
- }).describe(
107025
- "The configuration for Hume AI features for the subscription. Defaults to not allowed if omitted."
107026
- ).optional().default({
107027
- allowed: false
107028
- }),
107029
- sloyd: z.object({
107030
- allowed: z.boolean().describe(
107031
- "Whether Sloyd AI features are allowed for the subscription. If false, then every request to generate Sloyd AI will be rejected."
107032
- ),
107033
- maxModelsPerPeriod: z.number().describe(
107034
- "The maximum number of models that can be generated per subscription period. If omitted, then there is no limit."
107035
- ).positive().int().optional()
107036
- }).describe(
107037
- "The configuration for Sloyd AI features for the subscription. Defaults to not allowed if omitted."
107038
- ).optional().default({
107039
- allowed: false
107040
- }),
107041
- openai: z.object({
107042
- realtime: z.object({
107043
- allowed: z.boolean().describe(
107044
- "Whether OpenAI realtime API features are allowed."
107045
- ),
107046
- maxSessionsPerPeriod: z.number().describe(
107047
- "The maximum number of realtime sessions that can be initiated per subscription period. If omitted, then there is no limit."
107048
- ).int().positive().optional(),
107049
- maxResponseOutputTokens: z.number().describe(
107050
- "The maximum number of output tokens that can be generated per response per session. If omitted, then there is no limit."
107051
- ).int().positive().optional(),
107052
- allowedModels: z.array(z.string()).describe(
107053
- "The list of models that are allowed to be used with the realtime API. If ommited, then all models are allowed."
107054
- ).optional()
107055
- }).describe(
107056
- "The configuration for OpenAI realtime API features."
107057
- ).optional().default({
107058
- allowed: false
107059
- })
107060
- }).describe(
107061
- "The configuration for Open AI-specific features for the subscription. Defaults to not allowed if omitted."
107062
- ).optional().default({})
107063
- }),
107064
- insts: z.object({
107065
- allowed: z.boolean().describe(
107066
- "Whether insts are allowed for the subscription. If false, then every request to create or update an inst will be rejected."
107067
- ),
107068
- maxInsts: z.number().describe(
107069
- "The maximum number of private insts that are allowed for the subscription. If omitted, then there is no limit."
107070
- ).int().positive().optional(),
107071
- maxBytesPerInst: z.number().describe(
107072
- "The maximum number of bytes that can be stored in an inst. If omitted, then there is no limit."
107073
- ).int().positive().optional(),
107074
- maxActiveConnectionsPerInst: z.number().describe(
107075
- "The maximum number of active websocket connections that an inst can have. If omitted, then there is no limit."
107076
- ).int().positive().optional()
107077
- }),
107078
- comId: z.object({
107079
- allowed: z.boolean().describe("Whether comId features are granted to the studio."),
107080
- // allowCustomComId: z
107081
- // .boolean()
107082
- // .describe(
107083
- // 'Whether the studio is allowed to set their own comId. If false, then the user will be able to request changes to their comId, but they will not automatically apply.'
107084
- // ),
107085
- maxStudios: z.number().describe(
107086
- "The maximum number of studios that can be created in this comId. If omitted, then there is no limit."
107087
- ).positive().int().optional()
107088
- }).describe(
107089
- "The configuration for comId features for studios. Defaults to not allowed."
107090
- ).optional().default({
107091
- allowed: false
107092
- // allowCustomComId: false,
107093
- }),
107094
- loom: z.object({
107095
- allowed: z.boolean().describe("Whether loom features are granted to the studio.")
107096
- }).describe(
107097
- "The configuration for loom features for studios. Defaults to not allowed."
107098
- ).optional().default({
107099
- allowed: false
107100
- }),
107101
- webhooks: webhookFeaturesSchema,
107102
- notifications: z.object({
107103
- allowed: z.boolean().describe(
107104
- "Whether notifications are allowed for the subscription."
107105
- ),
107106
- maxItems: z.number().describe(
107107
- "The maximum number of notification items that are allowed for the subscription. If not specified, then there is no limit."
107108
- ).int().positive().optional(),
107109
- maxSubscribersPerItem: z.number().describe(
107110
- "The maximum number of subscribers that a notification can have in the subscription. If not specified, then there is no limit."
107111
- ).int().positive().optional(),
107112
- maxSentNotificationsPerPeriod: z.number().describe(
107113
- 'The maximum number of notifications that can be sent per subscription period. This tracks the number of times the "sendNotification" operation was called. If not specified, then there is no limit.'
107114
- ).int().positive().optional(),
107115
- maxSentPushNotificationsPerPeriod: z.number().describe(
107116
- "The maximum number of push notifications that can be sent per subscription period. This tracks the actual number of push notifications that were sent to users. If not specified, then there is no limit."
107117
- ).int().positive().optional()
107118
- }).describe(
107119
- "The configuration for notification features. Defaults to not allowed."
107120
- ).optional().default({
107121
- allowed: false
107122
- }),
107123
- packages: z.object({
107124
- allowed: z.boolean().describe("Whether packages are allowed for the subscription."),
107125
- maxItems: z.number().describe(
107126
- "The maximum number of packages that are allowed for the subscription. If not specified, then there is no limit."
107127
- ).int().positive().optional(),
107128
- maxPackageVersions: z.number().describe(
107129
- "The maximum number of package versions that are allowed for the subscription. If not specified, then there is no limit."
107130
- ).int().positive().optional(),
107131
- maxPackageVersionSizeInBytes: z.number().describe(
107132
- "The maximum number of bytes that a single package version can be. If not specified, then there is no limit."
107133
- ).int().positive().optional(),
107134
- maxPackageBytesTotal: z.number().describe(
107135
- "The maximum number of bytes that all package versions in the subscription can be. If not specified, then there is no limit."
107136
- ).int().positive().optional()
107137
- }).describe(
107138
- "The configuration for package features. Defaults to allowed."
107139
- ).optional().default({
107140
- allowed: true
107141
- }),
107142
- search: z.object({
107143
- allowed: z.boolean().describe(
107144
- "Whether search records are allowed for the subscription."
107145
- ),
107146
- maxItems: z.number().describe(
107147
- "The maximum number of search records that can be created for the subscription. If not specified, then there is no limit."
107148
- ).int().positive().optional()
107149
- }).describe(
107150
- "The configuration for search records features. Defaults to allowed."
107151
- ).optional().default({
107152
- allowed: true
107153
- })
107154
- });
107155
- var subscriptionConfigSchema = z.object({
107156
- webhookSecret: z.string().describe(
107157
- "The Stripe Webhook secret. Used to validate that webhooks are actually coming from Stripe."
107158
- ).nonempty(),
107159
- successUrl: z.string().describe(
107160
- "The URL that successful Stripe checkout sessions should be redirected to."
107161
- ).nonempty(),
107162
- cancelUrl: z.string().describe(
107163
- "The URL that canceled Stripe checkout sessions should be redirected to."
107164
- ).nonempty(),
107165
- returnUrl: z.string().describe(
107166
- "The URL that users should be redirected to when exiting the Stripe subscription management customer portal."
107167
- ).nonempty(),
107168
- portalConfig: z.object({}).describe(
107169
- "Additional options that should be passed to stripe.billingPortal.sessions.create()."
107170
- ).passthrough().optional().nullable(),
107171
- checkoutConfig: z.object({}).describe(
107172
- "Additional options that should be passed to stripe.checkout.sessions.create()."
107173
- ).passthrough().optional().nullable(),
107174
- subscriptions: z.array(
107175
- z.object({
107176
- id: z.string().describe(
107177
- "The ID of the subscription. Can be anything, but it must be unique to each subscription and never change."
107178
- ).nonempty(),
107179
- product: z.string().describe(
107180
- "The ID of the Stripe product that is being offered by this subscription. If omitted, then this subscription will be shown but not able to be purchased."
107181
- ).nonempty().optional(),
107182
- featureList: z.array(z.string().nonempty()).describe(
107183
- "The list of features that should be shown for this subscription tier."
107184
- ),
107185
- eligibleProducts: z.array(z.string().nonempty()).describe(
107186
- "The list of Stripe product IDs that count as eligible for this subscription. Useful if you want to change the product of this subscription, but grandfather in existing users."
107187
- ).optional(),
107188
- defaultSubscription: z.boolean().describe(
107189
- "Whether this subscription should be granted to users if they don't already have a subscription. The first in the list of subscriptions that is marked as the default will be used. Defaults to false"
107190
- ).optional(),
107191
- purchasable: z.boolean().describe(
107192
- "Whether this subscription is purchasable and should be offered to users who do not already have a subscription. If false, then this subscription will not be shown to users unless they already have an active subscription for it. Defaults to true."
107193
- ).optional(),
107194
- name: z.string().describe(
107195
- "The name of the subscription. Ignored if a Stripe product is specified."
107196
- ).nonempty().optional(),
107197
- description: z.string().describe(
107198
- "The description of the subscription. Ignored if a Stripe product is specified."
107199
- ).nonempty().optional(),
107200
- tier: z.string().describe(
107201
- 'The tier of this subscription. Useful for grouping multiple subscriptions into the same set of features. Defaults to "beta"'
107202
- ).nonempty().optional(),
107203
- userOnly: z.boolean().describe(
107204
- "Whether this subscription can only be purchased by individual users. Defaults to false."
107205
- ).optional(),
107206
- studioOnly: z.boolean().describe(
107207
- "Whether this subscription can only be purchased by studios. Defaults to false."
107208
- ).optional()
107209
- })
107210
- ).describe("The list of subscriptions that are in use."),
107211
- tiers: z.object({}).describe(
107212
- "The configuration for the subscription tiers. Each key should be a tier."
107213
- ).catchall(
107214
- z.object({
107215
- features: subscriptionFeaturesSchema.optional()
107216
- }).describe("The configuration for an individual tier.")
107217
- ).optional(),
107218
- defaultFeatures: z.object({
107219
- user: subscriptionFeaturesSchema.describe(
107220
- "The features that are available for users who either dont have a subscription for have a subscription for a tier that is not listed in the tiers configuration. Defaults to an object that allows all features."
107221
- ).optional(),
107222
- studio: subscriptionFeaturesSchema.describe(
107223
- "The features that are available for studios who either dont have a subscription for have a subscription for a tier that is not listed in the tiers configuration. Defaults to an object that allows all features."
107224
- ).optional(),
107225
- defaultPeriodLength: z.object({
107226
- days: z.number().int().nonnegative().optional(),
107227
- months: z.number().int().nonnegative().optional()
107228
- }).describe(
107229
- "The length of the period for users that do not have a subscription. Defaults to 1 month and 0 days."
107230
- ).optional().default({
107231
- days: 0,
107232
- months: 1
107233
- }),
107234
- publicInsts: z.object({
107235
- allowed: z.boolean().describe(
107236
- "Whether public (temp) insts are allowed. If false, then every request to create or update a public inst will be rejected."
107237
- ),
107238
- maxBytesPerInst: z.number().describe(
107239
- "The maximum number of bytes that can be stored for a public inst. If omitted, then there is no limit."
107240
- ).int().positive().optional(),
107241
- maxActiveConnectionsPerInst: z.number().describe(
107242
- "The maximum number of active connections that are allowed for a public inst. If omitted, then there is no limit."
107243
- ).int().positive().optional()
107244
- }).describe(
107245
- "The feature limits for public insts (insts that do not belong to a record and will expire after a preset time). Defaults to an object that allows all features."
107246
- ).optional()
107247
- }).optional()
107248
- });
107249
- function allowAllFeatures() {
107250
- return {
107251
- records: {
107252
- allowed: true
107253
- },
107254
- ai: {
107255
- chat: {
107256
- allowed: true
107257
- },
107258
- images: {
107259
- allowed: true
107260
- },
107261
- skyboxes: {
107262
- allowed: true
107263
- },
107264
- hume: {
107265
- allowed: true
107266
- },
107267
- sloyd: {
107041
+ err
107042
+ );
107043
+ return {
107044
+ success: false,
107045
+ errorCode: "server_error",
107046
+ errorMessage: "A server error occurred."
107047
+ };
107048
+ }
107049
+ }
107050
+ async listEmailRules() {
107051
+ try {
107052
+ const rules = await this._store.listEmailRules();
107053
+ return {
107054
+ success: true,
107055
+ rules
107056
+ };
107057
+ } catch (err) {
107058
+ const span = trace.getActiveSpan();
107059
+ span?.recordException(err);
107060
+ span?.setStatus({ code: SpanStatusCode.ERROR });
107061
+ console.error(
107062
+ "[AuthController] Error ocurred while listing email rules",
107063
+ err
107064
+ );
107065
+ return {
107066
+ success: false,
107067
+ errorCode: "server_error",
107068
+ errorMessage: "A server error occurred."
107069
+ };
107070
+ }
107071
+ }
107072
+ async listSmsRules() {
107073
+ try {
107074
+ const rules = await this._store.listSmsRules();
107075
+ return {
107076
+ success: true,
107077
+ rules
107078
+ };
107079
+ } catch (err) {
107080
+ const span = trace.getActiveSpan();
107081
+ span?.recordException(err);
107082
+ span?.setStatus({ code: SpanStatusCode.ERROR });
107083
+ console.error(
107084
+ "[AuthController] Error ocurred while listing email rules",
107085
+ err
107086
+ );
107087
+ return {
107088
+ success: false,
107089
+ errorCode: "server_error",
107090
+ errorMessage: "A server error occurred."
107091
+ };
107092
+ }
107093
+ }
107094
+ async isValidEmailAddress(email) {
107095
+ try {
107096
+ const valid = await this._validateAddress(email, "email");
107097
+ if (!valid) {
107098
+ return {
107099
+ success: true,
107100
+ allowed: false
107101
+ };
107102
+ }
107103
+ if (this._privoClient) {
107104
+ const config2 = await this._config.getPrivoConfiguration();
107105
+ if (config2) {
107106
+ const result = await this._privoClient.checkEmail(email);
107107
+ const allowed = result.available && !result.profanity;
107108
+ return {
107109
+ success: true,
107110
+ allowed,
107111
+ suggestions: result.suggestions,
107112
+ profanity: result.profanity
107113
+ };
107114
+ }
107115
+ }
107116
+ return {
107117
+ success: true,
107268
107118
  allowed: true
107269
- },
107270
- openai: {
107271
- realtime: {
107272
- allowed: true
107119
+ };
107120
+ } catch (err) {
107121
+ const span = trace.getActiveSpan();
107122
+ span?.recordException(err);
107123
+ span?.setStatus({ code: SpanStatusCode.ERROR });
107124
+ console.error(
107125
+ "[AuthController] Error ocurred while checking if email address is valid",
107126
+ err
107127
+ );
107128
+ return {
107129
+ success: false,
107130
+ errorCode: "server_error",
107131
+ errorMessage: "A server error occurred."
107132
+ };
107133
+ }
107134
+ }
107135
+ async isValidDisplayName(displayName, name) {
107136
+ try {
107137
+ if (this._privoClient) {
107138
+ if (name) {
107139
+ const lowercaseName = name.trim().toLowerCase();
107140
+ const lowercaseDisplayName = displayName.trim().toLowerCase();
107141
+ if (lowercaseDisplayName.includes(lowercaseName)) {
107142
+ return {
107143
+ success: true,
107144
+ allowed: false,
107145
+ containsName: true
107146
+ };
107147
+ }
107148
+ }
107149
+ const config2 = await this._config.getPrivoConfiguration();
107150
+ if (config2) {
107151
+ const result = await this._privoClient.checkDisplayName(
107152
+ displayName
107153
+ );
107154
+ const allowed = result.available && !result.profanity;
107155
+ return {
107156
+ success: true,
107157
+ allowed,
107158
+ suggestions: result.suggestions,
107159
+ profanity: result.profanity
107160
+ };
107273
107161
  }
107274
107162
  }
107275
- },
107276
- data: {
107277
- allowed: true
107278
- },
107279
- events: {
107280
- allowed: true
107281
- },
107282
- files: {
107283
- allowed: true
107284
- },
107285
- insts: {
107286
- allowed: true
107287
- },
107288
- notifications: {
107289
- allowed: true
107290
- },
107291
- packages: {
107292
- allowed: true
107293
- },
107294
- search: {
107295
- allowed: true
107163
+ return {
107164
+ success: true,
107165
+ allowed: true
107166
+ };
107167
+ } catch (err) {
107168
+ const span = trace.getActiveSpan();
107169
+ span?.recordException(err);
107170
+ span?.setStatus({ code: SpanStatusCode.ERROR });
107171
+ console.error(
107172
+ "[AuthController] Error ocurred while checking if display name is valid",
107173
+ err
107174
+ );
107175
+ return {
107176
+ success: false,
107177
+ errorCode: "server_error",
107178
+ errorMessage: "A server error occurred."
107179
+ };
107296
107180
  }
107297
- };
107298
- }
107299
- function getSearchFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
107300
- const features = getSubscriptionFeatures(
107301
- config2,
107302
- subscriptionStatus,
107303
- subscriptionId,
107304
- type,
107305
- periodStartMs,
107306
- periodEndMs,
107307
- nowMs
107308
- );
107309
- return features.search ?? { allowed: true };
107181
+ }
107182
+ /**
107183
+ * Issues a new session for the given user.
107184
+ * @param userId The ID of the user to issue the session for.
107185
+ * @param lifetimeMs The lifetime of the session in milliseconds. If null, then the session will not expire.
107186
+ * @param previousSession The previous session that this session is replacing. If null, then this session is not related to another session.
107187
+ * @param ipAddress The IP address that the session is being issued to. Should be null if the ip address is not known.
107188
+ */
107189
+ async _issueSession({
107190
+ userId,
107191
+ lifetimeMs,
107192
+ previousSession,
107193
+ ipAddress,
107194
+ requestId,
107195
+ ...rest
107196
+ }) {
107197
+ const now2 = Date.now();
107198
+ const newSessionId = (0, import_base64_js10.fromByteArray)((0, import_tweetnacl4.randomBytes)(SESSION_ID_BYTE_LENGTH));
107199
+ const newSessionSecret = (0, import_base64_js10.fromByteArray)(
107200
+ (0, import_tweetnacl4.randomBytes)(SESSION_SECRET_BYTE_LENGTH)
107201
+ );
107202
+ const newConnectionSecret = (0, import_base64_js10.fromByteArray)(
107203
+ (0, import_tweetnacl4.randomBytes)(SESSION_SECRET_BYTE_LENGTH)
107204
+ );
107205
+ const newSession = {
107206
+ ...rest,
107207
+ userId,
107208
+ sessionId: newSessionId,
107209
+ requestId: requestId ?? null,
107210
+ secretHash: this._hashHighEntropyPasswordWithSalt(
107211
+ newSessionSecret,
107212
+ newSessionId
107213
+ ),
107214
+ connectionSecret: newConnectionSecret,
107215
+ grantedTimeMs: now2,
107216
+ revokeTimeMs: null,
107217
+ expireTimeMs: lifetimeMs ? now2 + lifetimeMs : null,
107218
+ previousSessionId: previousSession?.sessionId ?? null,
107219
+ nextSessionId: null,
107220
+ ipAddress
107221
+ };
107222
+ if (requestId) {
107223
+ await this._store.markLoginRequestComplete(userId, requestId, now2);
107224
+ }
107225
+ if (rest.webauthnRequestId) {
107226
+ await this._store.markWebAuthnLoginRequestComplete(
107227
+ rest.webauthnRequestId,
107228
+ userId,
107229
+ now2
107230
+ );
107231
+ }
107232
+ if (rest.oidRequestId) {
107233
+ await this._store.markOpenIDLoginRequestComplete(
107234
+ rest.oidRequestId,
107235
+ now2
107236
+ );
107237
+ }
107238
+ if (previousSession) {
107239
+ await this._store.replaceSession(previousSession, newSession, now2);
107240
+ } else {
107241
+ await this._store.saveSession(newSession);
107242
+ }
107243
+ const metadata = await this._store.findUserLoginMetadata(userId);
107244
+ const info = {
107245
+ userId,
107246
+ sessionKey: formatV1SessionKey(
107247
+ userId,
107248
+ newSessionId,
107249
+ newSessionSecret,
107250
+ newSession.expireTimeMs
107251
+ ),
107252
+ connectionKey: formatV1ConnectionKey(
107253
+ userId,
107254
+ newSessionId,
107255
+ newConnectionSecret,
107256
+ newSession.expireTimeMs
107257
+ ),
107258
+ expireTimeMs: newSession.expireTimeMs,
107259
+ metadata: {
107260
+ hasUserAuthenticator: metadata?.hasUserAuthenticator ?? false,
107261
+ userAuthenticatorCredentialIds: metadata?.userAuthenticatorCredentialIds ?? [],
107262
+ hasPushSubscription: metadata?.hasPushSubscription ?? false,
107263
+ pushSubscriptionIds: metadata?.pushSubscriptionIds ?? []
107264
+ }
107265
+ };
107266
+ console.log(
107267
+ `[AuthController] [issueSession userId: ${userId} newSessionId: ${newSessionId} expiresAt: ${newSession.expireTimeMs}] Issued session.`
107268
+ );
107269
+ return {
107270
+ newSession,
107271
+ info
107272
+ };
107273
+ }
107274
+ };
107275
+ __decorateClass([
107276
+ traced(TRACE_NAME)
107277
+ ], AuthController.prototype, "createAccount", 1);
107278
+ __decorateClass([
107279
+ traced(TRACE_NAME)
107280
+ ], AuthController.prototype, "issueSession", 1);
107281
+ __decorateClass([
107282
+ traced(TRACE_NAME)
107283
+ ], AuthController.prototype, "_hashHighEntropyPasswordWithSalt", 1);
107284
+ __decorateClass([
107285
+ traced(TRACE_NAME)
107286
+ ], AuthController.prototype, "requestLogin", 1);
107287
+ __decorateClass([
107288
+ traced(TRACE_NAME)
107289
+ ], AuthController.prototype, "completeLogin", 1);
107290
+ __decorateClass([
107291
+ traced(TRACE_NAME)
107292
+ ], AuthController.prototype, "requestOpenIDLogin", 1);
107293
+ __decorateClass([
107294
+ traced(TRACE_NAME)
107295
+ ], AuthController.prototype, "processOpenIDAuthorizationCode", 1);
107296
+ __decorateClass([
107297
+ traced(TRACE_NAME)
107298
+ ], AuthController.prototype, "completeOpenIDLogin", 1);
107299
+ __decorateClass([
107300
+ traced(TRACE_NAME)
107301
+ ], AuthController.prototype, "requestPrivoSignUp", 1);
107302
+ __decorateClass([
107303
+ traced(TRACE_NAME)
107304
+ ], AuthController.prototype, "requestWebAuthnRegistration", 1);
107305
+ __decorateClass([
107306
+ traced(TRACE_NAME)
107307
+ ], AuthController.prototype, "completeWebAuthnRegistration", 1);
107308
+ __decorateClass([
107309
+ traced(TRACE_NAME)
107310
+ ], AuthController.prototype, "requestWebAuthnLogin", 1);
107311
+ __decorateClass([
107312
+ traced(TRACE_NAME)
107313
+ ], AuthController.prototype, "completeWebAuthnLogin", 1);
107314
+ __decorateClass([
107315
+ traced(TRACE_NAME)
107316
+ ], AuthController.prototype, "listUserAuthenticators", 1);
107317
+ __decorateClass([
107318
+ traced(TRACE_NAME)
107319
+ ], AuthController.prototype, "deleteUserAuthenticator", 1);
107320
+ __decorateClass([
107321
+ traced(TRACE_NAME)
107322
+ ], AuthController.prototype, "validateSessionKey", 1);
107323
+ __decorateClass([
107324
+ traced(TRACE_NAME)
107325
+ ], AuthController.prototype, "verifyPasswordAgainstHashes", 1);
107326
+ __decorateClass([
107327
+ traced(TRACE_NAME)
107328
+ ], AuthController.prototype, "validateConnectionToken", 1);
107329
+ __decorateClass([
107330
+ traced(TRACE_NAME)
107331
+ ], AuthController.prototype, "revokeSession", 1);
107332
+ __decorateClass([
107333
+ traced(TRACE_NAME)
107334
+ ], AuthController.prototype, "revokeAllSessions", 1);
107335
+ __decorateClass([
107336
+ traced(TRACE_NAME)
107337
+ ], AuthController.prototype, "replaceSession", 1);
107338
+ __decorateClass([
107339
+ traced(TRACE_NAME)
107340
+ ], AuthController.prototype, "listSessions", 1);
107341
+ __decorateClass([
107342
+ traced(TRACE_NAME)
107343
+ ], AuthController.prototype, "getUserInfo", 1);
107344
+ __decorateClass([
107345
+ traced(TRACE_NAME)
107346
+ ], AuthController.prototype, "getPublicUserInfo", 1);
107347
+ __decorateClass([
107348
+ traced(TRACE_NAME)
107349
+ ], AuthController.prototype, "updateUserInfo", 1);
107350
+ __decorateClass([
107351
+ traced(TRACE_NAME)
107352
+ ], AuthController.prototype, "requestPrivacyFeaturesChange", 1);
107353
+ __decorateClass([
107354
+ traced(TRACE_NAME)
107355
+ ], AuthController.prototype, "listEmailRules", 1);
107356
+ __decorateClass([
107357
+ traced(TRACE_NAME)
107358
+ ], AuthController.prototype, "listSmsRules", 1);
107359
+ __decorateClass([
107360
+ traced(TRACE_NAME)
107361
+ ], AuthController.prototype, "isValidEmailAddress", 1);
107362
+ __decorateClass([
107363
+ traced(TRACE_NAME)
107364
+ ], AuthController.prototype, "isValidDisplayName", 1);
107365
+ async function validateSessionKey(auth7, sessionKey) {
107366
+ if (!sessionKey) {
107367
+ return {
107368
+ success: false,
107369
+ userId: null,
107370
+ role: null,
107371
+ errorCode: "no_session_key",
107372
+ errorMessage: "A session key was not provided, but it is required for this operation."
107373
+ };
107374
+ }
107375
+ const result = await auth7.validateSessionKey(sessionKey);
107376
+ if (result.success === true) {
107377
+ const span = trace.getActiveSpan();
107378
+ if (span) {
107379
+ span.setAttributes({
107380
+ [import_semantic_conventions2.SEMATTRS_ENDUSER_ID]: result.userId,
107381
+ ["request.userId"]: result.userId,
107382
+ ["request.userRole"]: result.role,
107383
+ ["request.sessionId"]: result.sessionId,
107384
+ ["request.subscriptionId"]: result.subscriptionId,
107385
+ ["request.subscriptionTier"]: result.subscriptionTier
107386
+ });
107387
+ }
107388
+ }
107389
+ return result;
107310
107390
  }
107311
- function getPackageFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
107312
- const features = getSubscriptionFeatures(
107313
- config2,
107314
- subscriptionStatus,
107315
- subscriptionId,
107316
- type,
107317
- periodStartMs,
107318
- periodEndMs,
107319
- nowMs
107391
+ function getPrivacyFeaturesFromPermissions(featureIds, permissions) {
107392
+ const publishData = permissions.some(
107393
+ (p2) => p2.on && p2.featureId === featureIds.projectDevelopment
107320
107394
  );
107321
- return features.packages ?? { allowed: true };
107322
- }
107323
- function getNotificationFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
107324
- const features = getSubscriptionFeatures(
107325
- config2,
107326
- subscriptionStatus,
107327
- subscriptionId,
107328
- type,
107329
- periodStartMs,
107330
- periodEndMs,
107331
- nowMs
107395
+ const allowPublicData = publishData && permissions.some(
107396
+ (p2) => p2.on && p2.featureId === featureIds.publishProjects
107332
107397
  );
107333
- return features.notifications ?? { allowed: false };
107334
- }
107335
- function getWebhookFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
107336
- const features = getSubscriptionFeatures(
107337
- config2,
107338
- subscriptionStatus,
107339
- subscriptionId,
107340
- type,
107341
- periodStartMs,
107342
- periodEndMs,
107343
- nowMs
107398
+ const allowAI = permissions.some(
107399
+ (p2) => p2.on && p2.featureId === featureIds.buildAIEggs
107344
107400
  );
107345
- return features.webhooks ?? webhookFeaturesSchema.parse({ allowed: false });
107346
- }
107347
- function getComIdFeatures(config2, subscriptionStatus, subscriptionId, periodStartMs, periodEndMs, nowMs = Date.now()) {
107348
- const features = getSubscriptionFeatures(
107349
- config2,
107350
- subscriptionStatus,
107351
- subscriptionId,
107352
- "studio",
107353
- periodStartMs,
107354
- periodEndMs,
107355
- nowMs
107401
+ const allowPublicInsts = publishData && permissions.some(
107402
+ (p2) => p2.on && p2.featureId === featureIds.joinAndCollaborate
107356
107403
  );
107357
- return features.comId ?? {
107358
- allowed: false
107359
- // allowCustomComId: false,
107404
+ return {
107405
+ publishData,
107406
+ allowPublicData,
107407
+ allowAI,
107408
+ allowPublicInsts
107360
107409
  };
107361
107410
  }
107362
- function getLoomFeatures(config2, subscriptionStatus, subscriptionId, periodStartMs, periodEndMs, nowMs = Date.now()) {
107363
- const features = getSubscriptionFeatures(
107364
- config2,
107365
- subscriptionStatus,
107366
- subscriptionId,
107367
- "studio",
107368
- periodStartMs,
107369
- periodEndMs,
107370
- nowMs
107371
- );
107372
- return features.loom ?? { allowed: false };
107373
- }
107374
- function getHumeAiFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
107375
- const features = getSubscriptionFeatures(
107376
- config2,
107377
- subscriptionStatus,
107378
- subscriptionId,
107379
- type,
107380
- periodStartMs,
107381
- periodEndMs,
107382
- nowMs
107383
- );
107384
- return features.ai.hume ?? { allowed: false };
107385
- }
107386
- function getSubscriptionFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
107387
- if (!config2) {
107388
- return allowAllFeatures();
107411
+ function findRelyingPartyForOrigin(relyingParties, originOrHost) {
107412
+ if (!originOrHost) {
107413
+ return relyingParties[0];
107389
107414
  }
107390
- if (config2.tiers) {
107391
- const roleSubscriptions = config2.subscriptions.filter(
107392
- (s3) => subscriptionMatchesRole(s3, type)
107393
- );
107394
- if (isActiveSubscription(
107395
- subscriptionStatus,
107396
- periodStartMs,
107397
- periodEndMs,
107398
- nowMs
107399
- )) {
107400
- const sub = roleSubscriptions.find((s3) => s3.id === subscriptionId);
107401
- const tier = sub?.tier;
107402
- const features = tier ? config2.tiers[tier]?.features : null;
107403
- if (features) {
107404
- return features;
107405
- }
107406
- } else {
107407
- const sub = roleSubscriptions.find((s3) => s3.defaultSubscription);
107408
- const tier = sub?.tier;
107409
- const features = tier ? config2.tiers[tier]?.features : null;
107410
- if (features) {
107411
- return features;
107412
- }
107415
+ return relyingParties.find((rp) => {
107416
+ const matchesOrigin = rp.origin === originOrHost;
107417
+ if (matchesOrigin) {
107418
+ return true;
107413
107419
  }
107414
- }
107415
- return config2.defaultFeatures?.[type] ?? allowAllFeatures();
107416
- }
107417
- function getSubscriptionTier(config2, subscriptionStatus, subId) {
107418
- if (!config2) {
107419
- return null;
107420
- }
107421
- if (!isActiveSubscription(subscriptionStatus)) {
107422
- return null;
107423
- }
107424
- const sub = config2.subscriptions.find((s3) => s3.id === subId);
107425
- return sub?.tier ?? null;
107426
- }
107427
- function subscriptionMatchesRole(subscription, role) {
107428
- const isUserOnly = subscription.userOnly ?? false;
107429
- const isStudioOnly = subscription.studioOnly ?? false;
107430
- const matchesRole = isUserOnly && role === "user" || isStudioOnly && role === "studio" || !isUserOnly && !isStudioOnly;
107431
- return matchesRole;
107420
+ const originUrl = new URL(rp.origin);
107421
+ const host = originUrl.host;
107422
+ return originOrHost === host;
107423
+ });
107432
107424
  }
107433
107425
 
107426
+ // ../aux-records/RecordsController.ts
107427
+ var import_tweetnacl5 = __toESM(require_nacl_fast());
107428
+ var import_base64_js11 = __toESM(require_base64_js());
107429
+
107434
107430
  // ../aux-common/records/RecordKeys.js
107435
107431
  var DEFAULT_RECORD_KEY_POLICY2 = "subjectfull";
107436
107432
  function formatV2RecordKey(recordName, recordSecret, keyPolicy) {
@@ -108466,7 +108462,8 @@ var RecordsController = class {
108466
108462
  subscriptionTier: getSubscriptionTier(
108467
108463
  config2,
108468
108464
  s3.subscriptionStatus,
108469
- s3.subscriptionId
108465
+ s3.subscriptionId,
108466
+ "studio"
108470
108467
  ),
108471
108468
  ownerStudioComId: s3.ownerStudioComId,
108472
108469
  comId: s3.comId
@@ -108506,7 +108503,8 @@ var RecordsController = class {
108506
108503
  subscriptionTier: getSubscriptionTier(
108507
108504
  config2,
108508
108505
  s3.subscriptionStatus,
108509
- s3.subscriptionId
108506
+ s3.subscriptionId,
108507
+ "studio"
108510
108508
  ),
108511
108509
  ownerStudioComId: s3.ownerStudioComId,
108512
108510
  comId: s3.comId
@@ -115310,7 +115308,7 @@ var RecordsServer = class {
115310
115308
  this._searchRecordsController = searchRecordsController;
115311
115309
  this._tracer = trace.getTracer(
115312
115310
  "RecordsServer",
115313
- false ? void 0 : "v3.7.0-alpha.16977445547"
115311
+ false ? void 0 : "v3.7.0-alpha.17049743052"
115314
115312
  );
115315
115313
  this._procedures = this._createProcedures();
115316
115314
  this._setupRoutes();
@@ -118347,8 +118345,8 @@ var RecordsServer = class {
118347
118345
  return {
118348
118346
  success: true,
118349
118347
  ...metadata,
118350
- version: true ? "v3.7.0-alpha.16977445547" : void 0,
118351
- versionHash: true ? "d22abb62ddde636eefe58909962668df3d6c9566" : void 0
118348
+ version: true ? "v3.7.0-alpha.17049743052" : void 0,
118349
+ versionHash: true ? "6b04efe09edd321556d2dfcc7d56a8f7d25336c1" : void 0
118352
118350
  };
118353
118351
  })
118354
118352
  };
@@ -150057,7 +150055,7 @@ var config = new Conf({
150057
150055
  projectName: "casualos-cli"
150058
150056
  });
150059
150057
  var program2 = new Command();
150060
- program2.name("casualos").description("A CLI for CasualOS").version("v3.7.0-alpha.16977445547").option(
150058
+ program2.name("casualos").description("A CLI for CasualOS").version("v3.7.0-alpha.17049743052").option(
150061
150059
  "-e, --endpoint <url>",
150062
150060
  "The endpoint to use for queries. Can be used to override the current endpoint."
150063
150061
  );