@fabrika/provider-zerops 0.0.23 → 0.0.24

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/package.json +5 -5
  2. package/src/api.ts +6 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/provider-zerops",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,9 +32,9 @@
32
32
  "gen:schema": "bun scripts/generate-zerops-types.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@fabrika/auth": "^0.0.23",
36
- "@fabrika/auth-core": "^0.0.23",
37
- "@fabrika/provider-contract": "^0.0.23",
38
- "@fabrika/proxy-contract": "^0.0.23"
35
+ "@fabrika/auth": "^0.0.24",
36
+ "@fabrika/auth-core": "^0.0.24",
37
+ "@fabrika/provider-contract": "^0.0.24",
38
+ "@fabrika/proxy-contract": "^0.0.24"
39
39
  }
40
40
  }
package/src/api.ts CHANGED
@@ -784,6 +784,9 @@ export class ZeropsApiError extends Error {
784
784
  /** The platform's code for "this service stack already has a variable under that key". */
785
785
  const USER_DATA_DUPLICATE_KEY = 'userDataDuplicateKey'
786
786
 
787
+ /** The platform's code for a service stack it cannot find — sent with a 400, not a 404. */
788
+ const ZEROPS_SERVICE_STACK_NOT_FOUND = 'serviceStackNotFound'
789
+
787
790
  /**
788
791
  * The platform's code for "this service publishes no HTTP port", the answer `enableSubdomainAccess` gives
789
792
  * before a service's first deploy. Exported so a caller can say what is missing instead of relaying prose.
@@ -1124,8 +1127,9 @@ export const createZeropsApi = (options: ZeropsApiOptions): ZeropsApi => {
1124
1127
  try {
1125
1128
  return readService(await request('find service', 'GET', `/service-stack-by-name/${projectId}/${encodeURIComponent(hostname)}`, { signal }))
1126
1129
  } catch (error) {
1127
- // A missing service is an answer, not a failure; anything else propagates.
1128
- if (error instanceof Error && error.message.includes('(404)')) {
1130
+ // A missing service is an answer, not a failure; anything else propagates. The live platform
1131
+ // says it as 400 `serviceStackNotFound` (docs/reference/zerops-platform.md), not as a 404.
1132
+ if (error instanceof ZeropsApiError && (error.status === 404 || error.code === ZEROPS_SERVICE_STACK_NOT_FOUND)) {
1129
1133
  return null
1130
1134
  }
1131
1135
  throw error