@lunora/flags 1.0.0-alpha.2 → 1.0.0-alpha.4

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.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  export { defineFlags, isFlagsDefinition } from './packem_shared/defineFlags-DAIO8cWQ.mjs';
2
- export { createFlags } from './packem_shared/createFlags-CAhOHjdv.mjs';
2
+ export { createFlags } from './packem_shared/createFlags-CEbcdnqZ.mjs';
@@ -1,3 +1,4 @@
1
+ import { LunoraError } from '@lunora/errors';
1
2
  import { OpenFeature, ErrorCode } from '@openfeature/server-sdk';
2
3
 
3
4
  const DOMAIN = "lunora";
@@ -49,7 +50,7 @@ const resolveDetails = (client, type, flagKey, defaultValue, context) => {
49
50
  return client.getStringDetails(flagKey, defaultValue, context);
50
51
  }
51
52
  default: {
52
- throw new Error(`createFlags: unknown flag type "${type}"`);
53
+ throw new LunoraError("INTERNAL", `createFlags: unknown flag type "${type}"`);
53
54
  }
54
55
  }
55
56
  };
@@ -1,4 +1,5 @@
1
1
  import { FlagshipServerProvider } from '@cloudflare/flagship/server';
2
+ import { LunoraError } from '@lunora/errors';
2
3
 
3
4
  const isBindingOptions = (options) => "binding" in options && typeof options.binding === "string";
4
5
  const flagshipProvider = (options) => {
@@ -7,7 +8,8 @@ const flagshipProvider = (options) => {
7
8
  return (env) => {
8
9
  const binding = env[bindingName];
9
10
  if (binding === void 0 || binding === null) {
10
- throw new Error(
11
+ throw new LunoraError(
12
+ "INTERNAL",
11
13
  `flagshipProvider: no binding "${bindingName}" found on env. Add a \`flagship\` binding to wrangler.jsonc, e.g. { "flagship": [{ "binding": "${bindingName}", "app_id": "your-app-id" }] }.`
12
14
  );
13
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/flags",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.4",
4
4
  "description": "OpenFeature-based feature flags for Lunora — ctx.flags, useFlag, and a first-class Cloudflare Flagship provider with any OpenFeature provider pluggable",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -60,6 +60,7 @@
60
60
  "access": "public"
61
61
  },
62
62
  "dependencies": {
63
+ "@lunora/errors": "1.0.0-alpha.1",
63
64
  "@openfeature/server-sdk": "^1.20.2"
64
65
  },
65
66
  "peerDependencies": {