@ankhorage/contracts 19.1.0 → 19.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/deployProvider.d.ts +5 -0
- package/dist/deployProvider.d.ts.map +1 -0
- package/dist/deployProvider.js +5 -0
- package/dist/deployProvider.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/deployMonetization.d.ts +78 -0
- package/dist/types/deployMonetization.d.ts.map +1 -0
- package/dist/types/deployMonetization.js +2 -0
- package/dist/types/deployMonetization.js.map +1 -0
- package/dist/types/deployProvider.d.ts +266 -0
- package/dist/types/deployProvider.d.ts.map +1 -0
- package/dist/types/deployProvider.js +21 -0
- package/dist/types/deployProvider.js.map +1 -0
- package/dist/types/deployRelease.d.ts +128 -0
- package/dist/types/deployRelease.d.ts.map +1 -0
- package/dist/types/deployRelease.js +2 -0
- package/dist/types/deployRelease.js.map +1 -0
- package/dist/types/deployStoreListing.d.ts +91 -0
- package/dist/types/deployStoreListing.d.ts.map +1 -0
- package/dist/types/deployStoreListing.js +2 -0
- package/dist/types/deployStoreListing.js.map +1 -0
- package/package.json +5 -1
- package/src/deployProvider.test.ts +82 -0
- package/src/deployProvider.ts +4 -0
- package/src/index.ts +1 -0
- package/src/types/deployMonetization.ts +106 -0
- package/src/types/deployProvider.ts +338 -0
- package/src/types/deployRelease.ts +153 -0
- package/src/types/deployStoreListing.ts +125 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployRelease.js","sourceRoot":"","sources":["../../src/types/deployRelease.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DeploymentCredentialReference,\n DeploymentProviderResult,\n DeploymentSecretResolver,\n DeploymentStoreIdentity,\n} from './deployProvider';\n\nexport type ReleaseTarget = 'web' | 'android' | 'ios';\nexport type ReleaseRolloutMode = 'immediate' | 'staged';\n\nexport interface ReleaseNote {\n readonly locale: string;\n readonly text: string;\n}\n\nexport interface ReleaseTargetRollout {\n readonly mode: ReleaseRolloutMode;\n readonly initialFraction?: string;\n}\n\nexport interface ReleaseRollout {\n readonly web?: ReleaseTargetRollout;\n readonly android?: ReleaseTargetRollout;\n readonly ios?: ReleaseTargetRollout;\n}\n\nexport interface ReleaseDesiredState {\n readonly version: string;\n readonly targets: readonly ReleaseTarget[];\n readonly notes: readonly ReleaseNote[];\n readonly rollout: ReleaseRollout;\n readonly revision: string;\n}\n\nexport interface ReleaseObservedWebState {\n readonly target: 'web';\n readonly version: string | null;\n readonly artifactRevision: string | null;\n}\n\nexport interface ReleaseObservedAndroidState {\n readonly target: 'android';\n readonly version: string | null;\n readonly artifactRevision: string | null;\n readonly versionCodes: readonly string[];\n readonly releaseNotes: readonly ReleaseNote[];\n readonly rolloutStatus: 'missing' | 'draft' | 'inProgress' | 'halted' | 'completed';\n readonly userFraction?: string;\n}\n\nexport interface ReleaseObservedIosState {\n readonly target: 'ios';\n readonly version: string | null;\n readonly artifactRevision: string | null;\n readonly buildNumber: string | null;\n readonly releaseNotes: readonly ReleaseNote[];\n readonly appVersionState?: string;\n readonly releaseType?: string;\n readonly reviewState?: string;\n readonly phasedReleaseState: 'INACTIVE' | 'ACTIVE' | 'PAUSED' | 'COMPLETE' | null;\n}\n\nexport type ReleaseObservedTargetState =\n ReleaseObservedWebState | ReleaseObservedAndroidState | ReleaseObservedIosState;\n\nexport interface ReleaseObservedState {\n readonly targets: readonly ReleaseObservedTargetState[];\n}\n\nexport type ReleasePlanStatus = 'no-change' | 'changes' | 'waiting' | 'blocked';\nexport type ReleaseStepRetry = 'safe' | 'reinspect' | 'never';\nexport type ReleaseStepOperation =\n | 'prepare'\n | 'build'\n | 'publish'\n | 'sync-notes'\n | 'submit-review'\n | 'release'\n | 'rollout'\n | 'verify'\n | 'record';\n\nexport interface ReleaseDiagnostic {\n readonly severity: 'warning' | 'error';\n readonly code: string;\n readonly message: string;\n readonly target?: ReleaseTarget | 'release';\n}\n\nexport interface ReleasePlanStep {\n readonly id: string;\n readonly target: ReleaseTarget | 'release';\n readonly operation: ReleaseStepOperation;\n readonly dependsOn: readonly string[];\n readonly retry: ReleaseStepRetry;\n readonly irreversible: boolean;\n}\n\nexport interface ReleasePlan {\n readonly status: ReleasePlanStatus;\n readonly desiredRevision: string;\n readonly currentRevision: string;\n readonly steps: readonly ReleasePlanStep[];\n readonly diagnostics: readonly ReleaseDiagnostic[];\n}\n\nexport type ReleaseLifecycleControl =\n | { readonly target: 'android'; readonly action: 'halt' | 'resume' }\n | {\n readonly target: 'ios';\n readonly action: 'pause-phased' | 'resume-phased' | 'cancel-phased' | 'cancel-review';\n };\n\nexport type ReleaseMutationResult =\n | { readonly status: 'completed' }\n | { readonly status: 'blocked'; readonly code: string }\n | { readonly status: 'failed'; readonly code: string };\n\nexport type ReleaseControlExecutionResult =\n | { readonly status: 'completed'; readonly mutationAttempted: boolean }\n | { readonly status: 'blocked'; readonly mutationAttempted: false; readonly code: string }\n | { readonly status: 'failed'; readonly mutationAttempted: boolean; readonly code: string };\n\nexport interface ReleaseAdapterContext {\n readonly identity: DeploymentStoreIdentity;\n readonly credentials: readonly DeploymentCredentialReference[];\n readonly resolveSecret: DeploymentSecretResolver;\n}\n\nexport interface ReleaseInspectionRequest extends ReleaseAdapterContext {\n readonly version: string;\n}\n\nexport interface ReleaseStepExecutionRequest extends ReleaseAdapterContext {\n readonly desired: ReleaseDesiredState;\n readonly step: ReleasePlanStep;\n}\n\nexport interface ReleaseControlRequest extends ReleaseAdapterContext {\n readonly desired: ReleaseDesiredState;\n readonly control: ReleaseLifecycleControl;\n}\n\nexport type ReleaseObservedNativeState = ReleaseObservedAndroidState | ReleaseObservedIosState;\n\nexport interface DeploymentReleaseAdapter {\n readonly target: 'android' | 'ios';\n inspectAsync(\n request: ReleaseInspectionRequest,\n ): Promise<DeploymentProviderResult<ReleaseObservedNativeState>>;\n executeStepAsync(request: ReleaseStepExecutionRequest): Promise<ReleaseMutationResult>;\n controlAsync(request: ReleaseControlRequest): Promise<ReleaseControlExecutionResult>;\n}\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { DeploymentCredentialReference, DeploymentProviderResult, DeploymentSecretResolver, DeploymentStoreIdentity } from './deployProvider';
|
|
2
|
+
export type StoreListingTarget = 'android' | 'ios';
|
|
3
|
+
export type StoreListingField = 'name' | 'summary' | 'description' | 'keywords' | 'promotionalText' | 'supportUrl' | 'marketingUrl' | 'privacyPolicyUrl' | 'promoVideoUrl';
|
|
4
|
+
export interface StoreListingLocale {
|
|
5
|
+
readonly locale: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly summary?: string;
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
readonly keywords?: readonly string[];
|
|
10
|
+
readonly promotionalText?: string;
|
|
11
|
+
readonly supportUrl?: string;
|
|
12
|
+
readonly marketingUrl?: string;
|
|
13
|
+
readonly privacyPolicyUrl?: string;
|
|
14
|
+
readonly promoVideoUrl?: string;
|
|
15
|
+
}
|
|
16
|
+
export type StoreListingAssetMediaType = 'image/jpeg' | 'image/png';
|
|
17
|
+
export interface StoreListingAsset {
|
|
18
|
+
readonly relativePath: string;
|
|
19
|
+
readonly sha256: string;
|
|
20
|
+
readonly md5: string;
|
|
21
|
+
readonly size: number;
|
|
22
|
+
readonly mediaType: StoreListingAssetMediaType;
|
|
23
|
+
}
|
|
24
|
+
export interface StoreListingAssetSet {
|
|
25
|
+
readonly target: StoreListingTarget;
|
|
26
|
+
readonly locale: string;
|
|
27
|
+
readonly variant: string;
|
|
28
|
+
readonly assets: readonly StoreListingAsset[];
|
|
29
|
+
}
|
|
30
|
+
export interface StoreListingRemoteAssetSet {
|
|
31
|
+
readonly target: StoreListingTarget;
|
|
32
|
+
readonly locale: string;
|
|
33
|
+
readonly variant: string;
|
|
34
|
+
readonly checksum: 'md5' | 'sha256';
|
|
35
|
+
readonly hashes: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
export interface StoreListingDesiredState {
|
|
38
|
+
readonly revision: string;
|
|
39
|
+
readonly locales: readonly StoreListingLocale[];
|
|
40
|
+
readonly assetSets: readonly StoreListingAssetSet[];
|
|
41
|
+
}
|
|
42
|
+
export interface StoreListingDiagnostic {
|
|
43
|
+
readonly severity: 'warning' | 'error';
|
|
44
|
+
readonly code: string;
|
|
45
|
+
readonly message: string;
|
|
46
|
+
readonly target?: StoreListingTarget;
|
|
47
|
+
readonly locale?: string;
|
|
48
|
+
readonly field?: StoreListingField;
|
|
49
|
+
readonly variant?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface StoreListingTargetState {
|
|
52
|
+
readonly target: StoreListingTarget;
|
|
53
|
+
readonly locales: readonly StoreListingLocale[];
|
|
54
|
+
readonly assetSets: readonly StoreListingRemoteAssetSet[];
|
|
55
|
+
readonly supportedFields: readonly StoreListingField[];
|
|
56
|
+
readonly diagnostics: readonly StoreListingDiagnostic[];
|
|
57
|
+
}
|
|
58
|
+
export type StoreListingPlanOperation = 'create-locale' | 'update-locale' | 'replace-assets';
|
|
59
|
+
export interface StoreListingPlanStep {
|
|
60
|
+
readonly id: string;
|
|
61
|
+
readonly target: StoreListingTarget;
|
|
62
|
+
readonly operation: StoreListingPlanOperation;
|
|
63
|
+
readonly locale: string;
|
|
64
|
+
readonly variant?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface StoreListingPlan {
|
|
67
|
+
readonly status: 'no-change' | 'changes' | 'blocked';
|
|
68
|
+
readonly desiredRevision: string;
|
|
69
|
+
readonly currentRevision: string;
|
|
70
|
+
readonly steps: readonly StoreListingPlanStep[];
|
|
71
|
+
readonly diagnostics: readonly StoreListingDiagnostic[];
|
|
72
|
+
}
|
|
73
|
+
export interface StoreListingAssetReader {
|
|
74
|
+
readAsync(relativePath: string): Promise<Uint8Array>;
|
|
75
|
+
}
|
|
76
|
+
export interface StoreListingAdapterContext {
|
|
77
|
+
readonly identity: DeploymentStoreIdentity;
|
|
78
|
+
readonly credentials: readonly DeploymentCredentialReference[];
|
|
79
|
+
readonly resolveSecret: DeploymentSecretResolver;
|
|
80
|
+
}
|
|
81
|
+
export interface StoreListingSyncRequest extends StoreListingAdapterContext {
|
|
82
|
+
readonly desired: StoreListingDesiredState;
|
|
83
|
+
readonly plan: StoreListingPlan;
|
|
84
|
+
readonly assets: StoreListingAssetReader;
|
|
85
|
+
}
|
|
86
|
+
export interface DeploymentStoreListingAdapter {
|
|
87
|
+
readonly target: StoreListingTarget;
|
|
88
|
+
inspectAsync(context: StoreListingAdapterContext): Promise<DeploymentProviderResult<StoreListingTargetState>>;
|
|
89
|
+
syncAsync(request: StoreListingSyncRequest): Promise<DeploymentProviderResult<StoreListingTargetState>>;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=deployStoreListing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployStoreListing.d.ts","sourceRoot":"","sources":["../../src/types/deployStoreListing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,KAAK,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,SAAS,GACT,aAAa,GACb,UAAU,GACV,iBAAiB,GACjB,YAAY,GACZ,cAAc,GACd,kBAAkB,GAClB,eAAe,CAAC;AAEpB,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ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C,KAAK,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAChD,QAAQ,CAAC,WAAW,EAAE,SAAS,sBAAsB,EAAE,CAAC;CACzD;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,6BAA6B,EAAE,CAAC;IAC/D,QAAQ,CAAC,aAAa,EAAE,wBAAwB,CAAC;CAClD;AAED,MAAM,WAAW,uBAAwB,SAAQ,0BAA0B;IACzE,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;IAC3C,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;CAC1C;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,YAAY,CACV,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,wBAAwB,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAC9D,SAAS,CACP,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC,uBAAuB,CAAC,CAAC,CAAC;CAC/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployStoreListing.js","sourceRoot":"","sources":["../../src/types/deployStoreListing.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DeploymentCredentialReference,\n DeploymentProviderResult,\n DeploymentSecretResolver,\n DeploymentStoreIdentity,\n} from './deployProvider';\n\nexport type StoreListingTarget = 'android' | 'ios';\n\nexport type StoreListingField =\n | 'name'\n | 'summary'\n | 'description'\n | 'keywords'\n | 'promotionalText'\n | 'supportUrl'\n | 'marketingUrl'\n | 'privacyPolicyUrl'\n | 'promoVideoUrl';\n\nexport interface StoreListingLocale {\n readonly locale: string;\n readonly name: string;\n readonly summary?: string;\n readonly description?: string;\n readonly keywords?: readonly string[];\n readonly promotionalText?: string;\n readonly supportUrl?: string;\n readonly marketingUrl?: string;\n readonly privacyPolicyUrl?: string;\n readonly promoVideoUrl?: string;\n}\n\nexport type StoreListingAssetMediaType = 'image/jpeg' | 'image/png';\n\nexport interface StoreListingAsset {\n readonly relativePath: string;\n readonly sha256: string;\n readonly md5: string;\n readonly size: number;\n readonly mediaType: StoreListingAssetMediaType;\n}\n\nexport interface StoreListingAssetSet {\n readonly target: StoreListingTarget;\n readonly locale: string;\n readonly variant: string;\n readonly assets: readonly StoreListingAsset[];\n}\n\nexport interface StoreListingRemoteAssetSet {\n readonly target: StoreListingTarget;\n readonly locale: string;\n readonly variant: string;\n readonly checksum: 'md5' | 'sha256';\n readonly hashes: readonly string[];\n}\n\nexport interface StoreListingDesiredState {\n readonly revision: string;\n readonly locales: readonly StoreListingLocale[];\n readonly assetSets: readonly StoreListingAssetSet[];\n}\n\nexport interface StoreListingDiagnostic {\n readonly severity: 'warning' | 'error';\n readonly code: string;\n readonly message: string;\n readonly target?: StoreListingTarget;\n readonly locale?: string;\n readonly field?: StoreListingField;\n readonly variant?: string;\n}\n\nexport interface StoreListingTargetState {\n readonly target: StoreListingTarget;\n readonly locales: readonly StoreListingLocale[];\n readonly assetSets: readonly StoreListingRemoteAssetSet[];\n readonly supportedFields: readonly StoreListingField[];\n readonly diagnostics: readonly StoreListingDiagnostic[];\n}\n\nexport type StoreListingPlanOperation = 'create-locale' | 'update-locale' | 'replace-assets';\n\nexport interface StoreListingPlanStep {\n readonly id: string;\n readonly target: StoreListingTarget;\n readonly operation: StoreListingPlanOperation;\n readonly locale: string;\n readonly variant?: string;\n}\n\nexport interface StoreListingPlan {\n readonly status: 'no-change' | 'changes' | 'blocked';\n readonly desiredRevision: string;\n readonly currentRevision: string;\n readonly steps: readonly StoreListingPlanStep[];\n readonly diagnostics: readonly StoreListingDiagnostic[];\n}\n\nexport interface StoreListingAssetReader {\n readAsync(relativePath: string): Promise<Uint8Array>;\n}\n\nexport interface StoreListingAdapterContext {\n readonly identity: DeploymentStoreIdentity;\n readonly credentials: readonly DeploymentCredentialReference[];\n readonly resolveSecret: DeploymentSecretResolver;\n}\n\nexport interface StoreListingSyncRequest extends StoreListingAdapterContext {\n readonly desired: StoreListingDesiredState;\n readonly plan: StoreListingPlan;\n readonly assets: StoreListingAssetReader;\n}\n\nexport interface DeploymentStoreListingAdapter {\n readonly target: StoreListingTarget;\n inspectAsync(\n context: StoreListingAdapterContext,\n ): Promise<DeploymentProviderResult<StoreListingTargetState>>;\n syncAsync(\n request: StoreListingSyncRequest,\n ): Promise<DeploymentProviderResult<StoreListingTargetState>>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/contracts",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.2.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"ankh": {
|
|
6
6
|
"category": "contracts",
|
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
"types": "./dist/deploy.d.ts",
|
|
59
59
|
"default": "./dist/deploy.js"
|
|
60
60
|
},
|
|
61
|
+
"./deploy-provider": {
|
|
62
|
+
"types": "./dist/deployProvider.d.ts",
|
|
63
|
+
"default": "./dist/deployProvider.js"
|
|
64
|
+
},
|
|
61
65
|
"./runtime": {
|
|
62
66
|
"types": "./dist/runtimeCallbacks.d.ts",
|
|
63
67
|
"default": "./dist/runtimeCallbacks.js"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { describe, expect, it } from 'bun:test';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
DEPLOYMENT_PROVIDER_CAPABILITY_IDS,
|
|
8
|
+
type DeploymentProviderRegistration,
|
|
9
|
+
} from './deployProvider';
|
|
10
|
+
|
|
11
|
+
const fakeProvider: DeploymentProviderRegistration = {
|
|
12
|
+
descriptor: {
|
|
13
|
+
id: 'fake',
|
|
14
|
+
packageName: '@ankhorage/deploy-provider-fake',
|
|
15
|
+
displayName: 'Fake provider',
|
|
16
|
+
capabilities: [{ id: 'web-publish', targets: ['web'] }],
|
|
17
|
+
},
|
|
18
|
+
webPublisher: {
|
|
19
|
+
publishAsync: (request) =>
|
|
20
|
+
Promise.resolve({
|
|
21
|
+
status: 'completed',
|
|
22
|
+
value: {
|
|
23
|
+
target: 'web',
|
|
24
|
+
revision: request.revision,
|
|
25
|
+
provider: 'fake',
|
|
26
|
+
deploymentId: 'fake-deployment',
|
|
27
|
+
url: 'https://example.test',
|
|
28
|
+
production: request.intent.mode === 'production',
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
describe('deployment provider contracts', () => {
|
|
35
|
+
it('defines the portable provider capability vocabulary', () => {
|
|
36
|
+
expect(DEPLOYMENT_PROVIDER_CAPABILITY_IDS).toEqual([
|
|
37
|
+
'setup',
|
|
38
|
+
'web-publish',
|
|
39
|
+
'android-build',
|
|
40
|
+
'android-publish',
|
|
41
|
+
'ios-build',
|
|
42
|
+
'ios-publish',
|
|
43
|
+
'store-listing',
|
|
44
|
+
'monetization',
|
|
45
|
+
'release',
|
|
46
|
+
]);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('supports an external provider registration without Deploy implementation types', async () => {
|
|
50
|
+
const result = await fakeProvider.webPublisher?.publishAsync({
|
|
51
|
+
projectRoot: '/project',
|
|
52
|
+
exportDirectory: '/tmp/export',
|
|
53
|
+
revision: 'revision-1',
|
|
54
|
+
intent: { mode: 'production' },
|
|
55
|
+
credentials: [],
|
|
56
|
+
resolveSecret: () => Promise.resolve(null),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(result).toEqual({
|
|
60
|
+
status: 'completed',
|
|
61
|
+
value: {
|
|
62
|
+
target: 'web',
|
|
63
|
+
revision: 'revision-1',
|
|
64
|
+
provider: 'fake',
|
|
65
|
+
deploymentId: 'fake-deployment',
|
|
66
|
+
url: 'https://example.test',
|
|
67
|
+
production: true,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('publishes the focused deployment provider contract subpath', async () => {
|
|
73
|
+
const packageJson = JSON.parse(await readFile(join(process.cwd(), 'package.json'), 'utf8')) as {
|
|
74
|
+
exports?: Record<string, { default?: string; types?: string }>;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
expect(packageJson.exports?.['./deploy-provider']).toEqual({
|
|
78
|
+
types: './dist/deployProvider.d.ts',
|
|
79
|
+
default: './dist/deployProvider.js',
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DeploymentCredentialReference,
|
|
3
|
+
DeploymentProviderResult,
|
|
4
|
+
DeploymentSecretResolver,
|
|
5
|
+
DeploymentStoreIdentity,
|
|
6
|
+
} from './deployProvider';
|
|
7
|
+
|
|
8
|
+
export type MonetizationProductKind = 'consumable' | 'non-consumable' | 'subscription';
|
|
9
|
+
|
|
10
|
+
export interface MonetizationLocalization {
|
|
11
|
+
readonly locale: string;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly description: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface MonetizationBasePrice {
|
|
17
|
+
readonly country: string;
|
|
18
|
+
readonly currency: string;
|
|
19
|
+
readonly amount: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type MonetizationSubscriptionPeriod = 'P1W' | 'P1M' | 'P2M' | 'P3M' | 'P6M' | 'P1Y';
|
|
23
|
+
|
|
24
|
+
export interface MonetizationSubscription {
|
|
25
|
+
readonly family: string;
|
|
26
|
+
readonly period: MonetizationSubscriptionPeriod;
|
|
27
|
+
readonly level?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface MonetizationProduct {
|
|
31
|
+
readonly id: string;
|
|
32
|
+
readonly kind: MonetizationProductKind;
|
|
33
|
+
readonly localizations: readonly MonetizationLocalization[];
|
|
34
|
+
readonly basePrice: MonetizationBasePrice;
|
|
35
|
+
readonly subscription?: MonetizationSubscription;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface MonetizationObservedProduct {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly kind: MonetizationProductKind | 'one-time';
|
|
41
|
+
readonly localizations: readonly MonetizationLocalization[];
|
|
42
|
+
readonly basePrice?: MonetizationBasePrice;
|
|
43
|
+
readonly subscription?: MonetizationSubscription;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface MonetizationDesiredState {
|
|
47
|
+
readonly revision: string;
|
|
48
|
+
readonly products: readonly MonetizationProduct[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface MonetizationDiagnostic {
|
|
52
|
+
readonly severity: 'warning' | 'error';
|
|
53
|
+
readonly code: string;
|
|
54
|
+
readonly message: string;
|
|
55
|
+
readonly target?: 'android' | 'ios';
|
|
56
|
+
readonly productId?: string;
|
|
57
|
+
readonly locale?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface MonetizationTargetState {
|
|
61
|
+
readonly target: 'android' | 'ios';
|
|
62
|
+
readonly products: readonly MonetizationObservedProduct[];
|
|
63
|
+
readonly subscriptionFamilies: readonly string[];
|
|
64
|
+
readonly diagnostics: readonly MonetizationDiagnostic[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface MonetizationPlanStep {
|
|
68
|
+
readonly id: string;
|
|
69
|
+
readonly target: 'android' | 'ios';
|
|
70
|
+
readonly productId: string;
|
|
71
|
+
readonly operation:
|
|
72
|
+
| 'ensure-subscription-family'
|
|
73
|
+
| 'create-product'
|
|
74
|
+
| 'update-metadata'
|
|
75
|
+
| 'update-price'
|
|
76
|
+
| 'update-subscription';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface MonetizationPlan {
|
|
80
|
+
readonly status: 'no-change' | 'changes' | 'blocked';
|
|
81
|
+
readonly desiredRevision: string;
|
|
82
|
+
readonly currentRevision: string;
|
|
83
|
+
readonly steps: readonly MonetizationPlanStep[];
|
|
84
|
+
readonly diagnostics: readonly MonetizationDiagnostic[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface MonetizationAdapterContext {
|
|
88
|
+
readonly identity: DeploymentStoreIdentity;
|
|
89
|
+
readonly credentials: readonly DeploymentCredentialReference[];
|
|
90
|
+
readonly resolveSecret: DeploymentSecretResolver;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface MonetizationSyncRequest extends MonetizationAdapterContext {
|
|
94
|
+
readonly desired: MonetizationDesiredState;
|
|
95
|
+
readonly plan: MonetizationPlan;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface DeploymentMonetizationAdapter {
|
|
99
|
+
readonly target: 'android' | 'ios';
|
|
100
|
+
inspectAsync(
|
|
101
|
+
context: MonetizationAdapterContext,
|
|
102
|
+
): Promise<DeploymentProviderResult<MonetizationTargetState>>;
|
|
103
|
+
syncAsync(
|
|
104
|
+
request: MonetizationSyncRequest,
|
|
105
|
+
): Promise<DeploymentProviderResult<MonetizationTargetState>>;
|
|
106
|
+
}
|