@palbase/backend 20.0.0 → 21.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -91,7 +91,6 @@ __export(src_exports, {
91
91
  __runWithRuntime: () => __runWithRuntime,
92
92
  __setRuntime: () => __setRuntime,
93
93
  __shutdownResources: () => __shutdownResources,
94
- auth: () => auth,
95
94
  bigint: () => bigint,
96
95
  boolean: () => boolean,
97
96
  bucket: () => bucket,
@@ -107,7 +106,6 @@ __export(src_exports, {
107
106
  defineSecrets: () => defineSecrets,
108
107
  defineStorage: () => defineStorage,
109
108
  defineTestUsers: () => defineTestUsers,
110
- documents: () => documents,
111
109
  entitlementFor: () => entitlementFor,
112
110
  enumType: () => enumType,
113
111
  extractVariables: () => extractVariables,
@@ -135,7 +133,6 @@ __export(src_exports, {
135
133
  reservedSecretKey: () => reservedSecretKey,
136
134
  secret: () => secret,
137
135
  spendFor: () => spendFor,
138
- storage: () => storage,
139
136
  testUser: () => testUser,
140
137
  text: () => text,
141
138
  timestamp: () => timestamp,
@@ -648,13 +645,13 @@ var Database = Object.assign(makeTypedSurface(rawDatabase), {
648
645
  }
649
646
  });
650
647
  var Documents = makeServiceProxy("Documents");
651
- function makeBucketsAccessor(storage2) {
648
+ function makeBucketsAccessor(storage) {
652
649
  return new Proxy(
653
650
  {},
654
651
  {
655
652
  get(_t, prop) {
656
653
  if (typeof prop !== "string") return void 0;
657
- return storage2().bucket(prop);
654
+ return storage().bucket(prop);
658
655
  }
659
656
  }
660
657
  );
@@ -1706,13 +1703,13 @@ function buildBucketClient(http, bucketName) {
1706
1703
  },
1707
1704
  async remove(paths) {
1708
1705
  for (const p of paths) validateStoragePath(p);
1709
- const removed2 = [];
1706
+ const removed = [];
1710
1707
  for (const p of paths) {
1711
1708
  const res = await http.request("DELETE", objectPath(p));
1712
1709
  if (res.error) return { data: null, error: res.error, status: res.status };
1713
- removed2.push(toFileObject(bucketName, { path: p }));
1710
+ removed.push(toFileObject(bucketName, { path: p }));
1714
1711
  }
1715
- return { data: removed2, error: null, status: 200 };
1712
+ return { data: removed, error: null, status: 200 };
1716
1713
  },
1717
1714
  async move(from, to) {
1718
1715
  validateStoragePath(from);
@@ -3268,11 +3265,11 @@ function getHookConfig(ctor) {
3268
3265
 
3269
3266
  // src/decorators/upload.ts
3270
3267
  function Upload(subpath, config) {
3271
- const { auth: auth2, rateLimit, ...uploadConfig } = config;
3268
+ const { auth, rateLimit, ...uploadConfig } = config;
3272
3269
  validateUploadConfigShape(uploadConfig);
3273
3270
  const options = {
3274
3271
  uploadConfig,
3275
- ...auth2 !== void 0 ? { auth: auth2 } : {},
3272
+ ...auth !== void 0 ? { auth } : {},
3276
3273
  ...rateLimit !== void 0 ? { rateLimit } : {}
3277
3274
  };
3278
3275
  return function(target, propertyKey) {
@@ -3298,10 +3295,10 @@ function validateUploadConfigShape(c) {
3298
3295
  throw new Error("@Upload config.pathTemplate must be a non-empty key template");
3299
3296
  }
3300
3297
  }
3301
- function validateUploadAgainstStorage(uploadConfig, storage2, routeLabel) {
3302
- const def = storage2.buckets[uploadConfig.bucket];
3298
+ function validateUploadAgainstStorage(uploadConfig, storage, routeLabel) {
3299
+ const def = storage.buckets[uploadConfig.bucket];
3303
3300
  if (def === void 0) {
3304
- const known = Object.keys(storage2.buckets);
3301
+ const known = Object.keys(storage.buckets);
3305
3302
  throw new Error(
3306
3303
  `@Upload route ${routeLabel} targets bucket "${uploadConfig.bucket}" which is not declared in defineStorage(...). ` + (known.length ? `Known buckets: ${known.join(", ")}.` : "No buckets are declared.")
3307
3304
  );
@@ -3658,34 +3655,6 @@ async function __shutdownResources() {
3658
3655
  registry2.length = 0;
3659
3656
  }
3660
3657
 
3661
- // src/hooks.ts
3662
- function removed(helper, decorator, event) {
3663
- throw new Error(
3664
- `${helper}() does not register anything and never did \u2014 nothing in the runtime or the bundler reads what it returns, so the handler you passed would never run. Declare it instead in hooks/<name>.ts:
3665
-
3666
- export default class MyHooks {
3667
- ${decorator}("${event}")
3668
- async handle(event, meta) { /* \u2026 */ }
3669
- }
3670
- `
3671
- );
3672
- }
3673
- var auth = {
3674
- onUserCreated: (_h) => removed("auth.onUserCreated", "@Hook", "before.user.create"),
3675
- onSignIn: (_h) => removed("auth.onSignIn", "@Hook", "before.login"),
3676
- onSignOut: (_h) => removed("auth.onSignOut", "@On", "after.session.revoke"),
3677
- onPasswordReset: (_h) => removed("auth.onPasswordReset", "@Hook", "before.password.reset")
3678
- };
3679
- var storage = {
3680
- onFileUploaded: (_h) => removed("storage.onFileUploaded", "@On", "file.uploaded"),
3681
- onFileDeleted: (_h) => removed("storage.onFileDeleted", "@On", "file.deleted")
3682
- };
3683
- var documents = {
3684
- onDocumentCreated: (_h) => removed("documents.onDocumentCreated", "@On", "document.created"),
3685
- onDocumentUpdated: (_h) => removed("documents.onDocumentUpdated", "@On", "document.updated"),
3686
- onDocumentDeleted: (_h) => removed("documents.onDocumentDeleted", "@On", "document.deleted")
3687
- };
3688
-
3689
3658
  // src/index.ts
3690
3659
  var import_zod2 = require("zod");
3691
3660
  // Annotate the CommonJS export names for ESM import in node:
@@ -3761,7 +3730,6 @@ var import_zod2 = require("zod");
3761
3730
  __runWithRuntime,
3762
3731
  __setRuntime,
3763
3732
  __shutdownResources,
3764
- auth,
3765
3733
  bigint,
3766
3734
  boolean,
3767
3735
  bucket,
@@ -3777,7 +3745,6 @@ var import_zod2 = require("zod");
3777
3745
  defineSecrets,
3778
3746
  defineStorage,
3779
3747
  defineTestUsers,
3780
- documents,
3781
3748
  entitlementFor,
3782
3749
  enumType,
3783
3750
  extractVariables,
@@ -3805,7 +3772,6 @@ var import_zod2 = require("zod");
3805
3772
  reservedSecretKey,
3806
3773
  secret,
3807
3774
  spendFor,
3808
- storage,
3809
3775
  testUser,
3810
3776
  text,
3811
3777
  timestamp,